-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spurious IRQs in periph_timer
#18976
Comments
EFM32 Series 2 looks good for the TIMER and LPTIMER peripheral. |
RP2040 is still passing the new test, so it seems to be not affected.
|
SAM3 is also fine:
|
It seems that
However, the bug it is affected by doesn't look that friendly, either. |
The CC26xx/CC13xx is not affected by this bug, but 2 out of four timers do not initialize (so the test fails). |
@bergzand: I'm almost sure the GD32V will be affected, as the |
19112: cpu/riscv_common/periph_timer: Fix timer_clear() r=benpicco a=maribu ### Contribution description Previously, timer_clear() was a no-op, resulting in spurious IRQs from already canceled timeouts. This fixes the issue. ### Testing procedure ``` $ make BOARD=hifive1b flash test -C tests/periph_timer [...] Welcome to pyterm! Bench Clock Reset Complete ATE0-->ATE0 OK AT+BLEINIT=0-->OK AT+CWMODE=0-->OK Help: Press s to start test, r to print it is ready READY s START main(): This is RIOT! (Version: 2023.01-devel-773-g441b69) Test for peripheral TIMERs Available timers: 1 Testing TIMER_0: TIMER_0: initialization successful TIMER_0: stopped TIMER_0: set channel 0 to 5000 TIMER_0: starting TIMER_0: channel 0 fired at SW count 3164199 - init: 3164199 TEST SUCCEEDED ``` (In `master`, the test fails with a spurious IRQ.) ### Issues/PRs references #18976 Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Description
It turned out that some
periph_timer
implementations just masked IRQs ontimer_clear()
. If the interrupt condition then occurred later on, the IRQ flag was set but (due to being masked) not executed. However, the next call totimer_set_absolute()
unmasked the IRQ, which resulted in the pending flag to directly cause the timer to fire.Expected results
timer_set_absolute()
doesn't fire directly on setting (if the target is in the future), so thattests/periph_timer
from #18963 passes.Actual results
timer_set_absolute()
occasionally fires right away at least on some implementations and #18963 fails.Tracking
Versions
Current
master
,2022.10-branch
The text was updated successfully, but these errors were encountered: