Hello,



I´ve finished the implementation of tickless mode support for iMXRT MCU,
which is a part of my Google Summor of Code project (https://cwiki.apache.
org/confluence/display/NUTTX/%5B2021%5D+NuttX+Support+for+Rapid+Control+
Applications+Development+with+pysimCoder). The source code can be found here
in my NuttX fork (https://github.com/michallenc/incubator-nuttx/blob/imxrt-
tickless/arch/arm/src/imxrt/imxrt_tickless.c), I used the alarm option to 
take the advantage of using just one timer running in free-run mode. I did
some tests with applications (ADC reading example and control application of
DC motor designed with pysimCoder) and they are working fine, but command 
"sleep" bothers me a little bit.




When I compile normal NuttX nsh configuration with tickless mode, "sleep 2"
is accurate and takes about 2.0001 seconds. But when I use some bigger
configuration (like configurating PWM, qencoder, GPIO, ethernet and so on 
for DC motor control), "sleep 2" is much less accurate. Sometimes it really
takes 2 seconds, but sometimes I get values like 1.9947 (I am using "time"
command). I did found out that sleep command takes one tick more in normal
mode, can some of those inaccuracies also happen in tickless mode?




The other source of the inaccuracy can be in clock frequency. I use 32 kHz
clock source, but this value cannot be properly represented by CONFIG_USEC_
PER_TICK, which I set to 31 (which is aproximately 32.25 kHz). But 32 kHz 
clock source seems to be the only possible in iMXRT as others are to hight
(tens or hundreds of MHz) and can´t be represended by the timer prescaler
divider. Did anyone have similar problems when implementing tickless mode 
for some platforms?




Thanks for your inputs.


Best regards,
Michal Lenc

Reply via email to