Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
15.07k stars 3.26k forks source link

physical DMX-out on ESP32-C3 (found possible fix) #4239

Open 5t0n3r1pp3r opened 3 weeks ago

5t0n3r1pp3r commented 3 weeks ago

What happened?

When compiling any version of wled from source(vscode Dev Container)

The DMX pin does not allocate and flickers an led but no DMX is sent reliably. No Light turns on from DMX

I tested the circuit and confirmed the rs485 chip works fine on nodeMCU.

To Reproduce Bug

Compile any 0.15 WLED with DMX on for ESP32-C3-Mini-1 and connect a MAX485 circuit to pin 2.

Expected Behavior

The board should control and send proper DMX on the selected PIN

Install Method

Self-Compiled

What version of WLED?

WLED 0.15.0-b6

Which microcontroller/board are you seeing the problem on?

ESP32-C3

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

5t0n3r1pp3r commented 3 weeks ago

Found a solution After more testing it seems like the pin is being taken over by another process. If i change the pin the odd blink follows it and i cannot get the pin to output correctly after further testing from adding explicit pin selections in: ESPDMX.cpp

// Initialize Serial1 with the specified TX pin (2) and no RX
  Serial1.begin(DMXSPEED, DMXFORMAT, -1, sendPin);

This made the DMX start working. I can still see the led flash but the dmx is working on C3- Mini.

Should this line be changed if someone wants to use a different pin?

#ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin
  PinManager::allocatePin(2, true, PinOwner::DMX);
#endif

this is found in wled.ccp line 416

softhack007 commented 3 weeks ago

@5t0n3r1pp3r not sure what you're doing .... ESPDMX.cpp is only for 8266. Whatever you change there won't affect your -C3 board.

https://github.com/Aircoookie/WLED/blob/1ff667b7eff07ebad100e48eb871c698eab11a71/wled00/src/dependencies/dmx/ESPDMX.cpp#L14


For esp32 boards, we use the sparkFun DMX driver:

Unfortunately the sparkFun driver needs serial2 which is not availeable on -C3 or -S2.

https://github.com/Aircoookie/WLED/blob/1ff667b7eff07ebad100e48eb871c698eab11a71/wled00/src/dependencies/dmx/SparkFunDMX.cpp#L44-L54


Compile any 0.15 WLED with DMX on for ESP32-C3-Mini-1 and connect a MAX485 circuit to pin 2. The board should control and send proper DMX on the selected PIN

As consequence of what I explained, currently you can't have DMX serial output from WLED on the -C3 board, sorry. Same for -S2. However -S3 mini or -S3 zero might work, if you are looking for a small board.