Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Gregory Nutt
To avoid the accumulation of conversion error, the count in timer driver should use the same time unit as the hardware. BTW, your timer driver has to implement the up_alarm_xxx functions. Unfortunately, 32.768KHz is a very common clock frequency and it cannot be handled by the current lo

Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Gregory Nutt
To avoid the accumulation of conversion error, the count in timer driver should use the same time unit as the hardware. BTW, your timer driver has to implement the up_alarm_xxx functions. Unfortunately, 32.768KHz is a very common clock frequency and it cannot be handled by the current logic.

Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Michal Lenc
Hi Greg, thanks for your advices. > If you use 32.768KHz clock source, then there is a small error in every > time conversion since 1/32768 cannot be represented in microseconds.  > Normally, this will result in small errors as you have noted.  However, > in a very busy system with man t

Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Xiang Xiao
To avoid the accumulation of conversion error, the count in timer driver should use the same time unit as the hardware. BTW, your timer driver has to implement the up_alarm_xxx functions. On Sun, Jul 11, 2021 at 9:10 AM Gregory Nutt wrote: > Actually, the situation is much worse: > > https://git

Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Gregory Nutt
Actually, the situation is much worse: https://github.com/apache/incubator-nuttx/blob/master/boards/arm/sama5/sama5d3x-ek/README.txt#L2823 If you use 32.768KHz clock source, then there is a small error in every time conversion since 1/32768 cannot be represented in microseconds.  Normally, thi

Re: sama5d27 UPLL

2021-07-11 Thread TimH
Hi Alan, Thanks for the suggestion - I have GDB and J-Link and am using VS Code as my IDE, which does have some "watch" limitations it seems :( But I have found I was wrong about it being NuttX that's changing the SFR register. It seems that U-boot doesn't set it despite being configured for

Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Gregory Nutt
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 h

Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Michal Lenc
Hi Alan, thanks for the link! I will take a look into it. Best regards, Michal Lenc -- Původní e-mail -- Od: Alan Carvalho de Assis Komu: dev@nuttx.apache.org Datum: 11. 7. 2021 16:19:59 Předmět: Re: Tickless mode for iMXRT MCU "Hi Michal, Please take a look at this wiki p

Re: Tickless mode for iMXRT MCU

2021-07-11 Thread Alan Carvalho de Assis
Hi Michal, Please take a look at this wiki page, it could help you to understand the issue with sleep take one more context switch cycle: https://cwiki.apache.org/confluence/display/NUTTX/Short+Time+Delays Unfortunately the Timer Hook that could help you in this case will not work in Tickless mod

Tickless mode for iMXRT MCU

2021-07-11 Thread Michal Lenc
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