Skip to content

Commit

Permalink
Merge branch 'test/improve_adc_continuous_iram_test_aim' into 'master'
Browse files Browse the repository at this point in the history
esp_adc: improve adc continuous iram test aim

Closes IDFCI-1453

See merge request espressif/esp-idf!20078
  • Loading branch information
Icarus113 committed Oct 9, 2022
2 parents 1308ff3 + 5fd4dba commit 10b5382
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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));
Expand Down

0 comments on commit 10b5382

Please sign in to comment.