Replies: 11 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.
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_initialize
which 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