From 5c7c0713b89d1944fd877998aaad372697a30863 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 17 Oct 2019 17:14:18 +0200 Subject: [PATCH] tests: drivers: counter: Add delay for clock stabilization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On nRF platforms, Xtal LF clock source starts hundreds of milliseconds. Until it is not started, test may fail due to wrong timing. Add initial delay in the test for required clocks complete their start-up. Signed-off-by: Krzysztof Chruscinski Signed-off-by: Andrzej Głąbek --- tests/drivers/counter/counter_basic_api/src/test_counter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/drivers/counter/counter_basic_api/src/test_counter.c b/tests/drivers/counter/counter_basic_api/src/test_counter.c index d7e4f62cb9c..89eb85cf827 100644 --- a/tests/drivers/counter/counter_basic_api/src/test_counter.c +++ b/tests/drivers/counter/counter_basic_api/src/test_counter.c @@ -801,6 +801,12 @@ void test_cancelled_alarm_does_not_expire(void) void test_main(void) { + /* Give required clocks some time to stabilize. In particular, nRF SoCs + * need such delay for the Xtal LF clock source to start and for this + * test to use the correct timing. + */ + k_busy_wait(USEC_PER_MSEC * 300); + ztest_test_suite(test_counter, ztest_unit_test(test_set_top_value_with_alarm), ztest_unit_test(test_single_shot_alarm_notop),