esp-idf: Invalid I2S initialization parameters break the UART or RMT driver.
A bit of background. I have a project that is already debugged and worked fine on both ESP32-S2 and ESP32-WROVER. There was a long break from work on the project. After I got to work again, there were several updates to the esp-idf framework. I installed the updates and worked with the firmware for the ESP32-S2 for a while. There were no problems and I am not aware of which version of the esp-idf framework the problem appeared, which I will describe below. As recently as yesterday I decided to compile the firmware for the ESP32-WROVER and test it. The firmware was compiled and flashed normally. But after running ESP32-WROVER, I got the chip freeze. After a long search for the problem of ESP32-WROVER freezing at the start of the program, I found out the following: If you call uart_driver_install() first and then rmt_driver_install(), ESP32-WROVER halt. Here is the log:
ESP_ERROR_CHECK failed: esp_err_t 0x105 (ESP_ERR_NOT_FOUND) at 0x4008db34
file: "main\ir_remote.c" line 48
func: nec_rx_init
expression: rmt_driver_install(receiver_tx_channel, 1000, 0)
abort() was called at PC 0x4008db37 on core 0
Backtrace:0x4008fb2e:0x3ffc11e0 0x40090131:0x3ffc1200 0x40097b8e:0x3ffc1220 0x4008db37:0x3ffc1290 0x400d914f:0x3ffc12b0 0x400db9a3:0x3ffc1310 0x400935f5:0x3ffc1360
#0 0x4008fb2e:0x3ffc11e0 in panic_abort at C:\Users\Alexander\.platformio\packages\framework-espidf\components\esp_system/panic.c:356
#1 0x40090131:0x3ffc1200 in esp_system_abort at C:\Users\Alexander\.platformio\packages\framework-espidf\components\esp_system/system_api.c:112
#2 0x40097b8e:0x3ffc1220 in abort at C:\Users\Alexander\.platformio\packages\framework-espidf\components\newlib/abort.c:46
#3 0x4008db37:0x3ffc1290 in _esp_error_check_failed at C:\Users\Alexander\.platformio\packages\framework-espidf\components\esp_common\src/esp_err.c:42
#4 0x400d914f:0x3ffc12b0 in nec_rx_init at main/ir_remote.c:48 (discriminator 1)
#5 0x400db9a3:0x3ffc1310 in task_addon at main/services.c:1100
#6 0x400935f5:0x3ffc1360 in vPortTaskWrapper at C:\Users\Alexander\.platformio\packages\framework-espidf\components\freertos\port\xtensa/port.c:168
ELF file SHA256: 9d562f411fcf7474
CPU halted.
Snippet of code:
bool nec_rx_init()
{
gpio_num_t ir;
gpio_get_ir_signal(&ir);
if (ir == GPIO_NONE)
return false; //no IR needed
rmt_config_t rmt_rx_config = RMT_DEFAULT_CONFIG_RX(ir, receiver_tx_channel);
esp_err_t err = rmt_config(&rmt_rx_config);
// err |= rmt_driver_install(receiver_tx_channel, 1000, 0);
// The production line above is commented out, the following line is added to reproduce the crash
ESP_ERROR_CHECK(rmt_driver_install(receiver_tx_channel, 1000, 0)); // The crash happen here
ir_parser_config_t ir_parser_config = IR_PARSER_DEFAULT_CONFIG((ir_dev_t)receiver_tx_channel);
ir_parser_config.flags |= IR_TOOLS_FLAGS_PROTO_EXT; // Using extended IR protocols (both NEC and RC5 have extended version)
if (err != ESP_OK)
{
ESP_LOGE(TAG, "Rmt driver install failed: %x", err);
return false;
}
if (MainConfig->flags & IR_NEC_ON)
ir_parser = ir_parser_rmt_new_nec(&ir_parser_config);
else
ir_parser = ir_parser_rmt_new_rc5(&ir_parser_config);
return true;
}
If rmt_driver_install() is called first, then a subsequent call to uart_driver_install() will hang with a similar error. Please help me figure out the situation.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (2 by maintainers)
Commits related to this issue
- docs(system): add a section on interrupt allocation debugging Related to https://github.com/espressif/esp-idf/issues/6709 Related to https://github.com/espressif/esp-idf/issues/7767 Related to https:... — committed to espressif/esp-idf by igrr a year ago
- docs(system): add a section on interrupt allocation debugging Related to https://github.com/espressif/esp-idf/issues/6709 Related to https://github.com/espressif/esp-idf/issues/7767 Related to https:... — committed to ilutchenko/esp-idf by igrr a year ago
- docs(system): add a section on interrupt allocation debugging Related to https://github.com/espressif/esp-idf/issues/6709 Related to https://github.com/espressif/esp-idf/issues/7767 Related to https:... — committed to ilutchenko/esp-idf by igrr a year ago
I did have another try with the snippet you gave, still no crash 😅 Here is the log:
Try installing one or more of the drivers on the other core, you ran out of interrupts on one core or set ESP_INTR_FLAG_SHARED