patacongo commented on pull request #1726: URL: https://github.com/apache/incubator-nuttx/pull/1726#issuecomment-687907015
> > > > It appears that STM32 sets a zero interval timeout. So the interrupt and call to nxsched_alarm_expiration() will occurr immediately. > > Ah, that makes sense. Thanks for checking. > So it is expected that the 200ms timer is always working even with one task? It would be cool if no interrupts fired unless necessary. Interrupts will not be used. The best alternative is to do nothing at all: Don't set a zero-interval timer; don't call nxsched_timer_expiration(). Then the interval timer will not be set until there is something that needs to be timed. You already saw this. When you did, `nsh> sleep 1`, the interval timer started for one second then stopped. There were no interrupts before the sleep 1 and no interrupt after. That is correct behavior. Of course, on a busy system with lots of timing, the interval timer will be running most of the time. > > > NOTICE that tickless mode does not have the drift that you were concerned about when using the oneshot timer for a periodic event: The tickless mode uses both a free-running and a one-shot timer (which might be one or two times). So it gets the time that the interval timer is processed directly from the free-running timer. > > I modeled this implementation for nRF52 following the idea that stm32_tickless.c uses with just one timer. I used TICKLESS_ALARM though, whereas stm32_tickless.c uses non-alarm mode. Functionally, the two implementations are the same. The single timer implementation just uses fewer resources to accomplish the same thing. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org