-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/ws281x: add RMT hardware support for ESP32x SoCs #19424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. I'll take a second look tomorrow on a big monitor just in case. I tend to do betters on that compared to a review on a phone screen 😅
a73d494
to
862e0c7
Compare
862e0c7
to
0224941
Compare
bors r+ |
19424: drivers/ws281x: add RMT hardware support for ESP32x SoCs r=maribu a=gschorcht ### Contribution description This PR provides support for ESP32x RMT that is used to generate WS2812B signals. All ESP32x SoCs have a [Remote Control Peripheral (RMT)](https://docs.espressif.com/projects/esp-idf/en/v4.4.4/esp32/api-reference/peripherals/rmt.html) that can be used to generate digital waveforms, such as NEC remote control signals or WS2812B RGB LED signals. Each RMT peripheral has either 4 or 8 channels. Some ESP32x SoCs support configuring the clock sources used for each channel separately, while other ESP32x SoCs can only use a single clock source for all channels. The advantages using the RMT are that the CPU is not busy when generating the WS218x signal and the phase times are accurate to nanoseconds. The disadvantage is that the configuration of the RMT is so complex due to its flexibility that the [ESP-IDF high-level driver for RMT](https://docs.espressif.com/projects/esp-idf/en/v4.4.4/esp32c3/api-reference/peripherals/rmt.html) is used.This requires about 6 kBytes more ROM, about 3 kBytes more IRAM, and 88 bytes more RAM. Therefore, either the RMT hardware implementation (module `ws2812x_esp32_hw`) as well as the bit-banging software implementation (module `ws2812x_esp32_hw`) can be used. RMT hardware implementation (module `ws2812x_esp32_hw`) is used by default. Timing with hardware implementation: ![ws281x_esp32_rmt](https://user-images.githubusercontent.com/31932013/227791452-5cc1f95e-04ac-43bb-b11c-f131ab7ab1d5.png) ### Testing procedure `tests/driver_ws281x` should still work, for example: ``` CFLAGS='-DWS281X_PARAM_PIN=GPIO45 -DWS281X_PARAM_NUMOF=47' BOARD=esp32s3-devkit make -j8 -C tests/driver_ws281x flash ``` Test Output: https://user-images.githubusercontent.com/31932013/227791753-e6d2924e-3364-4387-870f-a56d3a9a8a80.mp4 ### Issues/PRs references Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Build failed: |
🙄 I had to add |
bors retry |
👎 Rejected by PR status |
Ah, squashing is still missing |
fixup! tests/driver_ws281x: add ESP32x CI boards to test ws281x_esp32_sw
05f78ff
to
be03323
Compare
Yes, by intention to show the last changes. |
bors retry |
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
bors retry |
Build succeeded: |
Thanks. |
Contribution description
This PR provides support for ESP32x RMT that is used to generate WS2812B signals.
All ESP32x SoCs have a Remote Control Peripheral (RMT) that can be used to generate digital waveforms, such as NEC remote control signals or WS2812B RGB LED signals. Each RMT peripheral has either 4 or 8 channels. Some ESP32x SoCs support configuring the clock sources used for each channel separately, while other ESP32x SoCs can only use a single clock source for all channels.
The advantages using the RMT are that the CPU is not busy when generating the WS218x signal and the phase times are accurate to nanoseconds. The disadvantage is that the configuration of the RMT is so complex due to its flexibility that the ESP-IDF high-level driver for RMT is used.This requires about 6 kBytes more ROM, about 3 kBytes more IRAM, and 88 bytes more RAM.
Therefore, either the RMT hardware implementation (module
ws2812x_esp32_hw
) as well as the bit-banging software implementation (modulews2812x_esp32_hw
) can be used. RMT hardware implementation (modulews2812x_esp32_hw
) is used by default.Timing with hardware implementation:
Testing procedure
tests/driver_ws281x
should still work, for example:Test Output:
https://user-images.githubusercontent.com/31932013/227791753-e6d2924e-3364-4387-870f-a56d3a9a8a80.mp4
Issues/PRs references