WLED icon indicating copy to clipboard operation
WLED copied to clipboard

APA102 don´t work with LAN8720 (WT32-ETH01)

Open AVRnet opened this issue 2 years ago • 25 comments

What happened?

With actual build 2112080 i have a problem to bring WT32-ETH01 LAN Interface work together with APA102 LEDs.

To Reproduce Bug

Configured LAN Interface (W32-ETH01) and selection of APA102 with save, the Modul run into bootloop and AccessPoint go up.

Expected Behavior

LAN Interface is configured and works amazing with WS281x and SK6812 LEDs.

Install Method

Binary from WLED.me

What version of WLED?

2112080

Which microcontroller/board are you seeing the problem on?

ESP8266, ESP32

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

AVRnet avatar Feb 12 '22 12:02 AVRnet

Use GPIO pins that do not conflict.

blazoncek avatar Feb 12 '22 13:02 blazoncek

I have tested all kinds of GPIO combinations. Only WLAN works flawless with APA102 Chips. I couldn´t have done with W32-ETH01 and APA102 to use the LAN port.

Setup with WS281x and SK6812 LEDs works however perfect.

AVRnet avatar Feb 15 '22 05:02 AVRnet

Try lowering SPI speed by changing DotStarSpiHzMethod; in bus_wrapper.h

blazoncek avatar Feb 25 '22 07:02 blazoncek

I'm having the same issue. lowering SPI speed does not help. Did you solve the problem?

lechk82 avatar Mar 21 '22 07:03 lechk82

I'm afraid not. I haven´t got any idea to solve the problem.

AVRnet avatar Mar 22 '22 04:03 AVRnet

I also have the same problem. I am using WS2801 LED strips with an ESP32 dev board and a LAN8720 module. The GPIO pins were connected as on a WT32-EHT01, so WLED works without adjustment with the provided binary. All LED strips that require only one pin can be selected without any problems. As soon as a LED strip is selected that needs clock and data pins, Ethernet does not work anymore and the access point is started. Only after selecting another LED strip Ethernet works again. No possible GPOI combination works. Also reducing the SPI speed does not change anything. To reproduce the behavior the LED strip does not have to be present and connected, the selection in the web interface is sufficient.

lucasheld avatar May 16 '22 19:05 lucasheld

SPI is used exclusively for driving APA102 (or other SPI) LEDs. No other SPI device can currently coexist with SPI LEDs.

blazoncek avatar May 16 '22 20:05 blazoncek

As far as I know, the LAN8720 module does not use SPI at all, but RMII. Accordingly SPI should be available for the LEDs right?

lucasheld avatar May 17 '22 14:05 lucasheld

I bought a WT32-EHT01 to run a WS2801 strip and I'm now facing the same issue, ethernet not working as soon as WS2801 is selected in WLED.

The datasheet mentions RMII not SPI as @lucasheld mentioned. Maybe someone who speakes chinese can help with the datasheet? WT32-ETH01规格书V1.2.pdf

d3473r avatar Jun 29 '22 08:06 d3473r

@d3473r The datasheet is also available in english. WT32-ETH01_datasheet_V1.1- en.pdf

lucasheld avatar Jun 30 '22 08:06 lucasheld

image

ywwg avatar Aug 22 '22 19:08 ywwg

Can confirm, as soon as I set LED type to APA102 ethernet stops working. Also I am using software SPI, because I can change the GPIO pins at will

ywwg avatar Sep 17 '22 21:09 ywwg

Hi All..

i can confirm it too but on the Olimex POE Boards..

If you use SPI LEDs and Ethernet it is not working..

Here are the modes: DotStarMethod: OK but Software only DotStarEsp32DmaVspiMethod: OK but to fast DotStarEsp32DmaVspi1MhzMethod: OK perfect DotStarSpiMethod: NotOK should work, but it did not... DotStarVspiMethod: NotOK should work, but it did not... DotStarEsp32DmaHspiMethod: NotOK because it conflicts with ethernet port DotStarHspiMethod: NotOK because it conflicts with ethernet port

Happy lights André

BlackBird77 avatar Sep 30 '22 11:09 BlackBird77

WLED uses HSPI for driving LEDs as VSPI may be used by other devices.

blazoncek avatar Sep 30 '22 18:09 blazoncek

WLED uses HSPI for driving LEDs as VSPI may be used by other devices.

On the Olimex Board is the ethernet controller on Hspi and the SD Card on Vspi.. If you don't use a external SD card you can drive the Leds on Vspi..

And if i read the code right, the Arduino default is also Vspi, but it initializes only some spi IO pins and not the QuadHD, QuadWP Pins of Vspi.

The Esp32 DMA SPI mode initializes all Vspi pins and deactivate the unused pins..

BlackBird77 avatar Oct 07 '22 13:10 BlackBird77

I'm having issue with WT32-ETH01 too but not using the APA ledstrip (I don't have APA connected but only configured with GPIO 2 and 4).

It's only work at the configuration time. I have compiled some versions and doing a lot of testing and still searching how to solve the issue I'm facing. I'm interested into WledSR with I2S but I'm facing the same behavior in fact with native aircookie wled version.

Here the output at configuration time : (from wifi setup - experimental - ethernet : none to wt32-eth01 -> save) image

  1. WLED without Lan configured starting in Wifi (cable removed as well , if not it's seems logicaly different)
lastReconnectAttempt == 0

Access point disabled (init).
Connecting to wifi...
Connected! IP address: 10.0.4.103

  1. I put the LAN cable -> no green/yellow LAN Led - no connectivity (as foreseen)

  2. WLED: change config and activate the LAN and save

initE: Attempting ETH config: 1
initC: *** Ethernet successfully configured! ***
ETH StartedWriting settings to /wsec.json...
Writing settings to /cfg.json...
Forcing reconnect.
WS client disconnected.
Access point disabled (init).
Connecting to wifi...
Connected! IP address: 10.0.4.103
Init STA interfaces
mDNS started
Not-Found HTTP call:
URI: /presets.json
FileRead: /presets.json
ETH ConnectedDisconnected!
Access point disabled (init).
Connecting to wifi...
Last reconnect too old.
Access point disabled (init).
Connecting to wifi...

Connected! IP address: 10.0.4.109

--> The WLED is now connected in LAN. Strange to see ETH ConnectedDisconnected! but you see the screenshot above and the IP adrress is moving from 103 (wifi) to 109 (Lan)

  1. If I power OFF, ON:
initC: *** Ethernet successfully configured! ***
Removing all.
lastReconnectAttempt == 0
Access point disabled (init).
Connecting to wifi...

Connected! IP address: 10.0.4.103
Init STA interfaces
mDNS started
ETH ConnectedDisconnected!
Access point disabled (init).
Connecting to wifi...
Last reconnect too old.
Access point disabled (init).
Connecting to wifi...
Last reconnect too old.
Access point disabled (init).
Connecting to wifi...

Connected! IP address: 10.0.4.103

I can't achieve to have LAN connection at this point.

During the process, I didn't modify any GPIO. So for me it's not really linked directly except may be at boot time where may be we need to have something initialized upfront. Can you provide some ideas for further investigation on this ?

PS: If I configure 2 output with ledstrip ws281x using GPIO 2 and 4 , I don't have the issue. It's seems link with APA technology but also same with I2S using GPIO 12,14,15 with ws281x ledstrip. But this not explain why it's working at configuration time vs boot time not

zigomatichub avatar Oct 26 '22 10:10 zigomatichub

Another idea - possibly related to flash speed? We've seen random flickering in v0.13.2 and v0.14.0 that disappeared after adding these lines (platformio.ini):

board_build.f_flash = 80000000L
board_build.flash_mode = qio

It could also be the other way around: in case you already use firmware for 80Mhz, then maybe the flash on the WT32-ETH01 does not run reliably at 80mhz, and building for 40Mhz might help.

softhack007 avatar Oct 27 '22 13:10 softhack007

The WT32-ETH01 use a chip WT32-S1 where in the datasheet, I found this: On-board clock 40 MHz crystal. I don't think it's the ESP speed but may be it's a limitation. I will continue some research on that with the 2 parameters mentionned and test multiple firmware. I will take some days. But I'm still having a trouble here because I still don't know why at configuration time, it works for xx hours without issue. Then rebooting give direct issue !

zigomatichub avatar Oct 28 '22 07:10 zigomatichub

I tried with this compile option but same issue. Working fine at configuration time but not after the reboot.

[env:esp32_eth]
board = esp32-poe
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
upload_speed = 921600
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32} -D WLED_RELEASE_NAME=ESP32_Ethernet -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 -D WLED_DISABLE_BLYNK -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_ALEXA -D WLED_DISABLE_INFRARED -D WLED_DEBUG -D USERMOD_MULTI_RELAY -D USERMOD_AUDIOREACTIVE
lib_deps = 
 ${esp32.lib_deps}
 https://github.com/blazoncek/arduinoFFT.git
board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L
board_build.flash_mode = qio

zigomatichub avatar Nov 03 '22 22:11 zigomatichub

Today I compiled again with the main branch (71d84fec) with same configuration but I erase completely the flash + esp32_bootloader_v4.bin. I get very positive result now. With ws281x, it works. When I change to APA102, save button then it's nok. After a reboot, it never goes to LAN but use wifi instead.
In other to have again running with WS281x , I have to disconnect the cable , removed the Lan configuration, and then put back the Lan configuration. Do you think writing APA config erase something on LAN config ?

zigomatichub avatar Nov 08 '22 15:11 zigomatichub

When I change to APA102, save button then it's nok.

Could be a hardware conflict between APA102 and LAN driver, for example:

  • GPIO you selected for APA102 are needed also for the LAN interface.
  • conflicts in SPI driver, like vspi vs hspi

It could explain your observation that it's not working after reboot, if LED drivers are initialized before the LAN driver, so they can "steal" hardware ressources and the LAN driver is not able any more to initialize.

softhack007 avatar Nov 09 '22 14:11 softhack007

But I tried with the same PIN with 2 data lines with WS281x (on IO2 and IO4 like for APA102 but which are used one for data -IO2 /CLK - IO4 ) 2 data line are OK but one data + one clock is NOK. so strange no ?

Not the datasheet of the wt32-eth01 but it use the wt32-s1 ... I hope to have the same spec.

Conflict with HSPIHD and HSPIWP ? But this is used by LAN but don't explain why it works in ws2812 :) ???

image

OR it's because LAN use clock oscillator ? image that may be use into APA102 library ?

Here LAN datasheet where they show what is go IN/OUT from the RMII image

Finally here the RMII image

IO4 is TX_ER in this datasheet but it's not mentionned in wt32-eth01 datasheet... difficult to see on the pcb. But why it works in W281x ... That is funny :)

From a PCB research perspective, I don't see any TXER as pin from the chip. I guess there is no physical connection from the chip to IO4 image

zigomatichub avatar Nov 09 '22 15:11 zigomatichub

I tried reversing clk io2 / data io4 --> Nok as well.

APA102 code do something (HSPI related) that LAN don't like but I would not go into the direction of GPIO allocation issue because it's used by LAN :)

zigomatichub avatar Nov 09 '22 16:11 zigomatichub

I'm running a QuinLED-ESP32 ethernet board and experiencing the same (guess I'm not sure if the chip that uses is LAN8720 or not) with APA102 strips breaking ethernet communication.

nwalke avatar Nov 11 '22 17:11 nwalke

I think it has something to do with the SPI initialization over the Arduino framework! This is the standard implementation in WLED for SPI!

If you compile it with the SPI DMA driver it works on the same Pins..

I have looked for differences in the SPI initialization and code generally..

The only difference I can see is, the Arduino implementation do not deactivate the SPI Quad Pins..

The Esp32 SPI DMA does a explizit deactivation of the SPI Quad pins..

On my Olimex Board the IOMUX SPI Quad Pins are on the same pins with the LAN Chip!

Greetings! Andre

Nick Walke @.***> schrieb am Fr., 11. Nov. 2022, 18:39:

I'm running a QuinLED-ESP32 ethernet board and experiencing the same (guess I'm not sure if the chip that uses is LAN8720 or not) with APA102 strips breaking ethernet communication.

— Reply to this email directly, view it on GitHub https://github.com/Aircoookie/WLED/issues/2542#issuecomment-1311982917, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDQYFWOBDYQIXY5QBJGN4DWH2AG3ANCNFSM5OGXZ6IQ . You are receiving this because you commented.Message ID: @.***>

BlackBird77 avatar Nov 11 '22 18:11 BlackBird77

Same problem here, did anybody find a solution ?

benkuper avatar Mar 11 '23 12:03 benkuper

Yes compile it yourself and use the DMA Drivers for SPI..

This works perfectly!

Greetings

Ben Kuper @.***> schrieb am Sa., 11. März 2023, 13:37:

Same problem here, did anybody find a solution ?

— Reply to this email directly, view it on GitHub https://github.com/Aircoookie/WLED/issues/2542#issuecomment-1464903266, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDQYFTBFBSI6DEZ4BWOJN3W3RW2JANCNFSM5OGXZ6IQ . You are receiving this because you commented.Message ID: @.***>

BlackBird77 avatar Mar 11 '23 13:03 BlackBird77

@BlackBird77 why don't you make a PR for your findings? Please.

blazoncek avatar Mar 11 '23 14:03 blazoncek

DMA Driver for SPI, looked in few places and didn't find any clear way of doing it for WLED... any pointers on where to look ? Thank you

benkuper avatar Mar 11 '23 14:03 benkuper

It is only configuration.. Nothing complicated. You have to disable the standard SPI driver and use the DMA SPI driver.

But this is only a workaround, not a fix for the real problem, of the original SPI driver.

Blaž Kristan @.***> schrieb am Sa., 11. März 2023, 15:09:

@BlackBird77 https://github.com/BlackBird77 why don't you make a PR for your findings? Please.

— Reply to this email directly, view it on GitHub https://github.com/Aircoookie/WLED/issues/2542#issuecomment-1464919870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDQYFSSO7V6GBVCFI3XQB3W3SBRDANCNFSM5OGXZ6IQ . You are receiving this because you were mentioned.Message ID: @.***>

BlackBird77 avatar Mar 11 '23 14:03 BlackBird77