mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
esp_timer: fix occasional failures in "monotonic values" test
1. ref_clock used in unit tests occasionally produces time off by ~100 microseconds shortly after being started. Add a delay to let ref_clock stabilise, until the cause is found. 2. Reduce roundoff error accumulation which would occasionally cause the test to fail, by choosing an overflow value which can be divided by APB frequency. 3. Move time sampling part of the test into an IRAM function to reduce variations due to cache behavior. 4. Remove calculation of "standard deviation" in the test, as what was calculated was not actually standard deviation, and it did not add any useful information.
This commit is contained in:
@@ -97,7 +97,7 @@ static uint32_t s_alarm_overflow_val = DEFAULT_ALARM_OVERFLOW_VAL;
|
||||
|
||||
static const char* TAG = "esp_timer_impl";
|
||||
|
||||
// Interrupt handle retuned by the interrupt allocator
|
||||
// Interrupt handle returned by the interrupt allocator
|
||||
static intr_handle_t s_timer_interrupt_handle;
|
||||
|
||||
// Function from the upper layer to be called when the interrupt happens.
|
||||
@@ -123,7 +123,7 @@ static uint32_t s_timer_us_per_overflow;
|
||||
// value than the one which caused an interrupt. This can cause interrupt handler
|
||||
// to consider that the interrupt has happened due to timer overflow, incrementing
|
||||
// s_time_base_us. To avoid this, frequency switch hook sets this flag if
|
||||
// it needs to set timer alarm value to ALARM_OVERFLOW_VAL. Interrupt hanler
|
||||
// it needs to set timer alarm value to ALARM_OVERFLOW_VAL. Interrupt handler
|
||||
// will not increment s_time_base_us if this flag is set.
|
||||
static bool s_mask_overflow;
|
||||
|
||||
|
Reference in New Issue
Block a user