From 4a95c3b225f7b090536f3416e4b8b83c7dbcb3fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20H=C3=B6pfinger?= Date: Mon, 27 Nov 2023 09:43:21 +0100 Subject: [PATCH 1/2] Update RMT initialization code - Commented out setting interrupt priority for both TX and RX configurations in the RMT initialization code. --- cores/esp32/esp32-hal-rmt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/esp32/esp32-hal-rmt.c b/cores/esp32/esp32-hal-rmt.c index 83409bb4c9e..66610135982 100644 --- a/cores/esp32/esp32-hal-rmt.c +++ b/cores/esp32/esp32-hal-rmt.c @@ -513,7 +513,7 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ tx_cfg.flags.with_dma = 0; tx_cfg.flags.io_loop_back = 0; tx_cfg.flags.io_od_mode = 0; - tx_cfg.intr_priority = 0; + //tx_cfg.intr_priority = 0; if (rmt_new_tx_channel(&tx_cfg, &bus->rmt_channel_h) != ESP_OK) { log_e("GPIO %d - RMT TX Initialization error.", pin); @@ -538,7 +538,7 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ rx_cfg.flags.invert_in = 0; rx_cfg.flags.with_dma = 0; rx_cfg.flags.io_loop_back = 0; - rx_cfg.intr_priority = 0; + //rx_cfg.intr_priority = 0; // try to allocate the RMT Channel if (ESP_OK != rmt_new_rx_channel(&rx_cfg, &bus->rmt_channel_h)) { log_e("GPIO %d RMT - RX Initialization error.", pin); From 0699db0a00b47ae09e42a41bf780d6257396eb97 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Mon, 27 Nov 2023 11:52:33 -0300 Subject: [PATCH 2/2] checks IDF version within RMT interrupt priority --- cores/esp32/esp32-hal-rmt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cores/esp32/esp32-hal-rmt.c b/cores/esp32/esp32-hal-rmt.c index 66610135982..4d19d52638d 100644 --- a/cores/esp32/esp32-hal-rmt.c +++ b/cores/esp32/esp32-hal-rmt.c @@ -23,6 +23,7 @@ #include "esp32-hal-rmt.h" #include "esp32-hal-periman.h" +#include "esp_idf_version.h" // Arduino Task Handle indicates if the Arduino Task has been started already extern TaskHandle_t loopTaskHandle; @@ -513,7 +514,9 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ tx_cfg.flags.with_dma = 0; tx_cfg.flags.io_loop_back = 0; tx_cfg.flags.io_od_mode = 0; - //tx_cfg.intr_priority = 0; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 2) + tx_cfg.intr_priority = 0; +#endif if (rmt_new_tx_channel(&tx_cfg, &bus->rmt_channel_h) != ESP_OK) { log_e("GPIO %d - RMT TX Initialization error.", pin); @@ -538,7 +541,9 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ rx_cfg.flags.invert_in = 0; rx_cfg.flags.with_dma = 0; rx_cfg.flags.io_loop_back = 0; - //rx_cfg.intr_priority = 0; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 2) + rx_cfg.intr_priority = 0; +#endif // try to allocate the RMT Channel if (ESP_OK != rmt_new_rx_channel(&rx_cfg, &bus->rmt_channel_h)) { log_e("GPIO %d RMT - RX Initialization error.", pin);