Skip to content

ESP-NOW must be disabled on ESP32 Ethernet boards that use ESP32 as PHY clock source; WLED-AP is affected too! #4703

Open

Description

@Arcitec

What happened?

During the WLED 0.15.1 testing, I found an extreme slowdown/freezing of the ESP32 CPU when using ESP-NOW based remote controls to control WLED.

  • I was using an ESP-NOW-based remote control, which connects directly to the ESP32 via WiFi/Bluetooth (it bypasses the home network). And I noticed that there was extreme freezing/hanging of the ESP32 whenever a remote command was being sent via the ESP-NOW WiFi connection.
  • Broken setup: The left light strip is connected to a WiFi + Ethernet board, where the Ethernet cable is plugged in and connected, and ESP-NOW (WiFi remote) is enabled.
  • Good setup: The right light bar is connected to a WiFi board, which is connected to home WiFi + ESP-NOW (WiFi remote).
  • At 0:02: Pressing "off". The right strip immediately turns off.
  • At 0:12: The left strip (Ethernet strip) finally turns off too. 10 seconds after it received the ESP-NOW "lights off" command!
  • At 0:16: Pressing "on". The right strip immediately turns on.
  • At 0:21: The left strip finally turns on too. 5 seconds later.
  • At 0:24: Pressing "off". The right strip immediately turns off.
  • At 0:45: The left strip finally turns off too. 21 seconds later!

Video demonstration:

ESP32_Hanging.mp4

Initially, I thought it was just some simple bug in WLED's remote control code. But the true reason turned out to be horrifying. I have now unfortunately found out why ESP-NOW is such a dangerous thing on ESP32 Ethernet boards. There's... a severe ESP32 hardware bug! It was discovered by ESP32 staff in August 2024, and it's way more severe than just ESP-NOW:

  • When WiFi is actively transmitting or receiving data for any reason, the ESP32's PLL clock signal becomes unstable and starts outputting random nonsense timings.
  • Many ethernet boards use the ESP32's clock output for the Ethernet chip to avoid buying external and possibly broken crystals (which would require extra testing of each board to make sure the external crystal works, etc etc). This ESP32 feature was meant to simplify the board design and end up with a very reliable board (or so we thought). Lots of WLED boards do it, because it was the perfect, "intended purpose" of that ESP32 clock output signal. It's therefore extremely painful and unfortunate that the ESP32 hardware has turned out to be totally broken...
  • Why it hangs: When WiFi data is being transmitted, it throws off timing of all the PLL clock signals. The broken timings are then routed into the Ethernet chip. In turn, that chip creates havoc in its decoding of Ethernet data and the operation of the Ethernet chip. The Ethernet data signal becomes unstable, which breaks the communication between the ESP32 and the Ethernet chip, and the ESP32 chip itself can then freeze for a long time as it tries to make sense of the chaos.
  • When it happens, there's around 5-25 seconds of freezing in the ESP32 core. Possibly even crashing it in some cases. This ESP32 hanging/slowdown is random, since it only happens if WiFi transmits data at the exact same time that the Ethernet chip is doing something important (such as sending/receiving/transcoding Ethernet data).
  • I'll say that again: The freezing is intermittent, because the unstable PLL clock needs to happen at a critical moment where the clock instability then causes cascading failures in the communication between the ESP32 and the Ethernet chip!

So what scenarios will enable WiFi + Ethernet at the same time in WLED and trigger the hardware bug?

  • Enabling the ESP-NOW (remote control) feature in WLED. As you can see on Espressif's feature page, that protocol uses WiFi (if it can, it uses a direct connection between the ESP32 and the remote) and Bluetooth (fallback). If it then connects to a remote, the resulting WiFi signal activity breaks the ESP32's PLL clock.
  • Connecting to the WLED-AP (WiFi AP) for any reason whatsoever while the Ethernet cable is connected to the ESP32. That WiFi activity definitely breaks the PLL clock.
  • ESP-NOW and WLED-AP are both high-impact and will trigger the bug rapidly since they cause lots of WiFi activity.
  • Background beacons/pings are constantly being sent or received in the background by the WiFi antenna on the ESP32. The WiFi portion of the ESP32 is always listening, so depending on the size of those beacons/durations, there's a strong likelihood that they will also create enough fluctuations in the PLL clock signal to cause issues on Ethernet boards. This means that even if WLED-AP is unused by clients and ESP-NOW is disabled, there can still be instabilities in the ESP32's PLL clock signal if the WiFi antenna is enabled (since it's passively receiving/sending WiFi network advertisement beacons).

What are the immediate impacts:

  • Ethernet boards which use the ESP32 as clock source (for anything) are impacted.
  • Ethernet boards which use external crystals are not impacted.
  • Boards without an ethernet chip are not impacted.

Hardware documentation:

I found the hardware bug details via the following ESP32 hardware errata page, and there's a discussion where it was originally discovered:

So how does this affect WLED:

  • In the past, in WLED 0.14.x and earlier, some WLED developer had experienced this exact issue when they were testing ESP-NOW, but they weren't fully sure what was going wrong, so they just added a flag to disable ESP-NOW remotes in all Ethernet builds as a "blanket fix". Their code comment was -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only. But that was unfortunately a misunderstand of the true severity of what was happening...
  • In WLED 0.15.x, someone assumed there was no issue anymore. Most likely because someone tested an Ethernet board that doesn't use the ESP32 as PHY clock, and they didn't see any instability when ESP-NOW and Ethernet were enabled together. So the flag was removed and now every Ethernet build of WLED contains ESP-NOW support.
  • But the hardware bug still exists in the latest ESP32 hardware revision. So the issue still exists. It doesn't just impact ESP-NOW. It's triggered by any WiFi activity at all!

How we can improve the situation in WLED's code to minimize the harm:

  • Document the quirk for users. So if they see extreme slowdown/loss of Ethernet packages or slowdown of their ESP-NOW-based remote, they know that the hardware has freaked out and will take 5-20 seconds to fix itself and start responding again. It doesn't seem to fully crash the device - but a full crash (which doesn't recover itself) could possibly happen too, since the old WLED comment mentioned crashes as the reason for disabling ESP-NOW on Ethernet boards.
  • It may be possible to reduce the impact dynamically in a surgical way:
    • WLED's internal list of Ethernet boards already contains a list of which boards use the ESP32's GPIOs as Ethernet clock output.
      • Therefore, the WLED code for the ESP-NOW remote checkbox "enable" can check all conditions:
      • Is the board Ethernet based, and does it use ESP32's clock GPIOs as PHY clock? Then refuse to enable ESP-NOW in WLED and display a small error to the user which explains that their hardware uses ESP32 for Ethernet clock which is totally incompatible with ESP-NOW due to a hardware flaw in the ESP32.
    • Consider following Espressif's new guidelines by adding an advanced feature which lets users completely disable the ESP32 WiFi antenna (WLED-AP) via code when an affected Ethernet board is used. That would be the most powerful and most stable mitigation if the user desires perfect board stability, if it's important for the user that the controller never randomly freezes/crashes. But of course, that mitigation method carries a high risk of users locking themselves out and needing to do a board reset. And if they can't connect via Ethernet due to having messed up their Ethernet board type selection, then they can't get in to fix the board. So this potential mitigation would require careful planning if it's adopted. It's really the only way to actually ensure 100% stable board operation, though.
      • Idea for a safe implementation: If the user enables the "Advanced: ESP32 PLL Bug Mitigation" checkbox, WLED does the following at startup:
        • Enable WiFi (WLED-AP) immediately if...
          • ...the board doesn't have Ethernet at all.
          • ...or the WLED Ethernet board type is set to something that doesn't use the ESP32 PLL as Ethernet clock. (Meaning, has an external crystal and isn't affected.)
        • If an affected Ethernet board type was selected, then disable the WiFi antenna.
        • Analyze the Ethernet port:
          • Is a cable connected? Does it have an IP?
            • If a cable is connected but it hasn't received an IP in let's say 15 seconds or so, then enable WLED-AP as a safety fallback to prevent total user lockout.
              • If the ethernet cable suddenly receives an IP, then WLED-AP should be disabled automatically again. But only if no client is currently connected to WLED-AP (to avoid breaking any in-progress WLED-AP sessions such as OTA firmware updates)! If a client was currently connected, then set a flag to "disable WLED-AP after last WiFi client disconnects".
                • Wait until all WiFi clients have disconnected from WLED-AP and then disable WLED-AP again. This can be achieved via an on-disconnect hook in the WLED-AP client handling code. "If 0 connections remain, check the flag to see if WLED-AP should be turned off now since the board owner wanted to use this in Ethernet-only mode."
            • If the cable is not connected at all, then do nothing. Because the user has set their controller to "Ethernet only" mode, so they expect that they will need to plug in a cable to use the controller. Therefore, WiFi should stay totally disabled if no Ethernet cable is connected at startup.

I assume that the Espressif SDK provides enough callbacks/events for WiFi and Ethernet connection state changes (on-connect, on-disconnect, physical cable connection status, assigned IP status, etc), which would really simplify the implementation.

"Can't we just unplug the Ethernet cable?"

  • If you're wondering whether ESP-NOW is safe and stable if someone owns an Ethernet board, but only uses the WiFi connection, and hasn't plugged in a cable: I don't know, but most likely not. The Ethernet chip is still connected to the hardware and doing its thing, so it will still be receiving a whacky clock signal that breaks the communication between the ESP32 and the Ethernet chip. And when that chip communication breaks, the ESP32 can hang for a while.
  • It's not safe to assume that it will be stable if the Ethernet port is disconnected. And I don't want to try testing whether the Ethernet chip is happy with receiving a broken clock signal whenever no cable is attached. Because there could be severe race conditions with specific timings, which means that it could take a very long time to hit the correct conditions for some catastrophic timing failure, such as a total hardware crash that only happens if the clock signal breaks at exactly the worst time during the Ethernet chip's internal processes, etc. It would take way too much time and observation to investigate that possibility.
  • The simplest fact is that the ESP32 PLL can never be trusted when WiFi is active on the ESP32. How all the chips on the board handle that fault condition (either freezing, recovering, crashing etc) is too complicated to investigate.

What can users do to mitigate the hardware bug:

  • If your board doesn't have Ethernet at all: It's totally unaffected.
  • If your Ethernet board has an external clock crystal: You don't need to do anything. The broken clock signal is not being sent to the Ethernet chip.
  • If your Ethernet board uses the ESP32 clock for Ethernet:
    • If you want to connect to the controller via WiFi:
      • Unplug any ethernet cable you may have had on the board.
      • Use WiFi to connect to the WLED controller.
      • Feel free to use ESP-NOW and WLED-AP, since you are entirely within the WiFi ecosystem.
      • But if you see any long, severe ESP32 freezes, it's possible that the Ethernet chip is still freaking out about the unstable clock from all the WiFi activity (it's a possibility, as mentioned in the previous section). In that case, consider going wired instead.
    • If you want to connect to the controller via Ethernet:
      • Disable the ESP-NOW remote support. (It's off by default in WLED's settings, though.)
      • Do not use the WLED-AP WiFi connection. Always use the Ethernet port's IP instead.
      • If WLED gets an option to disable the WiFi antenna on affected Ethernet boards in a safe way without risk of user lockout, you can consider enabling that if you want total stability.

To Reproduce Bug

See above.

Expected Behavior

See above.

Install Method

Binary from WLED.me

What version of WLED?

  • ESP-NOW support has been added to all Ethernet versions of WLED from 0.15.x and newer.
  • Every ESP32 controller is affected, regardless of WLED version. But the only boards that use the PLL clock signal for anything are connecting it to Ethernet controller chips, so if the board doesn't have Ethernet, it's completely unaffected.

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

Anything else?

No response

Code of Conduct

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

Activity

  1. changed the title [-]ESP-NOW must be disabled on ESP32 Ethernet boards that use GPIO17 as clock source[/-] [+]ESP-NOW must be disabled on ESP32 Ethernet boards that use ESP32 as PHY clock source[/+] on May 30, 2025
  2. changed the title [-]ESP-NOW must be disabled on ESP32 Ethernet boards that use ESP32 as PHY clock source[/-] [+]ESP-NOW must be disabled on ESP32 Ethernet boards that use ESP32 as PHY clock source; WLED-AP is affected too![/+] on May 30, 2025
  3. added
    hardware
    on May 30, 2025
  4. blazoncek commented on May 30, 2025

    @blazoncek
    Contributor

    AFAIK when you connect Ethernet, WiFi is turned off (WiFi.diconnect(true); see here for 0.15.x).

    However AP mode cannot be disabled outright as that may prevent users from recovering. ESP-NOW is an optional feature, not enabled by default.

    IMO it would suffice to do one (or both) of the following for when Ethernet cable is plugged in:

    • force enableESPNow = false; if users enabled ESP-NOW (perhaps a bit more detailed but that's the principle)
    • add information to KB mentioning incompatibility between Ethernet and WiFi circuitry

    Regarding unconnected Ethernet being affected with broken PLL: It doesn't matter that much as no Ethernet code is touched in WiFi mode. It should resolve when cable is plugged in.

  5. Arcitec commented on May 30, 2025

    @Arcitec
    ContributorAuthor
    1. Interestingly, the code you linked to that forces "WiFi.disconnect" on Ethernet-Connect event seems like it would be a bug. Because the API docs say that the API turns off the WiFi radio - but the WiFi radio needs to be enabled to use ESP-NOW. So if the user enables ESP-NOW, then plugs in the Ethernet cable, it would probably disconnect ESP-NOW too. This of course matters if the user has a board which doesn't use the PLL for Ethernet. On those boards, WiFi and Ethernet can both be enabled at the same time safely. Such a user would be safely able to use a remote (ESP-NOW) and Ethernet st the same time. So that feature should be preserved for sure.
    2. Regarding user lockout when disabling AP radio completely: I fleshed out the skeleton of a safe algorithm idea for it, in the "how can we improve WLED's code" section.
    3. The idea to force enableESPNow = false when the user plugs in a cable would break the Ethernet boards that have external crystals and could safely have both features (WiFi remote control and Ethernet cable). So my post had an idea for an algorithm that could disable it only for the boards that are broken.
    4. Regarding a KB article, feel free to link to or copy anything from my post.
    5. And finally, regarding disconnecting the Ethernet cable, and whether it will still trigger freezes when the user operates entirely via WiFi instead: Unfortunately it's likely that the ESP32 SDK still talks to the Ethernet chip hardware constantly to query whether it's connected to a cable etc. But I can imagine that there is one way to bypass that behavior: Be sure that WLED doesn't configure the Ethernet GPIOs at all. The user can even achieve that themselves by setting "ethernet board type" in WLED to "None". :) Then they can be sure that the Ethernet chip is disabled and that their board uses entirely WiFi. I will edit the list later to add this technique to the user workaround methods! (I need to rest my brain a bit, but this technique can probably also be used a sa replacement for the "ESP32 PLL Bug Mitigation" checkbox idea I mentioned earlier. Instead we just tell users to disable Ethernet by unsetting board type, or fisbling WiFi by connecting a cable since WLED turns off the WiFi radio on cable connection.)

    By the way, I vaguely remember that some pull request was working on a feature to allow WiFi and Ethernet at the same time. If I don't totally misremember. So that pull request would need scrutiny if someone was trying to contribute such a feature.

    My brain is very tired right now, but I think it seems necessary to do board detection and some of the smarter algorithms I mentioned so that WiFi and Ethernet can coexist on boards that support it in hardware.

    I'll have a look later at the potential mitigations again, with the info you provided. The difficulty will be in having an algorithm that protects vulnerable boards (detectable via the pinout configs in WLED's source code) but still allows WiFi/ESP-NOW and Ethernet to coexist on safe boards.

  6. blazoncek commented on May 30, 2025

    @blazoncek
    Contributor

    Are you aware of any boards with independent clock signal supported by WLED? I am not. All of the supported boards use ESP's clock generator AFAIK.

  7. Arcitec commented on May 30, 2025

    @Arcitec
    ContributorAuthor

    Are you aware of any boards with independent clock signal supported by WLED? I am not. All of the supported boards use ESP's clock generator AFAIK.

    I have seen one board that seems to use an external crystal, but this example was purely from memory since I remembered being curious and clicking this link once:

    // https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-Series/blob/master/schematic/T-POE-PRO.pdf

    That link has been moved here nowadays:

    https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-Series/blob/master/schematic/T_POE_Pro(Final).pdf

    Download the schematic file, since GitHub is terrible and doesn't let you zoom PDFs to see the details.


    You can see in the top left corner that they're connecting a 25 MHz crystal and its supporting components to the XTAL1/XTAL2 pins (which are for interacting with both poles of external crystals). The 8720A ethernet chip is capable of operating with either 25 MHz or 50 MHz (preferable) external crystals, and this board chose a 25 MHz crystal.

    If you use a pure ESP32 clock, you would not need to connect both XTAL1 and XTAL2. Therefore, this board schematic definitely uses an external crystal. You can even see the crystal (marked "Y1") on the schematic.

    However, looking closer at it... the board still requests a 50 MHz ESP32 clock to go out via GPIO0, and then passes it into a TI SN74AUP1T14 logic inverter gate. Which makes sense since the GPIO0 pin has the opposite PLL clock polarity than the GPIO17 pin. So they are also taking the ESP32 clock, fixing the polarity to make it the same as what would have come out of GPIO17, and then they do the strangest thing I can ever imagine: They combine the 25 MHz and 50 MHz clock signals on the exact same XTAL1/XTAL2 ethernet chip pins.

    So... on final inspection, the T-POE seems to be a misdesigned board that has totally failed to understand how to correctly hook up a LAN8720A chip, and uses both a crystal and the ESP32 signal. That schematic is a mess.


    Edit: Upon checking network.cpp, it seems highly likely that every WLED Ethernet board in the world uses GPIO0 or GPIO17, meaning the ESP32 PLL signal. So it seems like every board is indeed vulnerable.

  8. Arcitec commented on May 30, 2025

    @Arcitec
    ContributorAuthor

    Alright, I've analyzed the scenarios where users are affected, and which scenarios already mask/hide the issue. This also helps us understand why it hasn't been discovered sooner.

    The issue (a quick summary for anyone who's reading for the first time): Anytime the ESP32's WiFi radio ( is enabled while the ESP32 has been told to also communicate with an Ethernet chip, the ESP32 can freeze/hang or even crash. Because the WiFi radio interferes with the ESP32's clock signal output, which is used by most WLED Ethernet boards.

    There's only a few conditions in WLED's codebase where that hardware bug will be triggered. All of these scenarios below require a WLED board that has an Ethernet chip! It will not happen on WiFi-only boards!

    WiFi-network users:

    • 🔴 If the user connects to the board via WiFi, but the board ALSO has an Ethernet port (it doesn't matter if the cable is disconnected, it's still gonna trigger the bug), then the hardware issue is active. Because the ESP32 then initializes the Ethernet chip and talks to it for constant status updates. And since the user has enabled and is using the WiFi connection to control WLED, they'll constantly be feeding the Ethernet chip a broken PLL clock signal. So when the ESP32 continuously talks to the Ethernet chip to check "is a cable connected?", the Ethernet chip itself can be in a completely broken state due to the broken clock. It's unknown whether that broken state will be bad enough to periodically freeze the ESP32 CPU. It's possible that the Ethernet chip can survive having an unstable clock while it isn't actively transmitting anything via Ethernet, since the Ethernet chip then spends most of its time just checking "is a cable connected?", which is most likely a simple electrical check which doesn't care about exact timings.
      • There's also a pretty simple explanation as for why such users are able to successfully connect an Ethernet cable and switch over to ethernet wired mode anytime: When they plug in an Ethernet cable, they're most likely not actively using the WiFi control app at the moment, and the periodic WiFi announcement beacons are unlikely to happen at that exact moment either. Thus the WiFi signal is "calm" at that time, and the Ethernet chip has had time to reset itself and is currently receiving a stable PLL clock. It then detects that the cable is plugged in, and WLED then takes over and turns off the WiFi radio (as blazonczek discovered in an earlier message). Thereby reliably turning off the WiFi radio and resolving the conflict when the user finally connects a wired connection. There's definitely a few milliseconds during the Ethernet handshake where any sudden WiFi activity would crash the Ethernet chip though, but most users won't have any WiFi activity during that handshake.
    • 👍 Workaround: The users that own "WiFi + Ethernet" boards and ONLY want to use the WiFi connection type can totally work around the bug by setting WLED's "Ethernet Board Type" to "NONE", so that the ESP32 NEVER talks to the Ethernet chip, and therefore doesn't risk freezing whenever the Ethernet chip is receiving a bad clock signal. Basically, we just tell the ESP32 to ignore the Ethernet chip that's on the board, which means that even though the Ethernet chip is receiving a bad signal, the ESP32 doesn't communicate with the Ethernet chip at all - and therefore doesn't risk getting dragged down whenever the Ethernet chip gets corrupted!
    • 🧰 Improving the User Experience: We can detect that the WLED configuration has selected an "Ethernet Board Type", and that the user is connected via WiFi (no Ethernet cable is connected). Then we can display an information box in the WLED web UI, telling the user about the hardware bug, and recommending that they set "Ethernet Board Type" to "NONE" if they don't need the Ethernet port. This will make them totally immune to the hardware bug, as mentioned in the previous bullet point.

    Ethernet-network users:

    • When a user connects an Ethernet board via Ethernet, it turns out that WLED totally disables WiFi (turns off the radio and turns off WLED-AP via the WiFi.disconnect SDK API) after the Ethernet handshake is complete. So that scenario was already immune, because that's the exact solution recommended by Espressif: Turning off the WiFi radio to never trigger the bug when the ESP32 has been told to talk to an Ethernet chip.
    • 🔴 But if the user enables ESP-NOW, the WiFi radio is then re-enabled again, which triggers the hardware bug for that Ethernet user. Since very few people own ESP-NOW-based remotes, it was not discovered by anyone in the WLED community. And even the people who own an ESP-NOW remote may not have realized that the remote delay is very abnormal and was actually due to the ESP32 CPU freezing.
    • 🧰 Improving the User Experience:
      • It would be safer to reverse the logic at WLED bootup: "Is this an Ethernet board? Then try initializing the Ethernet connection first. If there's nothing on Ethernet after 100 milliseconds, then enable the WiFi antenna."
        • Reversing the logic so that WiFi starts out disabled at bootup on Ethernet boards would eliminate the risk that any WiFi activity would crash the Ethernet cable handshake during WLED's startup process. Such crashes can happen with the current arrangement (since WLED currently always starts with WiFi enabled, and is only disabled after Ethernet has fully connected).
        • It wouldn't protect against the same crash risk happening whenever the user connects an Ethernet cable later, after the board has already been powered for a while. Because in that situation, the WiFi radio would be activated at WLED startup (since no Ethernet cable is connected), and therefore WiFi would be active during the Ethernet handshake process (when the user suddenly plugs in an Ethernet cable), where it risks crashing/freezing the ESP32. But that scenario is unavoidable. And it's the less important of the two scenarios, since most people who use a wired WLED controller will keep it wired forever - so the most important thing is protecting the stability of the WLED startup process!
      • Most importantly of all, we must change WLED to forbid mixing ESP-NOW (WiFi) together with the Ethernet chip feature on vulnerable boards.
        • The "basic but heavy-handed" way to prevent dangerous mixing would be to restore the old WLED 0.14.x platformio flag which simply removed ESP-NOW in all Ethernet-capable WLED builds. That's kinda brutal though, because it would mean that newer boards with external crystals that have fixed the issue at a hardware level would not be able to connect ESP-NOW remotes, even though those boards would safely be able to handle it.
        • A much better solution would be the one I mentioned in the original post, which is to check "Is an Ethernet Board Type selected? Is that board type using ESP32 clock signal? Then disable ESP-NOW."
        • In fact, we can improve this solution further by having an error/info message box next to the "Enable ESP-NOW Remote Support" checkbox. If a vulnerable "Ethernet Board Type" is selected, we forcibly disable the ESP-NOW setting in the WLED settings handler (by forcing it to "off" during load/update/save cfg handling), and add a warning textbox to the GUI which says the following:
          • "You have selected an Ethernet Board Type which is affected by an ESP32 hardware bug that leads to crashes whenever WiFi (such as ESP-NOW) is used on ESP32 boards that contain an Ethernet chip. Therefore, ESP-NOW cannot be enabled on your board. However, if you aren't using your Ethernet port, then you can set your Ethernet Board Type to NONE. Then you will safely be able to use your board's WiFi and ESP-NOW features instead."

    So we're closer to having a better overview and plan for how to solve this... What do you think? Does anyone have ideas for any other solutions?

  9. Arcitec commented on May 30, 2025

    @Arcitec
    ContributorAuthor

    To support the addition of boards that will be using external clock crystals to fix the hardware bug, we will need to add a feature in the WLED source code, where network.cpp will be able to define an eth_clk_mode of None (by setting it to ETH_CLOCK_EXTERNAL, which could have the internal value -1).

    When clock mode is set to -1, WLED should then simply ignore the PLL output mode-setting, and let the board hardware deal with the PHY clock.

    I've looked through the ETH_CLOCK constants and see that there's only support for GPIO0, 16, and 17. No support for "None" yet:

    // eth_clk_mode defines the GPIO pin and GPIO mode for the clock signal
    // However, there are really only four configurable options on ESP32:
    // ETH_CLOCK_GPIO0_IN == External oscillator, clock input via GPIO0
    // ETH_CLOCK_GPIO0_OUT == ESP32 provides 50MHz clock output via GPIO0
    // ETH_CLOCK_GPIO16_OUT == ESP32 provides 50MHz clock output via GPIO16
    // ETH_CLOCK_GPIO17_OUT == ESP32 provides 50MHz clock output via GPIO17

    We'll also need to investigate how to tell the ESP32 SDK that the Ethernet clock is external, and that it shouldn't be controlled by the ESP32's PLL output. It's some flag in the ETH.begin call. Probably EMAC_CLK_EXT_IN, but the documentation is terrible:

    https://docs.espressif.com/projects/arduino-esp32/en/latest/api/ethernet.html

    Edit: In fact, it seems like all the GPIO clock constants used by WLED come from the ESP32 SDK. In that case, they already have a name for the "use external clock" constant somewhere in their SDK. Let's investigate and find the name inside the actual SDK headers, to confirm whether EMAC_CLK_EXT_IN is correct or not...

  10. Arcitec commented on May 30, 2025

    @Arcitec
    ContributorAuthor

    Here's something worth being aware of during all planning:

    • It's highly likely that future ESP32 revisions will try to fix the hardware bug, since they are very proud of their "ESP-NOW" protocol. So the fact that WiFi (such as ESP-NOW, AP feature etc) totally breaks the Ethernet clock signal is an unacceptable hardware flaw.
    • Right now, there's no newer revision, since the bug was found in August 2024. But I am sure that we'll see attempts at hardware improvements in the future.
    • Which would mean that we'll need some way to be aware of whether the user's hardware is fixed or not. There might be an ESP32 SDK call that can return the hardware revision version number, since ESP32's official errata literally lists which hardware revisions are vulnerable to various flaws. If so, WLED can very simply add a code check to say "if vulnerable ESP32 hardware version < 3.2 found", to make all mitigations conditional in the future. But if such an SDK call doesn't exist, then another method is needed to distinguish the working chips.
    • Of course... there's no way to know how long it'll take before new, bugfixed ESP32 chips come out, if ever. It could be a super hard issue at the hardware level, since deep, core parts of the chip need to deal with WiFi radio interrupts, and those are interrupting the PLL clock generator. Maybe they'll solve it. Maybe they won't. At least we know that Espressif are fully aware of the problem and its severity. But there's a worrying (and unclear) sentence in their errata page: "No fix scheduled". Which either means "They are not developing a fix for it", or "They have scheduled development for it but there's no fix for it yet". Due to the styling of the page, I suspect that they mean that a fix is in hw development.
  11. Arcitec commented on Jun 11, 2025

    @Arcitec
    ContributorAuthor

    While designing my own board, I now know exactly how we can identify Ethernet boards where we must block WiFi/ESP-Now:

    We can simply look at the available clock signal constants:

    https://github.com/espressif/arduino-esp32/blob/0f72681fa02f61cd2acf5025ea16451422c48c42/libraries/Ethernet/src/ETH.h#L83-L88

    Affected boards (can't enable WiFi/ESP-Now + Ethernet at the same time):

    • ETH_CLOCK_GPIO0_OUT (ESP32 provides 50MHz clock output via GPIO0) (Edit: As a sidenote, this is a terrible configuration for another reason, because the ESP32 PLL cannot generate a clock output on GPIO 0 when you use I2S peripherals such as microphones, so the GPIO0 OUT stops outputting anything when I2S is enabled. The other clock outputs (16/17 below) can do I2S at the same time.)
    • ETH_CLOCK_GPIO16_OUT (ESP32 provides 50MHz clock output via GPIO16)
    • ETH_CLOCK_GPIO17_OUT (ESP32 provides 50MHz clock output via GPIO17)

    Safe boards (these can enable WiFi/ESP-Now + Ethernet the same time):

    • ETH_CLOCK_GPIO0_IN (External oscillator, clock input received via GPIO0)

    The Ethernet MAC is in the ESP32 and the PHY is in the external chip (LAN87x0A etc). They must always be synced to the same clock. The ESP32 has only one mode that tells us that an external clock signal exists. That's ETH_CLOCK_GPIO0_IN.

    So this is the easy test condition:

    • If an ethernet board has been chosen:
      • And its clock value is ETH_CLOCK_GPIO0_IN, we will allow WiFi + Ethernet at the same time.
      • Otherwise, turn off and block WiFi/ESP-NOW. Because the clock signal for Ethernet is completely unstable until WiFi.disconnect has been called.
  12. github-actions commented on Oct 11, 2025

    @github-actions

    Hey! This issue has been open for quite some time without any new comments now. It will be closed automatically in a week if no further activity occurs.
    Thank you for using WLED! ✨

  13. added
    stale
    on Oct 11, 2025
  14. added
    keep
    and removed
    stale
    on Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughardwarekeep

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions