-->
Page 1 of 1

Question regarding os_timer_t

PostPosted: Fri Feb 01, 2019 11:25 pm
by vaiojasard
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

Re: Question regarding os_timer_t

PostPosted: Tue Feb 05, 2019 5:00 am
by quackmore
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