mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_adc: improve adc continuous iram test aim
This commit increases adc continuous iram test period of cache disabling time. Now time is: 1 second - The aim of this test is to make sure the continuous mode driver ISR callbacks can run in an IRAM-Safe context. - Closing cache takes time. WHereas the code to close the cache is updated. This time gets changed.
This commit is contained in:
parent
ee769abe19
commit
35b0be3eca
@ -215,13 +215,11 @@ TEST_CASE("ADC continuous work with ISR and Flash", "[adc_oneshot]")
|
||||
};
|
||||
TEST_ESP_OK(adc_continuous_register_event_callbacks(handle, &cbs, &isr_test_ctx));
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
//This may need to be bigger, when the sampling freq is low
|
||||
uint32_t overhead_us = 150;
|
||||
#else
|
||||
uint32_t overhead_us = 50;
|
||||
#endif
|
||||
uint32_t wait_time_us = (1000 * 1000 / ADC_TEST_FREQ_HZ * ADC_TEST_PKG_SIZE / SOC_ADC_DIGI_RESULT_BYTES) + overhead_us;
|
||||
/**
|
||||
* Ideal time consumption for one conversion_frame done is `(1000 * 1000 / ADC_TEST_FREQ_HZ * ADC_TEST_PKG_SIZE / SOC_ADC_DIGI_RESULT_BYTES)`
|
||||
* Here we just wait for 1 second
|
||||
*/
|
||||
uint32_t wait_time_us = 1 * 1000 * 1000;
|
||||
printf("period is %"PRId32" us\n", wait_time_us);
|
||||
|
||||
//ADC IO tile low
|
||||
@ -233,6 +231,7 @@ TEST_CASE("ADC continuous work with ISR and Flash", "[adc_oneshot]")
|
||||
//Checks
|
||||
TEST_ASSERT_INT_WITHIN(ADC_TEST_LOW_THRESH, ADC_TEST_LOW_VAL, isr_test_ctx.adc_raw_low);
|
||||
esp_rom_printf("callback runs %d times when $ disabled\n", isr_test_ctx.cb_exe_times_low);
|
||||
//At least 1 time conv_done callback happens during this period is ok
|
||||
TEST_ASSERT_GREATER_OR_EQUAL(1, isr_test_ctx.cb_exe_times_low);
|
||||
|
||||
vTaskDelay(10);
|
||||
@ -245,8 +244,9 @@ TEST_CASE("ADC continuous work with ISR and Flash", "[adc_oneshot]")
|
||||
s_test_cache_disable_period_us(&isr_test_ctx, wait_time_us);
|
||||
TEST_ESP_OK(adc_continuous_stop(handle));
|
||||
//Checks
|
||||
// TEST_ASSERT_INT_WITHIN(ADC_TEST_HIGH_THRESH, ADC_TEST_HIGH_VAL_DMA, isr_test_ctx.adc_raw_high);
|
||||
TEST_ASSERT_INT_WITHIN(ADC_TEST_HIGH_THRESH, ADC_TEST_HIGH_VAL_DMA, isr_test_ctx.adc_raw_high);
|
||||
esp_rom_printf("callback runs %d times when $ disabled\n", isr_test_ctx.cb_exe_times_high);
|
||||
//At least 1 time conv_done callback happens during this period is ok
|
||||
TEST_ASSERT_GREATER_OR_EQUAL(1, isr_test_ctx.cb_exe_times_high);
|
||||
|
||||
TEST_ESP_OK(adc_continuous_deinit(handle));
|
||||
|
Loading…
Reference in New Issue
Block a user