RMT output the same signal on multiple pins

djokba
Posts: 2
Joined: Tue Sep 15, 2020 10:18 am

RMT output the same signal on multiple pins

Postby djokba » Tue Sep 15, 2020 12:13 pm

Hi,

I am using RMT peripheral to generate an IR signal for various types of remote control protocols.

Currently, i am only using a single IR LED and i want to add an external IR transmitter on another pin for a wider signal coverage.

I want both of LEDs to produce the same signal simultaneosly, so the device will only receive the signal once. My code looks like this.

Code: Select all

int item_num = 0;
size_t size = sizeof(rmt_item32_t) * 300;
rmt_item32_t *item = (rmt_item32_t *)malloc(size);
memset((void *)item, 0, size);
item_num = rmt_build_items(item);
rmt_write_items(RMT_CHANNEL, item, item_num, true);
rmt_wait_tx_done(RMT_CHANNEL, portMAX_DELAY);
rmt_set_pin(RMT_CHANNEL, RMT_MODE_TX, EXT_LED_IO_NUM);
rmt_write_items(RMT_CHANNEL, item, item_num, true);
rmt_wait_tx_done(RMT_CHANNEL, portMAX_DELAY);
free(item);
The output is two identical signal where the second one is sent right after the first one is finished, and i think that makes sense. However this will make the device receive the same signal twice.
What is the best way to solve this issue? Or is there some other way to produce the signal on both pins at once?

Any help would be appreciated.
Thanks!

ESP_Sprite
Posts: 3937
Joined: Thu Nov 26, 2015 4:08 am

Re: RMT output the same signal on multiple pins

Postby ESP_Sprite » Wed Sep 16, 2020 8:14 am

The simple and stupid way would be to connect both transmitters to the same GPIO... the more elegant way to be simple and stupid would be to tweak the GPIO matrix so both transceiver GPIOs are connected to the same RMT output channel.

djokba
Posts: 2
Joined: Tue Sep 15, 2020 10:18 am

Re: RMT output the same signal on multiple pins

Postby djokba » Mon Sep 21, 2020 6:56 am

ESP_Sprite wrote:
Wed Sep 16, 2020 8:14 am
The simple and stupid way would be to connect both transmitters to the same GPIO... the more elegant way to be simple and stupid would be to tweak the GPIO matrix so both transceiver GPIOs are connected to the same RMT output channel.
Hi, thank you for your suggestions. So far i haven't found any documentation that explains how to tweak the GPIO matrix, except for gpio_matrix_out which i found in other related questions, but i'm not sure what it does and how to use it.
Could you show me an example how to use this API?

Thanks!

ESP_Sprite
Posts: 3937
Joined: Thu Nov 26, 2015 4:08 am

Re: RMT output the same signal on multiple pins

Postby ESP_Sprite » Tue Sep 22, 2020 9:29 am

You probably want to read the GPIO-related sections of the Technical Reference Manual for that.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 44 guests