Page 1 of 1

reset rmt configuration for GPIO

Posted: Mon Mar 06, 2017 3:54 pm
by jumjum123
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" ?

Re: reset rmt configuration for GPIO

Posted: Mon Mar 06, 2017 4:31 pm
by kolban
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.

Re: reset rmt configuration for GPIO

Posted: Tue Mar 07, 2017 1:48 am
by ESP_Sprite
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.

Re: reset rmt configuration for GPIO

Posted: Tue Mar 07, 2017 11:15 am
by jumjum123
@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.

Re: reset rmt configuration for GPIO

Posted: Tue Mar 07, 2017 1:21 pm
by WiFive
Couldn't you use multiple high periods together to make a long pulse?

Re: reset rmt configuration for GPIO

Posted: Tue Mar 07, 2017 2:08 pm
by jumjum123
@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 ?

Re: reset rmt configuration for GPIO

Posted: Wed Mar 08, 2017 1:51 am
by ESP_Sprite
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.