Skip to content

Commit 30450d4

Browse files
committed
Decrease error in Timeout test due to ISR latency
Increase the Timeout period from 1ms to 10ms so interrupt latency has 1/10th the effect on the measurement. This prevents failures due to interrupt latency causing a drift.
1 parent d9aff6f commit 30450d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

TESTS/mbed_drivers/timeout/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636

3737
using namespace utest::v1;
3838

39-
#define ONE_MILLI_SEC 1000
39+
#define PERIOD_US 10000
4040

4141
volatile int ticker_count = 0;
4242
volatile uint32_t callback_trigger_count = 0;
4343
static const int test_timeout = 240;
4444
Timeout timeout;
4545

4646
void set_incremeant_count() {
47-
timeout.attach_us(set_incremeant_count, ONE_MILLI_SEC);
47+
timeout.attach_us(set_incremeant_count, PERIOD_US);
4848
++callback_trigger_count;
4949
}
5050

@@ -56,19 +56,19 @@ void test_case_timeout() {
5656
uint8_t results_size = 0;
5757

5858
greentea_send_kv("timing_drift_check_start", 0);
59-
timeout.attach_us(set_incremeant_count, ONE_MILLI_SEC);
59+
timeout.attach_us(set_incremeant_count, PERIOD_US);
6060

6161
// wait for 1st signal from host
6262
do {
6363
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
6464
expected_key = strcmp(_key, "base_time");
6565
} while (expected_key);
6666

67-
greentea_send_kv(_key, callback_trigger_count * ONE_MILLI_SEC);
67+
greentea_send_kv(_key, callback_trigger_count * PERIOD_US);
6868

6969
// wait for 2nd signal from host
7070
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
71-
greentea_send_kv(_key, callback_trigger_count * ONE_MILLI_SEC);
71+
greentea_send_kv(_key, callback_trigger_count * PERIOD_US);
7272

7373
//get the results from host
7474
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));

0 commit comments

Comments
 (0)