Hi
I am trying to use RMT to generate signal.
Below is my code:
void RMT1 () {
rmt_channel_handle_t tx_channels[2] = {NULL};
int tx_gpio_number[2] = {4, 4};
rmt_copy_encoder_config_t copy_config = {};
rmt_encoder_handle_t copy_encoder = NULL;
ESP_ERROR_CHECK(rmt_new_copy_encoder(©_config, ©_encoder));
for (int i = 0; i < 1; i++) {
rmt_tx_channel_config_t tx_chan_config = {
.clk_src = RMT_CLK_SRC_DEFAULT,
.gpio_num = tx_gpio_number,
.mem_block_symbols = 64,
.resolution_hz = 1 * 1000 * 1000,
.trans_queue_depth = 1,
};
ESP_ERROR_CHECK(rmt_new_tx_channel(&tx_chan_config, &tx_channels));
}
for (int i = 0; i < 1; i++) {
ESP_ERROR_CHECK(rmt_enable(tx_channels));
}
rmt_symbol_word_t your_raw_rmt_symbols[] = {
{.duration0 = 1, .level0 = 1, .duration1 = 1, .level1 = 0},
// ... more symbols
};
rmt_symbol_word_t items[10];
for (int i = 0; i < 10; i++) {
items.level0 = 1;
items.duration0 = 1;
items.level1 = 0;
items.duration1 = 1;
}
rmt_transmit_config_t tx_config ={};
ESP_ERROR_CHECK(rmt_transmit(tx_channels[0], copy_encoder, items , sizeof (items), &tx_config));
}
I expect to have signal high for 1us , low for 1us and repeat 10 times.
But what i got is as below:
I am using ESP-IDF v5.3.1
Please help me with this.
Thanks a lots.
ESP32-WROOM-32E RMT Usage
ESP32-WROOM-32E RMT Usage
Last edited by yoyo50420 on Thu Sep 25, 2025 8:59 am, edited 1 time in total.
-
MicroController
- Posts: 2663
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: ESP32-WROOM-32E RMT Usage
Seems like you want to transmit "items", not "your_raw_rmt_symbols", here.Code: Select all
rmt_transmit(tx_channels[0], copy_encoder, your_raw_rmt_symbols, sizeof (your_raw_rmt_symbols), &tx_config)
Re: ESP32-WROOM-32E RMT Usage
Thanks for reply.Seems like you want to transmit "items", not "your_raw_rmt_symbols", here.Code: Select all
rmt_transmit(tx_channels[0], copy_encoder, your_raw_rmt_symbols, sizeof (your_raw_rmt_symbols), &tx_config)
It was the typo.
I am transmiting "items".
And the result remains the same.
Who is online
Users browsing this forum: Baidu [Spider], PerplexityBot and 6 guests