mcpwm: enable test on esp32c6

This commit is contained in:
morris
2022-12-21 18:38:07 +08:00
parent d3716c439d
commit c6e452a871
5 changed files with 14 additions and 17 deletions

View File

@@ -43,10 +43,6 @@ components/driver/test_apps/legacy_adc_driver:
components/driver/test_apps/legacy_mcpwm_driver: components/driver/test_apps/legacy_mcpwm_driver:
disable: disable:
- if: SOC_MCPWM_SUPPORTED != 1 - if: SOC_MCPWM_SUPPORTED != 1
disable_test:
- if: IDF_TARGET == "esp32c6"
temporary: true
reason: target esp32c6 is not supported yet
components/driver/test_apps/legacy_pcnt_driver: components/driver/test_apps/legacy_pcnt_driver:
disable: disable:
@@ -69,10 +65,6 @@ components/driver/test_apps/legacy_timer_driver:
components/driver/test_apps/mcpwm: components/driver/test_apps/mcpwm:
disable: disable:
- if: SOC_MCPWM_SUPPORTED != 1 - if: SOC_MCPWM_SUPPORTED != 1
disable_test:
- if: IDF_TARGET == "esp32c6"
temporary: true
reason: target esp32c6 is not supported yet
components/driver/test_apps/pulse_cnt: components/driver/test_apps/pulse_cnt:
disable: disable:

View File

@@ -7,6 +7,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32s3 @pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.generic @pytest.mark.generic
@pytest.mark.parametrize( @pytest.mark.parametrize(
'config', 'config',

View File

@@ -111,13 +111,14 @@ TEST_CASE("mcpwm_capture_ext_gpio", "[mcpwm]")
printf("simulate GPIO capture signal\r\n"); printf("simulate GPIO capture signal\r\n");
gpio_set_level(cap_gpio, 1); gpio_set_level(cap_gpio, 1);
vTaskDelay(pdMS_TO_TICKS(100)); vTaskDelay(pdMS_TO_TICKS(10));
gpio_set_level(cap_gpio, 0); gpio_set_level(cap_gpio, 0);
vTaskDelay(pdMS_TO_TICKS(100)); vTaskDelay(pdMS_TO_TICKS(10));
printf("capture value: Pos=%"PRIu32", Neg=%"PRIu32"\r\n", cap_value[0], cap_value[1]); printf("capture value: Pos=%"PRIu32", Neg=%"PRIu32"\r\n", cap_value[0], cap_value[1]);
uint32_t clk_src_res; uint32_t clk_src_res;
mcpwm_capture_timer_get_resolution(cap_timer, &clk_src_res); TEST_ESP_OK(mcpwm_capture_timer_get_resolution(cap_timer, &clk_src_res));
TEST_ASSERT_UINT_WITHIN(100000, clk_src_res / 10, cap_value[1] - cap_value[0]); clk_src_res /= 1000; // convert to kHz
TEST_ASSERT_UINT_WITHIN(1000, 10000, (cap_value[1] - cap_value[0]) * 1000 / clk_src_res);
printf("uninstall capture channel and timer\r\n"); printf("uninstall capture channel and timer\r\n");
TEST_ESP_OK(mcpwm_capture_channel_disable(pps_channel)); TEST_ESP_OK(mcpwm_capture_channel_disable(pps_channel));
@@ -184,8 +185,9 @@ TEST_CASE("mcpwm_capture_software_catch", "[mcpwm]")
uint32_t delta = test_callback_data.cap_data[1] - test_callback_data.cap_data[0]; uint32_t delta = test_callback_data.cap_data[1] - test_callback_data.cap_data[0];
esp_rom_printf("duration=%u ticks\r\n", delta); esp_rom_printf("duration=%u ticks\r\n", delta);
uint32_t clk_src_res; uint32_t clk_src_res;
mcpwm_capture_timer_get_resolution(cap_timer, &clk_src_res); TEST_ESP_OK(mcpwm_capture_timer_get_resolution(cap_timer, &clk_src_res));
TEST_ASSERT_UINT_WITHIN(80000, clk_src_res / 100, delta); clk_src_res /= 1000; // convert to kHz
TEST_ASSERT_UINT_WITHIN(1000, 10000, delta * 1000 / clk_src_res);
printf("uninstall capture channel and timer\r\n"); printf("uninstall capture channel and timer\r\n");
TEST_ESP_OK(mcpwm_capture_channel_disable(cap_channel)); TEST_ESP_OK(mcpwm_capture_channel_disable(cap_channel));

View File

@@ -79,9 +79,10 @@ TEST_CASE("mcpwm_capture_iram_safe", "[mcpwm]")
unity_utils_run_cache_disable_stub(test_simulate_input_post_cache_disable, (void *)cap_gpio); unity_utils_run_cache_disable_stub(test_simulate_input_post_cache_disable, (void *)cap_gpio);
printf("capture value: Pos=%"PRIu32", Neg=%"PRIu32"\r\n", cap_value[0], cap_value[1]); printf("capture value: Pos=%"PRIu32", Neg=%"PRIu32"\r\n", cap_value[0], cap_value[1]);
// Capture timer is clocked from APB by default uint32_t clk_src_res;
uint32_t clk_src_res = esp_clk_apb_freq(); TEST_ESP_OK(mcpwm_capture_timer_get_resolution(cap_timer, &clk_src_res));
TEST_ASSERT_UINT_WITHIN(2000, clk_src_res / 1000, cap_value[1] - cap_value[0]); clk_src_res /= 1000; // convert to kHz
TEST_ASSERT_UINT_WITHIN(100, 1000, (cap_value[1] - cap_value[0]) * 1000 / clk_src_res);
printf("uninstall capture channel and timer\r\n"); printf("uninstall capture channel and timer\r\n");
TEST_ESP_OK(mcpwm_capture_channel_disable(pps_channel)); TEST_ESP_OK(mcpwm_capture_channel_disable(pps_channel));

View File

@@ -7,6 +7,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.esp32s3 @pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.generic @pytest.mark.generic
@pytest.mark.parametrize( @pytest.mark.parametrize(
'config', 'config',