So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By vaiojasard
#80377 Hi folks!

I've read that os_timer_t timers are software based but I've a doubt about its actual implementation:

a) its expiration interrupt the current running code granting the execution to the timer handling function, namely, are they interrupt driven?

b) They aren't interrupt driven. The underlying layer checks periodically for timers expiration and grants the execution to the handling function if any did so.

Is there some good reading about this topic out there?

Thanks in advance.

Best regards

Pablo
User avatar
By quackmore
#80430 yes there is, it's the ESP8266 Non-OS SDK API Reference (recently bumped into this)

quoting about SW timers:
Code: Select allPlease note that os_timer APIs listed below are software timers executed in tasks, thus
timer callbacks may not be precisely executed at the right time; it depends on priority. If you
need a precise timer, please use a hardware timer which can be executed in hardware
interrupt. For details please refer to hw_timer.c.

and
Code: Select allThe microsecond timer is not very precise. Even though timer callbacks are assigned a
higher priority over user functions, there might be a 500 μs jitter in callbacks.


as a rule of thumb I'm
using SW timers for intervals between 5 to 6.870.947 ms
using HW timers for intervals between 10 to 1.677.721 us