reset rmt configuration for GPIO

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

reset rmt configuration for GPIO

Postby jumjum123 » Mon Mar 06, 2017 3:54 pm

In my application, first a pulse is sent to GPIO21 using driver/rmt.
Next a task delay, and after that GPIO21 should start blinking in a simple loop.

This is not working, looks like rmt blocks other usage of GPIO21.
How could I reset this "blocking" ?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: reset rmt configuration for GPIO

Postby kolban » Mon Mar 06, 2017 4:31 pm

If we assume that an RMT channel is "using" a given pin then it makes sense that the pin can't be used for other functions. Our goal then is to either "stop" RMT or tell RMT to use a different pin. The first might be done with a call to rmt_driver_uninstall() while the later might be done with rmt_set_pin(). I personally haven't tried this in the past. In all my projects once I have chosen a pin to be used for RMT it remains used by RMT.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

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

Re: reset rmt configuration for GPIO

Postby ESP_Sprite » Tue Mar 07, 2017 1:48 am

You need to re-mux your pin to use GPIO. Use gpio_matrix_out with SIG_GPIO_OUT_IDX as the signal to reset the pin to GPIO mode.

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: reset rmt configuration for GPIO

Postby jumjum123 » Tue Mar 07, 2017 11:15 am

@ESP_Sprite, thanks for your helpful answer.
@kolban, I prefer to use a pin with a function which matches my needs in this moment.
Imagine, you have to send a short impulse (0.1msec) and later on you have to send a long impulse (200 msec).
As far as I know, based on your book, its not possible to create both with rmt.
(80 Mhz / divider(255 max) / duration (32786 max)) so maximum for pulse is 104msec.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: reset rmt configuration for GPIO

Postby WiFive » Tue Mar 07, 2017 1:21 pm

Couldn't you use multiple high periods together to make a long pulse?

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: reset rmt configuration for GPIO

Postby jumjum123 » Tue Mar 07, 2017 2:08 pm

@wifive, in our application (Espruino, javascript) we already support setTimeout and setInterval.
There is no limit in duration. To create long duration up to hours with connected high level pulses would be overdesigned for that.

Anyway due to help from ESP_Sprite this problem is solved now.
General thoughts, on one hand we have the option to assign pins to functions like rmt, SPI, Uart etc.
On the other hands, we work with functions not that much with pins anymore.
Therefore some "housekeeping" is helpful.

BTW, one question comes to my mind, is there any way to read the mapping ?

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

Re: reset rmt configuration for GPIO

Postby ESP_Sprite » Wed Mar 08, 2017 1:51 am

In theory, yes: the mapping isn't more than a set of bits in registers; it's even described in the TRM if I'm not mistaken. In practice, however, I don't think we have a pre-made C function for that.

Who is online

Users browsing this forum: jsmith56x and 275 guests