kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/fix_the_crash_of_ana_cmpr_etm_example' into 'master'
fix(ana_cmpr): fix the crash of the etm example See merge request espressif/esp-idf!29469pull/13338/head
commit
0766d73e5e
|
@ -20,10 +20,6 @@ examples/peripherals/adc/oneshot_read:
|
||||||
examples/peripherals/analog_comparator:
|
examples/peripherals/analog_comparator:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_ANA_CMPR_SUPPORTED != 1
|
- if: SOC_ANA_CMPR_SUPPORTED != 1
|
||||||
disable_test:
|
|
||||||
- if: IDF_TARGET == "esp32p4"
|
|
||||||
temporary: true
|
|
||||||
reason: not supported yet
|
|
||||||
depends_components:
|
depends_components:
|
||||||
- esp_driver_gpio
|
- esp_driver_gpio
|
||||||
- esp_driver_ana_cmpr
|
- esp_driver_ana_cmpr
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
|
@ -30,17 +30,13 @@ static void example_etm_bind_ana_cmpr_event_with_gpio_task(ana_cmpr_handle_t cmp
|
||||||
ESP_ERROR_CHECK(ana_cmpr_new_etm_event(cmpr, &evt_cfg, &cmpr_neg_evt));
|
ESP_ERROR_CHECK(ana_cmpr_new_etm_event(cmpr, &evt_cfg, &cmpr_neg_evt));
|
||||||
|
|
||||||
/* Allocate the GPIO set & clear tasks */
|
/* Allocate the GPIO set & clear tasks */
|
||||||
esp_etm_task_handle_t gpio_pos_task = NULL;
|
esp_etm_task_handle_t gpio_toggle_task = NULL;
|
||||||
esp_etm_task_handle_t gpio_neg_task = NULL;
|
|
||||||
gpio_etm_task_config_t task_cfg = {
|
gpio_etm_task_config_t task_cfg = {
|
||||||
.action = GPIO_ETM_TASK_ACTION_SET,
|
.action = GPIO_ETM_TASK_ACTION_TOG,
|
||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(gpio_new_etm_task(&task_cfg, &gpio_pos_task));
|
ESP_ERROR_CHECK(gpio_new_etm_task(&task_cfg, &gpio_toggle_task));
|
||||||
task_cfg.action = GPIO_ETM_TASK_ACTION_CLR;
|
|
||||||
ESP_ERROR_CHECK(gpio_new_etm_task(&task_cfg, &gpio_neg_task));
|
|
||||||
/* Add task to the monitor GPIO */
|
/* Add task to the monitor GPIO */
|
||||||
ESP_ERROR_CHECK(gpio_etm_task_add_gpio(gpio_pos_task, EXAMPLE_MONITOR_GPIO_NUM));
|
ESP_ERROR_CHECK(gpio_etm_task_add_gpio(gpio_toggle_task, EXAMPLE_MONITOR_GPIO_NUM));
|
||||||
ESP_ERROR_CHECK(gpio_etm_task_add_gpio(gpio_neg_task, EXAMPLE_MONITOR_GPIO_NUM));
|
|
||||||
|
|
||||||
/* Allocate the Event Task Matrix channels */
|
/* Allocate the Event Task Matrix channels */
|
||||||
esp_etm_channel_handle_t etm_pos_handle;
|
esp_etm_channel_handle_t etm_pos_handle;
|
||||||
|
@ -49,8 +45,8 @@ static void example_etm_bind_ana_cmpr_event_with_gpio_task(ana_cmpr_handle_t cmp
|
||||||
ESP_ERROR_CHECK(esp_etm_new_channel(&etm_cfg, &etm_pos_handle));
|
ESP_ERROR_CHECK(esp_etm_new_channel(&etm_cfg, &etm_pos_handle));
|
||||||
ESP_ERROR_CHECK(esp_etm_new_channel(&etm_cfg, &etm_neg_handle));
|
ESP_ERROR_CHECK(esp_etm_new_channel(&etm_cfg, &etm_neg_handle));
|
||||||
/* Bind the events and tasks */
|
/* Bind the events and tasks */
|
||||||
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_pos_handle, cmpr_pos_evt, gpio_pos_task));
|
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_pos_handle, cmpr_pos_evt, gpio_toggle_task));
|
||||||
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_neg_handle, cmpr_neg_evt, gpio_neg_task));
|
ESP_ERROR_CHECK(esp_etm_channel_connect(etm_neg_handle, cmpr_neg_evt, gpio_toggle_task));
|
||||||
/* Enable the ETM channels */
|
/* Enable the ETM channels */
|
||||||
ESP_ERROR_CHECK(esp_etm_channel_enable(etm_pos_handle));
|
ESP_ERROR_CHECK(esp_etm_channel_enable(etm_pos_handle));
|
||||||
ESP_ERROR_CHECK(esp_etm_channel_enable(etm_neg_handle));
|
ESP_ERROR_CHECK(esp_etm_channel_enable(etm_neg_handle));
|
||||||
|
|
|
@ -18,7 +18,11 @@ extern "C" {
|
||||||
#define EXAMPLE_WAIT_TIME_PROP (0.1) // The wait time proportion in one relative signal period
|
#define EXAMPLE_WAIT_TIME_PROP (0.1) // The wait time proportion in one relative signal period
|
||||||
#define EXAMPLE_WAITE_TIME_US(freq_approx) (uint32_t)(1000000 * EXAMPLE_WAIT_TIME_PROP / (freq_approx))
|
#define EXAMPLE_WAITE_TIME_US(freq_approx) (uint32_t)(1000000 * EXAMPLE_WAIT_TIME_PROP / (freq_approx))
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32P4
|
||||||
|
#define EXAMPLE_MONITOR_GPIO_NUM (32) // The gpio to monitor the on cross callback
|
||||||
|
#else
|
||||||
#define EXAMPLE_MONITOR_GPIO_NUM (0) // The gpio to monitor the on cross callback
|
#define EXAMPLE_MONITOR_GPIO_NUM (0) // The gpio to monitor the on cross callback
|
||||||
|
#endif
|
||||||
|
|
||||||
void example_init_monitor_gpio(void);
|
void example_init_monitor_gpio(void);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pytest_embedded import Dut
|
from pytest_embedded import Dut
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.esp32h2
|
@pytest.mark.esp32h2
|
||||||
|
@pytest.mark.esp32p4
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'config',
|
'config',
|
||||||
|
@ -17,7 +17,7 @@ from pytest_embedded import Dut
|
||||||
)
|
)
|
||||||
def test_ana_cmpr_example(dut: Dut) -> None:
|
def test_ana_cmpr_example(dut: Dut) -> None:
|
||||||
sdkconfig = dut.app.sdkconfig
|
sdkconfig = dut.app.sdkconfig
|
||||||
dut.expect('ana_cmpr_example: Analog Comparator source gpio 11, external reference gpio 10', timeout=10)
|
dut.expect(r'ana_cmpr_example: Analog Comparator source gpio ([0-9]+), external reference gpio ([0-9]+)', timeout=10)
|
||||||
if sdkconfig['EXAMPLE_INTERNAL_REF']:
|
if sdkconfig['EXAMPLE_INTERNAL_REF']:
|
||||||
dut.expect('ana_cmpr_example: Allocate Analog Comparator with internal reference', timeout=10)
|
dut.expect('ana_cmpr_example: Allocate Analog Comparator with internal reference', timeout=10)
|
||||||
dut.expect(r'ana_cmpr_example: Analog comparator enabled, reference voltage: [0-9]+% \* VDD', timeout=10)
|
dut.expect(r'ana_cmpr_example: Analog comparator enabled, reference voltage: [0-9]+% \* VDD', timeout=10)
|
||||||
|
|
Ładowanie…
Reference in New Issue