如何修复 ESP32 rmt: rmt_transmit(476): channel not in enable state

如果在 rmt_transmit() 调用期间收到以下错误:

esp32_rmt_fix.txt
rmt: rmt_transmit(476): channel not in enable state

调用

rmt_enable_fix.cpp
ESP_ERROR_CHECK(rmt_enable(channel));

在调用 rmt_new_tx_channel() 之后。

完整初始化示例

rmt_full_init_example.cpp
rmt_channel_handle_t channel;
rmt_tx_channel_config_t tx_chan_config = {
    .gpio_num = GPIO_NUM_19,          // GPIO number
    .clk_src = RMT_CLK_SRC_DEFAULT,   // select source clock
    .resolution_hz = 1 * 1000 * 1000, // 1 MHz resolution
    .mem_block_symbols = 64,          // memory block size, 64 * 4 = 256 Bytes
    .trans_queue_depth = 1,           // set the number of transactions that can pend in the background
};
ESP_ERROR_CHECK(rmt_new_tx_channel(&tx_chan_config, &channel));
ESP_ERROR_CHECK(rmt_enable(channel));

Check out similar posts by category: ESP8266/ESP32