You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...doesn't work. Exactly: it causes a pico to be blocked and reset by the watchdog. The documentation has almost no information about interrupts – though that may be understandable, since in the context of attachInterrupt(), the topic is simple and doesn’t require special handling. Should I understand that it's not possible to use the interrupt generation function with the pico timer, or did I do something incorrectly? I tested the code on SDK version 4.2.1 and 4.4.2 – same result. In the code, I generally use attachInterrupt() assigned to several pins. I set the interrupts from the core0 context.
The text was updated successfully, but these errors were encountered:
timer needs to live for the life of the timer, but you've placed it on the stack. That's not legal, you can't access that data after exiting the function. Instead, move timer to a global or heap allocation. When the timer IRQ fires it will try and access some region of the stack that's been overwritten (and in use) by other routines and boom...
From the SDK docs...
<timer> the pointer to the user owned structure to store the repeating timer info in. BEWARE this storage location must outlive the repeating timer, so be careful of using stack space
This simple code snippet:
int interruptValue;
bool repeating_timer_callback(repeating_timer_t *rt) {
interruptValue++;
return true;
}
void interruptInit() {
noInterrupts();
repeating_timer_t timer;
add_repeating_timer_ms(100, repeating_timer_callback, NULL, &timer);
interrupts();
}
...doesn't work. Exactly: it causes a pico to be blocked and reset by the watchdog. The documentation has almost no information about interrupts – though that may be understandable, since in the context of attachInterrupt(), the topic is simple and doesn’t require special handling. Should I understand that it's not possible to use the interrupt generation function with the pico timer, or did I do something incorrectly? I tested the code on SDK version 4.2.1 and 4.4.2 – same result. In the code, I generally use attachInterrupt() assigned to several pins. I set the interrupts from the core0 context.
The text was updated successfully, but these errors were encountered: