Skip to content

Commit f3910fd

Browse files
nordic-krchnashif
authored andcommitted
drivers: timer: nrf_rtc_timer: Increase half tick busy wait
Due to clock discrepancy, busy waiting for 15us was not covering for half tick in certain cases. Busy wait runs from HF clock source. Increased to 19us to cover it. Anyway, this case is hit very rarely, only when there was aborted, not-cancelled compare value that was about to expire. Because of that, increase shall not impact the performance. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent 35adb6e commit f3910fd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/timer/nrf_rtc_timer.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ static void set_absolute_alarm(uint32_t chan, uint32_t abs_val)
171171
*/
172172
set_comparator(chan, now);
173173
if (counter_sub(prev_cc, now) == 1) {
174-
k_busy_wait(15);
174+
/* It should wait for half of RTC tick 15.26us. As
175+
* busy wait runs from different clock source thus
176+
* wait longer to cover for discrepancy.
177+
*/
178+
k_busy_wait(19);
175179
}
176180

177181

0 commit comments

Comments
 (0)