drivers: timer: nrf: Fix premature timeouts
If timeout is being overwrite exactly when previous one is expiring then hardware event was cleared correctly but interrupt was already triggered. Interrupt routine was assuming that compare event is set and proceed with that assumption. However, in that corner case when compare event was overwritten and event was cleared, that was not the case. As the outcome, timeout could be triggered prematurely. Fixed by clearing pending interrupt after handling previous compare value. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
775b2457d7
commit
699b717452
1 changed files with 5 additions and 0 deletions
|
@ -88,6 +88,11 @@ static void prevent_false_prev_evt(void)
|
|||
k_busy_wait(15);
|
||||
event_clear();
|
||||
}
|
||||
|
||||
/* Clear interrupt that may have fired as we were setting the
|
||||
* comparator.
|
||||
*/
|
||||
NVIC_ClearPendingIRQ(RTC1_IRQn);
|
||||
}
|
||||
|
||||
/* If settings is next tick from now, function attempts to set next tick. If
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue