Replies: 13 comments 7 replies
-
|
This PHY is RMII. The mode you mention is for MII. From TRM, on RMII chapter:
|
Beta Was this translation helpful? Give feedback.
-
|
Hi, I have the same issues and am trying to find the solution, could you show me how to init RMII clock in the function "mdio_esp32_initialize" |
Beta Was this translation helpful? Give feedback.
-
|
@iwasz Can you share your project .dts file? I guess you are missing setting the proper GPIO17 pin using |
Beta Was this translation helpful? Give feedback.
-
|
You can try adding the following configs in your .dts file: ð {
phy-handle = <&phy>;
phy-connection-type = "rmii";
ref-clk-output-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
}; |
Beta Was this translation helpful? Give feedback.
-
|
Hey guys my DTS is like this: But the issue is that MDIO wasn't properly initialized, and the clock signal wasn't generated at the point when driver was querying registers 2 and 3 (PHY Identifier 1 and PHY Identifier 2 registers). All I did was adding: emac_hal_init(&dev_data->hal, NULL, NULL, NULL);
emac_hal_iomux_init_rmii();
emac_hal_iomux_rmii_clk_output(/* ref_clk_gpio */17);
emac_ll_clock_enable_rmii_output(dev_data->hal.ext_regs);
rtc_clk_apll_enable(true, 0, 0, 6, 2);to the |
Beta Was this translation helpful? Give feedback.
-
|
Initial fixing PT: #74442 |
Beta Was this translation helpful? Give feedback.
-
|
I'm likewise trying to get this working on an Olimex ESP32-POE that has a LAN8710 Phy and uses GPIO17 for phy clock. Still getting:
|
Beta Was this translation helpful? Give feedback.
-
|
(currently building @sylvioalves PR branch from #74442) I instrumented the various drivers to understand the order of init better: The Changing CONFIG_PHY_INIT_PRIORITY to 81 (after eth) causes the following compile error: I've tried moving the clock init code to the mdio driver as @iwasz did, but currently hanging on startup. |
Beta Was this translation helpful? Give feedback.
-
|
Someone made the following comment on discord:
I have tested the STM32 -- it works with phy clock generated on the MCU, but have not had time to see how they set things up. |
Beta Was this translation helpful? Give feedback.
-
|
@sylvioalves would it work to move the |
Beta Was this translation helpful? Give feedback.
-
|
@sylvioalves Hey can you check out my PR #75024 ? It's kind of a request for comments, as this is my first PR here and I'm not convinced myself if duplicating your function is the best option (probably not). But anyway I wanted your opinion. TLDR : I did what @cbrake proposed, and tested it on my setup (against samples/net/mqtt_publisher sample). Without it the network doesn't work for me because I'm using a PHY that requires a REF_CLK during HW reset and MDIO communication. However the order of initialization is:
Right now REF_CLK on GPIO17 is enabled in the last of these 3, and so phy_mii.c is not able to read PHY ID (register 2 and 3). Thus PHY communication fails, and we get errors like "phy_mii: PHY (1) ID FFFFFFFF" or "phy_mii: No PHY found at address 1". I tried to set ETH_INIT_PRIORITY to 50 but in the DTS eth node depends on phy node, thus building fails saying priorities are wrong. |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone, Following up on the ongoing challenges with the WT32-ETH01 and LAN8720A initialization, I’m trying to determine the most architecturally appropriate "Zephyr way" to handle the physical design flaw on these boards. The Core Issue: As noted in this thread, generic clone boards like the WT32-ETH01 tie the LAN8720A's In researching how different projects within the ecosystem mitigate this, I’ve found four distinct approaches. I would love to hear from the maintainers or community on which of these is considered best practice, or if a better 5th option exists (for example, to implement board-specific PHY reset/clock sequencing support via Devicetree properties handled in the ESP32 Ethernet driver). 1. The Declarative Fix: Device Tree
|
Beta Was this translation helpful? Give feedback.
-
|
Thank you @sylvioalves — I see ref-clk-output-gpios was already pointed out in this thread, and I apologize for not referencing it in my summary above. That said, I'm still slightly lost on what the canonical path forward looks like in practice, so let me sharpen my question. Two things I left out of my earlier analysis that seem relevant: 5 PR #75024 (by @iwasz, the original author of this thread)Proposes moving RMII clock initialization into the MDIO driver itself, which would fix the root cause for everyone rather than pushing the workaround into application code or Device Tree. @cbrake confirmed it working on Olimex ESP32-POE. Is this the right place to land this fix for mainline? 6. Separate reset-gpios + clock-gpios pinsMy Option 4 (hardware cut) is only the enabling step — the real benefit is that once GPIO 16 is decoupled, Zephyr's standard DT bindings work exactly as designed, with no application workarounds at all. This is probably worth separating from the "PCB modification" framing. So my concrete questions are:
Thanks again! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear community
A custom board that I have to program (not my design, can't modify it) consists of an ESP32-WROOM-32 and a LAN8720A Ethernet phy. Unfortunately the PHY has no crystal, but GPIO17 is used to provide 50MHz RMII clock from ESP32 MAC to the PHY. Recently a PR enabled this, but then my board always reported:
This was because reading a MDIO register would now always return 0xffff... in
phy_mii_initialize. I figured out, that for some reason my MDIO calls don't work until the RMII clock is enabled, which doesn't happen until eth is initialized (the order is mdio, then phy, then eth). Everything works fine when I initialize rmii clock in themdio_esp32_initializewhich boils down to adding the stuff from the PR I linked to themdio_esp32_initialize.I have no experience with MDIO and RMII so maybe I'm missing something obvious (like Kconfig option)?
Beta Was this translation helpful? Give feedback.
All reactions