Skip to content

Commit 470176e

Browse files
pabigotMaureenHelm
authored andcommitted
tests: kernel/sleep: increase maximum threshold for nRF51
nRF51 MCUs are Cortex-M0 running with a 16 MHz clock. The overhead of work done in k_usleep() requires adding three more ticks (92 us) to the expected loop iteration time. (Two ticks is enough on most boards, but some require a little more time.) Signed-off-by: Peter Bigot <[email protected]>
1 parent fe6a736 commit 470176e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/kernel/sleep/src/usleep.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
*/
2626

2727
#if defined(CONFIG_NRF_RTC_TIMER) && (CONFIG_SYS_CLOCK_TICKS_PER_SEC > 16384)
28-
#define MAXIMUM_SHORTEST_TICKS 3
28+
/* The overhead of k_usleep() adds three ticks per loop iteration on
29+
* nRF51, which has a slow CPU clock.
30+
*/
31+
#define MAXIMUM_SHORTEST_TICKS (IS_ENABLED(CONFIG_SOC_SERIES_NRF51X) ? 6 : 3)
2932
/*
3033
* Similar situation for TI CC13X2/CC26X2 RTC due to the limitation
3134
* that a value too close to the current time cannot be loaded to

0 commit comments

Comments
 (0)