Forum Discussion
Altera_Forum
Honored Contributor
21 years agoHi jan,
> can give me advice how to get exact 20ms timing in uClinux > running in NIOS2 Linux user-space timer mechanisms don't always behave in a manner that most embedded developers would expect. For example, on some systems usleep(1000) will sleep for 20 msec ... not 1 msec! 8-P A (potential) work-around is to use select() system call ... which may give you better resolution on some systems ... and is relatively portable. I've used it successfully on several PowerPC & ARM systems with timeouts as low as 1 msec ... although I haven't tested it with Nios-II/uClinux. You might want to give it a try (and let us all know what you learn). Ultimately, this all depends on your hardware timer though :-) struct timeval to;
to.tv_sec = 0;
to.tv_usec = SOME_USEC_VALUE;
select( 0, NULL, NULL, NULL, &to ); Regards, --Scott