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
From the documentation, I assume that the set_compare method aims to schedule an interruption for a given time instant. However, in my use case, there is a chance that I must do some housekeeping and need two different interrupts to handle timer overflows.
I was thinking about making set_compare and on_interrupt work jointly to handle this particularity. However, I am not sure if RTIC supports "fake" interrupts in intermediate instants that do not correspond to the instant provided when calling set_compare. Is it OK to trigger extra interruptions?
The text was updated successfully, but these errors were encountered:
AfoHT
transferred this issue from rtic-rs/rtic-monotonic
Jul 5, 2023
AfoHT
changed the title
Is handling intermediate interrupts for housekeeping OK?
rtic-monotonic: Is handling intermediate interrupts for housekeeping OK?
Jul 5, 2023
Yes, it is ok. If a spurious interrupt happens, RTIC will simply re-check the timer queue and do another set_compare.
"need two different interrupts to handle timer overflows" - Check out the imxrt-gpt monotonic on how to deal with overflows, it uses one rollover interrupt and one half-period interrupt.
Also check out this new helper utility specifically geared towards implementing a monotonic based on those two interrupts.
Be careful with race conditions - handling timer overflows is very race condition prone, as the timer register is inherently asynchronous. The aforementioned helper utility describes this problem and how to solve it reliably.
From the documentation, I assume that the
set_compare
method aims to schedule an interruption for a given time instant. However, in my use case, there is a chance that I must do some housekeeping and need two different interrupts to handle timer overflows.I was thinking about making
set_compare
andon_interrupt
work jointly to handle this particularity. However, I am not sure if RTIC supports "fake" interrupts in intermediate instants that do not correspond to the instant provided when callingset_compare
. Is it OK to trigger extra interruptions?The text was updated successfully, but these errors were encountered: