Time.now() in a timer() ISR crashes Boron

Why does calling Time.now() in a Timer() ISR cause my Boron 0.9.0 or 0.8 rc27 to crash and blink red? This works fine on a Proton.

void systemClocking()
Timer timer(1, systemClocking);

void setup() {
// Start system clock routing using a timer

Because of Time.isValid() being called internally.

And blocking an ISR is a massive no-no!
Although SoftwareTimer callbacks are not actually ISRs it’s still not advisable to block for longis periodes. With timer callbacks you may also run into stack limitations when a function call internally features other nested calls that may exhaust the stack.
To tell the difference of both potential causes we’d need to know what kind of red blink you see - how many slow blinks after the SOS code?


Ah thanks. Was not aware of it blocking! What function can I call instead? There’s no millis() command or is there? I’m just looking to get the number of milliseconds since boot.

@mikes603, checking out the docs might help!

1 Like