From c4cf1f1eae4fc2d326c0fcb407d8fcfcbc90c8cf Mon Sep 17 00:00:00 2001 From: Przemyslaw Stekiel Date: Thu, 8 Feb 2018 09:19:28 +0100 Subject: [PATCH] lp_us_tickers test - add tolerance to interrupt time. On some platforms (e.g. K64F) different counters are used for time measurement and interrupt generation. Because of that we should relax interrupt test case and give additional time before checking if interrupt handler has been executed. --- TESTS/mbed_hal/lp_us_tickers/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TESTS/mbed_hal/lp_us_tickers/main.cpp b/TESTS/mbed_hal/lp_us_tickers/main.cpp index 5d3e691a73..5e1ced8af1 100644 --- a/TESTS/mbed_hal/lp_us_tickers/main.cpp +++ b/TESTS/mbed_hal/lp_us_tickers/main.cpp @@ -27,7 +27,7 @@ #define FORCE_OVERFLOW_TEST (false) #define TICKER_INT_VAL 500 -#define TICKER_DELTA 50 +#define TICKER_DELTA 10 #define LP_TICKER_OVERFLOW_DELTA 0 // this will allow to detect that ticker counter rollovers to 0 #define HF_TICKER_OVERFLOW_DELTA 50 @@ -147,17 +147,17 @@ void ticker_interrupt_test(void) TEST_ASSERT_EQUAL_INT_MESSAGE(0, intFlag, "Interrupt fired too early"); } - /* Wait until ticker count reach value: tick_count + ticker_timeout[i]. + /* Wait until ticker count reach value: tick_count + ticker_timeout[i] + TICKER_DELTA. * Interrupt should be fired after this time. */ - while (intf->read() < (tick_count + ticker_timeout[i])) { + while (intf->read() < (tick_count + ticker_timeout[i] + TICKER_DELTA)) { /* Just wait. */ } TEST_ASSERT_EQUAL(1, intFlag); - /* Wait until ticker count reach value: tick_count + 3 * ticker_timeout[i]. + /* Wait until ticker count reach value: tick_count + 2 * ticker_timeout[i] + TICKER_DELTA. * Interrupt should not be triggered again. */ - while (intf->read() < (tick_count + 3 * ticker_timeout[i])) { + while (intf->read() < (tick_count + 2 * ticker_timeout[i] + TICKER_DELTA)) { /* Just wait. */ }