Skip to content

Commit

Permalink
Initial version of rmt driver (#1525)
Browse files Browse the repository at this point in the history
* rmt driver initial version

* supporting conti mode plus interrupts

* using conitnous mode for sending more data

* working continous mode

* rmt driver cleanup after conti mode

* initial version of rmt driver

* adding a simple example

* adding channel and block locks

* modified of rmt interface for simpler/easier usage

* adding header sentinels, split interface to common and additional settings

* Fixes per code review + support for rx callback mode

* renamed internal structures and enums, fixed formatting

* cmake support for rmt

* refactored tx-conti interrupts to function to make it more readable

* added Tx and Rx examples

* added license headers

* minor updates per review

* used struct access, renamed defines, corrected diagram
  • Loading branch information
david-cermak authored and me-no-dev committed Sep 17, 2018
1 parent ea61563 commit 4e96bff
Show file tree
Hide file tree
Showing 7 changed files with 1,314 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(CORE_SRCS
cores/esp32/esp32-hal-timer.c
cores/esp32/esp32-hal-touch.c
cores/esp32/esp32-hal-uart.c
cores/esp32/esp32-hal-rmt.c
cores/esp32/Esp.cpp
cores/esp32/FunctionalInterrupt.cpp
cores/esp32/HardwareSerial.cpp
Expand Down
Loading

5 comments on commit 4e96bff

@VerusLogic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello - I must be lucky because I just started a project where this example would come in very handy. Only thing, I see that it is quite new. When I updated to version rc4, none of the rmt files were copied over. The "esp32-hal.h" file is missing the line #include "esp32-hal-rmt.h" and the "esp32-hal-rmt.h" file did not get copied. So, I assume I'm probably chiming in a bit early on this.

Anyway, I tried in vain to copy the files, but I only seemed to break things. I could use some help. I'm a 55 year old noob with lots of embedded experience, but not this level with the Arduino IDE where I need to try something this new. I can see that rc4 is active in my hardware\esp32 directory. Can you point me to the process for working with this pre-release code?

Thanks,

Mike.

@VerusLogic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I went through the process for setting up the development repository for the Arduino IDE. I realized I needed to delete the board using board manager to get it to use the board from the Arduino Sketch folder. It works great!

I was able to easily modify the project to use the RGBW 32-bit data format.

The first bit sent is always a zero sequence. I changed line 65 from:
if ( (color[col] & (1<<(8-bit))) && (led == led_index) ) {
to
if ( (color[col] & (1<<(7-bit))) && (led == led_index) ) {
to fix this.

Using my scope I can count the positive pulse edges and there are 1024 of them. This is correct for 32-bits to 32 LEDs.

The timing is amazingly steady and correct 1.2uS periods.

The BEST news is that I put a set output and clear output before and after the rmtWrite() instruction and it takes only 15.5uS to set things in motion. Then the CPU can be fully utilized for other tasks while the hardware sends the pixel data. This is why I was looking into using the remote peripheral to drive Neopixels.

@VerusLogic
Copy link

@VerusLogic VerusLogic commented on 4e96bff Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I need to learn how to contribute to this project now.

I added one more bit to NR_OF_ALL_BITS to add the 80uS reset pulse.

#define NR_OF_ALL_BITS 24*NR_OF_LEDS + 1

I inserted this code at line 80 to tack on the reset bit and not rely on the delay alone to cause a minimum reset time.

  // tack on the reset pulse to the end
  led_data[i].level0 = 0;
  led_data[i].duration0 = 800;
  led_data[i].level1 = 0;
  led_data[i].duration1 = 8;

Who do I need to thank for all this great effort?

@tedhenry100
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did something similar for the reset but I put it at the front of the bits to sent out to the pixels.

@VerusLogic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tedhenry100 - that is smart to put it at the beginning. Thanks for the tip.

Please sign in to comment.