nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32

Home Page:https://nodemcu.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ws2812.write always fails on ESP32-C3

docbacardi opened this issue · comments

Expected behavior

The write function should emit the requested sequence on one of the pins.

Actual behavior

On the ESP32-C3 the function always fails with "set gpio for RMT driver failed".
Looks like the function platform_rmt_allocate does not distinguish between RX and TX channels. This is important for the ESP32-C3 as it can only do TX on RMT channels 0 and 1, Channels 2 and 3 can only do RX. Currently channel 3 is allocated for a TX session, which is rejected by the SDK.

"The RMT has four channels numbered from zero to three. The first half (i.e. Channel 0 ~ 1) channels can only be configured for transmitting, and the other half (i.e. Channel 2 ~ 3) channels can only be configured for receiving."
https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-reference/peripherals/rmt.html

Oh, and I have some patch for this. Unfortunately there seems to be more trouble with RMT on the ESP32-C3 as only the reset sequence is visible after changing it. But its a start...

Test code

> ws2812.write({pin=8, data=string.char(255,0,0)})
E (264122) rmt: rmt_set_gpio(529): RMT CHANNEL ERR
E (264122) rmt: rmt_config(685): set gpio for RMT driver failed
E (264122) rmt: rmt_wait_tx_done(1158): RMT CHANNEL ERR
E (264122) rmt: rmt_driver_uninstall(943): No RMT driver for this channel
Lua error: 	stdin:1: sending failed
stack traceback:
	[C]: in function 'write'
	stdin:1: in main chunk
	[C]: ?
	[C]: ?

NodeMCU startup banner

NodeMCU ESP32 build unspecified powered by Lua 5.1.4 [5.1-doublefp] on IDF v4.4-dev-2594-ga20df743f1

Hardware

ESP32-C3

PR merged. Is this issue safe to close now?