Pickle
Mega GP Mania
On the gp2x we had access to a timer with usec resolution. Does anyone have any information of a highspeed timer we can use on the wiz?
What ever SDL is uing seems unreliable.
What ever SDL is uing seems unreliable.
Pickle said:On the gp2x we had access to a timer with usec resolution. Does anyone have any information of a highspeed timer we can use on the wiz?
What ever SDL is uing seems unreliable.
Exophase said:Pickle said:On the gp2x we had access to a timer with usec resolution. Does anyone have any information of a highspeed timer we can use on the wiz?
What ever SDL is uing seems unreliable.
Have you checked out with gettimeofday's returns are like? There's no reason why its precision should be sub-microsecond if the timers can provide that (and they can). Unless they did it wrong, which wouldn't be that surprising.
However, SDL is probably using gettimeofday too.
Are you certain you're referring to SDL_GetTicks and not SDL_Delay?
clock_t wiz_timer_read(void)
{
return clock(); /* CLOCKS_PER_SEC = 1000000 */
}
Franxis said:Why don't you use clock()?
Code:clock_t wiz_timer_read(void) { return clock(); /* CLOCKS_PER_SEC = 1000000 */ }
I've noticed earlier it returns "jumpy" values (sometimes subsequent reads have ~8ms time difference instead 0-1us like they should), so I did some investigation now. The problem with it is that it returns lower values then it should, the time "goes slower", then in every ~10ms it jumps to catch up. I can see where that ~10ms comes from (system timer interrupt).Exophase said:Have you checked out with gettimeofday's returns are like?
Franxis said:Why don't you use clock()?
Code:clock_t wiz_timer_read(void) { return clock(); /* CLOCKS_PER_SEC = 1000000 */ }
DESCRIPTION
The clock() function returns an approximation of processor time used by the program.
notaz said:Only first of 5 POLLUX timers seems to be used by Linux, I've reprogrammed TIMER1 without any problems.
For now I'll leave that for Orkie.Pickle said:notaz said:Only first of 5 POLLUX timers seems to be used by Linux, I've reprogrammed TIMER1 without any problems.
Can you post any detail on how to use these timers?
It will still rely on some system calls, wouldn't it? The problem with Wiz is that those system calls don't return reliable data.xteraco said:This thread reminds me of a portable high precision timer I wrote in C. If you're interested in seeing the code let me know.
notaz said:I've noticed earlier it returns "jumpy" values (sometimes subsequent reads have ~8ms time difference instead 0-1us like they should), so I did some investigation now. The problem with it is that it returns lower values then it should, the time "goes slower", then in every ~10ms it jumps to catch up. I can see where that ~10ms comes from (system timer interrupt).
The GP2X doesn't have such problem.
Orkie said:That isn't the high precision timer, but clearly it is precise enough for what you are doing . I don't think the final Wizzes actually use it as an RTC (they have an external one or something, because the one built into the Pollux stops ticking if you shut it down) so you should be able to use it however you like.
Orkie said:To be honest, I thought it only updated once a second. It has a 32.786kHz source, but that should be divided down to 1Hz. Your experience seems to suggest otherwise though?