Page 1 of 1

ESP32-WROOM-32E RMT Usage

Posted: Wed Sep 24, 2025 4:07 am
by yoyo50420
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(&copy_config, &copy_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:

IMG_1076.jpeg
IMG_1076.jpeg (8.5 KiB) Viewed 411 times
 
I am using ESP-IDF v5.3.1
Please help me with this.
Thanks a lots.

Re: ESP32-WROOM-32E RMT Usage

Posted: Wed Sep 24, 2025 9:19 am
by MicroController

Code: Select all

    rmt_transmit(tx_channels[0], copy_encoder, your_raw_rmt_symbols, sizeof (your_raw_rmt_symbols), &tx_config)
   
Seems like you want to transmit "items", not "your_raw_rmt_symbols", here.

Re: ESP32-WROOM-32E RMT Usage

Posted: Thu Sep 25, 2025 8:56 am
by yoyo50420

Code: Select all

    rmt_transmit(tx_channels[0], copy_encoder, your_raw_rmt_symbols, sizeof (your_raw_rmt_symbols), &tx_config)
   
Seems like you want to transmit "items", not "your_raw_rmt_symbols", here.
Thanks for reply.
It was the typo.
I am transmiting "items".
And the result remains the same.