On Thu, Jun 1, 2023 at 12:35 PM Gregory Nutt <spudan...@gmail.com> wrote:

>
> > This may be way off base but, have you tried reverting
> >
> https://github.com/apache/nuttx/commit/7312a553bbc40f3771c5d53ccded89bed7391f2a
> >
> > It release the CPU but traded that for potentially quantized large delays
>
> Yes, I would expect the up_udelay to be in error by about about 0.5 uS
> (provided that the delay loop is properly calibrated).  The
> nxsig_usleep() should be error by about 1.5 x system-timer-period plus
> context switching delays.
>
> With the default timer period of 10 MS, that would be an error of about
> 15 MS -- Always longer in time than requested.
>
> A fix would be to use the tickless mode with a timer period of about 1 uS.



That would help when tickless mode is used. But what about tickful mode? I
guess the intent of 7312a553b was to avoid wasting processor cycles on busy
waiting, but if tickless isn't being used, perhaps busy waiting is
necessary here? It could choose between the two wait types at compile time
based on tickless mode.

Or a bigger question: if tickless mode is "better" (longer battery life,
fewer unnecessary interrupts, more processor cycles for real work) why
aren't we always using tickless mode? Are there limitations/bugs that make
it unsuitable in some situations? Not universally supported on all
microprocessors? Other reasons?

Cheers,
Nathan

Reply via email to