pkarashchenko edited a comment on pull request #5424: URL: https://github.com/apache/incubator-nuttx/pull/5424#issuecomment-1030887123
> If you are familiar with Linux kernel, two set of API exist: timer: http://www.makelinux.net/ldd3/chp-7-sect-4.shtml hrtimer: https://www.kernel.org/doc/html/latest/timers/hrtimers.html NuttX's wdog is same as Linux's timer from the concept. If you want to achieve the accuracy as the hardware, the solution I suggest is: > > 1. Implement the high resolution timer like Linux kernel > > 2. Implement wdog on top of hrtimer(then you will understand what I said in this thread). > > 3. Implement POSIX timer and timer fd on top of hrtimer > > > This is exactly how Linux kernel switch from the tick resolution to the high resolution. Before this huge work is done, the fast fix is set CONFIG_USEC_PER_TICK to the accuracy you want. Of course, you need to enable tickless(CONFIG_SCHED_TICKLESS) to reduce the schedule timer interrupt loading. No matter what accuracy do I want I'm still having +1 tick with current code. So if I configure `CONFIG_USEC_PER_TICK` to `1000`, then I'm having 11ms on a 10ms timer and that is 10% overhit (this is huge) no matter if I use `CONFIG_SCHED_TICKLESS` or not. Here is a picture when I start timer from the button ISR:  Here is toggle GPIO as a periodic action. The pulses are exactly 30ms length I do not understand why proposed changes that improve accuracy almost as 0 cost are pushed back so hard. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
