[Solved] Using the RMT peripheral ...

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

[Solved] Using the RMT peripheral ...

Postby kolban » Tue Oct 04, 2016 1:57 pm

In a separate thread there was an excellent suggestion for using the "RMT peripheral" for part of a project (driving WS2811/WS2812/NeoPixels). See:

http://esp32.com/viewtopic.php?f=13&t=293

The ESP32 Technical Reference Manual covers some good stuff on the registers at the lowest level. There is also a story on an example (which sadly I have yet to find). Has anyone any experience working with this component of the device or know where to find any samples? Is there a plan for higher level driver libraries in the future?
Last edited by kolban on Tue Nov 22, 2016 4:04 am, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

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

Re: Using the RMT peripheral ...

Postby WiFive » Tue Oct 04, 2016 7:17 pm

kolban wrote: Has anyone any experience working with this component of the device or know where to find any samples? Is there a plan for higher level driver libraries in the future?
I'm sure examples for all peripherals are coming soon. The led example was just added before the holiday.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Using the RMT peripheral ...

Postby ESP_Angus » Wed Oct 05, 2016 2:53 am

There is a plan for high level drivers for all peripherals. They'll continue appearing in esp-idf regularly until we have them all.

I think Sprite was mistaken when he mentioned RMT examples. There will be an example, but as far as I know there isn't one at the moment. Similarly, the RMT hardware is not documented in the technical reference yet but it will be.

There are register headers in esp-idf here and here, but probably easiest to wait until more is available. Sorry!

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Using the RMT peripheral ...

Postby ESP_igrr » Wed Oct 05, 2016 5:50 am

ESP_Angus wrote:Similarly, the RMT hardware is not documented in the technical reference yet but it will be.
I'm pretty sure it is present in the latest version of TRM, chapter 7...
https://espressif.com/sites/default/fil ... ual_en.pdf

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Using the RMT peripheral ...

Postby ESP_Angus » Wed Oct 05, 2016 8:59 pm

Oops, thanks Ivan.

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

Re: Using the RMT peripheral ...

Postby kolban » Fri Oct 14, 2016 4:32 am

I had a look around but couldn't find a sample. So I studied the ESP32 Technical Reference and believed that I had a basic understanding to run some tests ... but then it dawned on me that as I looked at the IO MUX table I couldn't see any functions mapped to physical pins that related to RMT channels 0-7.

My plan was to write a simple 8 bit square wave to RMT channel 0 and then attach a logic analyzer and see what it produced. I wrote the app and then sat back scratching my head as I couldn't figure out which physical pins of the ESP32 DevKitC to attach the input to the analyzer.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

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

Re: Using the RMT peripheral ...

Postby WiFive » Fri Oct 14, 2016 5:32 am

Check gpio matrix for rmt_sig signals

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

Re: Using the RMT peripheral ...

Postby kolban » Fri Oct 14, 2016 3:11 pm

Thanks Mr WiFive ... appreciate the response. I'm afraid I don't understand the relationship between "signals" and IO multiplexing and physical pins. Do you have any guidance on how one might go about learning how to use the knowledge of "signals" with respect to configuring physical pins for a function?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

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

Re: Using the RMT peripheral ...

Postby WiFive » Fri Oct 14, 2016 8:20 pm

Check ledc.c example:

Code: Select all

    /*set LEDC signal in gpio matrix*/
    PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO);
    gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT);
    gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0);
Also see gpio.h:

Code: Select all

*----EXAMPLE OF I2C CONFIG AND PICK SIGNAL FOR IO MATRIX---*/
/*     gpio_config_t io_conf;
 *     io_conf.intr_type = GPIO_INTR_DISABLE;                 //disable interrupt
 *     io_conf.mode = GPIO_MODE_INPUT_OUTPUT_OD;              //set as output mode
 *     io_conf.pin_bit_mask = GPIO_SEL_21 | GPIO_SEL_22;      //bit mask of the pins that you want to set,e.g.GPIO21/22
 *     io_conf.pull_down_en = 0;                              //disable pull-down mode
 *     io_conf.pull_up_en = 1;                                //enable pull-up mode
 *     gpio_config(&io_conf);                                 //configure GPIO with the given settings
 *     gpio_matrix_out(21, EXT_I2C_SCL_O_IDX, 0,  0);         //set output signal for io_matrix
 *     gpio_matrix_out(22, EXT_I2C_SDA_O_IDX, 0,  0);         //set output signal for io_matrix
 *     gpio_matrix_in( 22, EXT_I2C_SDA_I_IDX, 0);             //set input signal for io_matrix

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

Re: Using the RMT peripheral ...

Postby kolban » Sat Oct 15, 2016 4:03 pm

I had a go at trying the following logic:

Code: Select all

void testRMT() {
	printf("Setting RMT to IO17\n");
	int gpioNum = 17;

	gpio_set_direction(gpioNum, GPIO_MODE_OUTPUT);
	gpio_matrix_out(gpioNum, RMT_SIG_OUT0_IDX, 0, 0);
	//PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpioNum], PIN_FUNC_GPIO);
	gpio_pad_select_gpio(gpioNum);
	printf("About to test RMT\n");
	RMTMEM.chan[0].data[0].level0 = 1;
	RMTMEM.chan[0].data[0].duration0 = 100;
	RMTMEM.chan[0].data[0].level1 = 0;
	RMTMEM.chan[0].data[0].duration1 = 100;
	RMTMEM.chan[0].data[1].level0 = 1;
	RMTMEM.chan[0].data[1].duration0 = 100;
	RMTMEM.chan[0].data[1].level1 = 0;
	RMTMEM.chan[0].data[1].duration1 = 100;
	RMTMEM.chan[0].data[2].level0 = 1;
	RMTMEM.chan[0].data[2].duration0 = 0;
	RMTMEM.chan[0].data[2].level1 = 0;
	RMTMEM.chan[0].data[2].duration1 = 0;
	RMT.conf_ch[0].conf1.mem_owner = 0;
	RMT.conf_ch[0].conf1.tx_start = 1;
	printf("Done!");
}
using a logic analyzer, I saw the output GPIO go high and stay high for 0.49 seconds and then go low ... but no matter how I tweaked or twiddled with values, that signal remained the only output. I'll continue to experiment ... but I think I'm getting lost ...
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: Bing [Bot] and 254 guests