Problem creating 2 Tx channels on ESP32C3
Posted: Sun Oct 16, 2022 10:44 am
Hi Guys
I’m trying to build a twin channel pulse generator which uses the fancy RMT synchronise function. Apparently the ESP32 itself doesn’t possess the required synchronization hardware, but the ESP32C3 does.
My problem is that I cant even get the ESP32C3 to install two channels. The simple code below runs fine on the ESP32 but not on my Xiao seed studio ESP32C3. I’m using esp-idf-v5.0 here.
Any suggestions would be appreciated. Thank you
Here's the code that works fine on the ESP32 but not on the ESP32C3
The output on the ESP32 looks like this
Whereas the output on the ESP32C3 looks like this:
I'm pretty sure that the ESP32C3 does have two channels because it says so in the TRM (technical reference manual) What am I doing wrong?
I’m trying to build a twin channel pulse generator which uses the fancy RMT synchronise function. Apparently the ESP32 itself doesn’t possess the required synchronization hardware, but the ESP32C3 does.
My problem is that I cant even get the ESP32C3 to install two channels. The simple code below runs fine on the ESP32 but not on my Xiao seed studio ESP32C3. I’m using esp-idf-v5.0 here.
Any suggestions would be appreciated. Thank you
Here's the code that works fine on the ESP32 but not on the ESP32C3
Code: Select all
#include "driver/rmt_tx.h"
#include "esp_log.h"
#define RMT_RESOLUTION 1 * 1000 * 1000 /* 1MHz, ie 1 tick = 1 microsecond */
int tx_gpio_number[2] = {9,10};
static const char *TAG = "Test Pulse Generator";
void app_main(void)
{
ESP_LOGI(TAG, "Create RMT TX channel");
rmt_channel_handle_t tx_channels[2] = {NULL}; // declare two channels
// install channels one by one
for (int i = 0; i < 2; i++) {
rmt_tx_channel_config_t tx_chan_config = {
.clk_src = RMT_CLK_SRC_DEFAULT,
.gpio_num = tx_gpio_number[i],
.mem_block_symbols = 64,
.resolution_hz = RMT_RESOLUTION,
.trans_queue_depth = 1,
};
ESP_ERROR_CHECK(rmt_new_tx_channel(&tx_chan_config, &tx_channels[i]));
}
}
Code: Select all
I (309) Test Pulse Generator: Create RMT TX channel
I (319) gpio: GPIO[9]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (329) gpio: GPIO[10]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
Code: Select all
I (251) Test Pulse Generator: Create RMT TX channel
I (251) gpio: GPIO[9]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
E (261) rmt: rmt_tx_register_to_group(131): no free tx channels
E (271) rmt: rmt_new_tx_channel(231): register channel failed
ESP_ERROR_CHECK failed: esp_err_t 0x105 (ESP_ERR_NOT_FOUND) at 0x42006b3c
0x42006b3c: app_main at C:/Users/Patrick/Documents/my_projects/pulse_sequence_testing/main/twinChannels.c:23 (discriminator 1)