mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/fix_rmt_err_interrupt_crash_bug' into 'master'
Bugfix(rmt): Fix the rmt err interrupt crash bug See merge request espressif/esp-idf!7282
This commit is contained in:
commit
e40c9684dc
@ -387,7 +387,6 @@ esp_err_t rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en, uint16_t evt_th
|
|||||||
RMT_CHECK(evt_thresh <= 256, "RMT EVT THRESH ERR", ESP_ERR_INVALID_ARG);
|
RMT_CHECK(evt_thresh <= 256, "RMT EVT THRESH ERR", ESP_ERR_INVALID_ARG);
|
||||||
RMT_ENTER_CRITICAL();
|
RMT_ENTER_CRITICAL();
|
||||||
rmt_ll_set_tx_limit(p_rmt_obj[channel]->hal.regs, channel, evt_thresh);
|
rmt_ll_set_tx_limit(p_rmt_obj[channel]->hal.regs, channel, evt_thresh);
|
||||||
rmt_ll_enable_tx_pingpong(p_rmt_obj[channel]->hal.regs, true);
|
|
||||||
rmt_ll_enable_tx_thres_interrupt(p_rmt_obj[channel]->hal.regs, channel, true);
|
rmt_ll_enable_tx_thres_interrupt(p_rmt_obj[channel]->hal.regs, channel, true);
|
||||||
RMT_EXIT_CRITICAL();
|
RMT_EXIT_CRITICAL();
|
||||||
} else {
|
} else {
|
||||||
@ -454,6 +453,7 @@ static esp_err_t rmt_internal_config(rmt_dev_t *dev, const rmt_config_t *rmt_par
|
|||||||
|
|
||||||
RMT_ENTER_CRITICAL();
|
RMT_ENTER_CRITICAL();
|
||||||
rmt_ll_enable_tx_cyclic(dev, channel, rmt_param->tx_config.loop_en);
|
rmt_ll_enable_tx_cyclic(dev, channel, rmt_param->tx_config.loop_en);
|
||||||
|
rmt_ll_enable_tx_pingpong(dev, true);
|
||||||
/*Set idle level */
|
/*Set idle level */
|
||||||
rmt_ll_enable_tx_idle(dev, channel, rmt_param->tx_config.idle_output_en);
|
rmt_ll_enable_tx_idle(dev, channel, rmt_param->tx_config.idle_output_en);
|
||||||
rmt_ll_set_tx_idle_level(dev, channel, idle_level);
|
rmt_ll_set_tx_idle_level(dev, channel, idle_level);
|
||||||
@ -675,6 +675,9 @@ static void IRAM_ATTR rmt_driver_isr_default(void *arg)
|
|||||||
status &= ~(1 << channel);
|
status &= ~(1 << channel);
|
||||||
rmt_obj_t *p_rmt = p_rmt_obj[channel];
|
rmt_obj_t *p_rmt = p_rmt_obj[channel];
|
||||||
if (p_rmt) {
|
if (p_rmt) {
|
||||||
|
// Reset the receiver/transmitter's write/read addresses to prevent endless err interrupts.
|
||||||
|
rmt_ll_reset_tx_pointer(p_rmt_obj[channel]->hal.regs, channel);
|
||||||
|
rmt_ll_reset_rx_pointer(p_rmt_obj[channel]->hal.regs, channel);
|
||||||
ESP_EARLY_LOGD(RMT_TAG, "RMT[%d] ERR", channel);
|
ESP_EARLY_LOGD(RMT_TAG, "RMT[%d] ERR", channel);
|
||||||
ESP_EARLY_LOGD(RMT_TAG, "status: 0x%08x", rmt_ll_get_channel_status(p_rmt_obj[channel]->hal.regs, channel));
|
ESP_EARLY_LOGD(RMT_TAG, "status: 0x%08x", rmt_ll_get_channel_status(p_rmt_obj[channel]->hal.regs, channel));
|
||||||
}
|
}
|
||||||
|
@ -311,6 +311,21 @@ static void rx_init(void)
|
|||||||
rmt_driver_install(rmt_rx.channel, (sizeof(rmt_item32_t) * DATA_ITEM_NUM * (RMT_TX_DATA_NUM + 6)), 0);
|
rmt_driver_install(rmt_rx.channel, (sizeof(rmt_item32_t) * DATA_ITEM_NUM * (RMT_TX_DATA_NUM + 6)), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//A sample case to test if sending 63 data will cause crash in error interrupt.
|
||||||
|
TEST_CASE("RMT tx test", "[rmt][test_env=UT_T1_RMT]")
|
||||||
|
{
|
||||||
|
tx_init();
|
||||||
|
rmt_item32_t *items = (rmt_item32_t*)malloc(sizeof(rmt_item32_t) * 63);
|
||||||
|
for(int i = 0; i < 63; i++) {
|
||||||
|
items[i] = (rmt_item32_t){{{200, 1, 200, 0}}};
|
||||||
|
}
|
||||||
|
TEST_ESP_OK(rmt_write_items(RMT_TX_CHANNEL, items,
|
||||||
|
63, /* Number of items */
|
||||||
|
1 /* wait till done */));
|
||||||
|
TEST_ESP_OK(rmt_driver_uninstall(RMT_TX_CHANNEL));
|
||||||
|
free(items);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("RMT init config", "[rmt][test_env=UT_T1_RMT]")
|
TEST_CASE("RMT init config", "[rmt][test_env=UT_T1_RMT]")
|
||||||
{
|
{
|
||||||
// tx settings
|
// tx settings
|
||||||
|
Loading…
Reference in New Issue
Block a user