Hi,
I would like to add support for the PHY LAN9303 because it would add 2 LAN Ports to the ESP32 (bridged or separated) beside V-LAN etc...
So first question is there already development ongoing into this direction?
In the docs I found the already supported PHYs which does not include the LAN9303 but the sentence other support can be added by the users. Is there a example / documentation how to add new PHYs? Just clone the IDF an add a new source code file to esp-eth?
or is there a components approach too?
I had a look at the source of esp-eth and the handling of the phy and the mac is completely separated. This shoud work fine for the most PHYs as they are just forwarding the data to the MAC. If I understood the datasheet of the LAN9303 right, it's connected as PHY but there is also MAC functionality in it. At least I would need to add the MAC address of the ESP to the integrated switch to make communication work. But the SMI communication is done by the phy part and MAC address etc is stored in the mac part.
Due to the structure of eth_hanlde_t is not public to pass it to an separate util to configure the switch. What would be the best way to archive this without patching around in the whole IDF?
Thx
Adding support for LAN9303 PHY to IDF
Re: Adding support for LAN9303 PHY to IDF
Hello,
Has anyone managed to get the LAN9303 Working with the ESP32? I'm want to give it a try, but don't want to go into a dead end path if it doesn't work. I see the LAN9303 Switch can work as a virtual device in which should be transparent from the ESP32 side. But I'm not sure about the command/register addressing for the device and how they differ from the LAN8720.
Has anyone managed to get the LAN9303 Working with the ESP32? I'm want to give it a try, but don't want to go into a dead end path if it doesn't work. I see the LAN9303 Switch can work as a virtual device in which should be transparent from the ESP32 side. But I'm not sure about the command/register addressing for the device and how they differ from the LAN8720.
Re: Adding support for LAN9303 PHY to IDF
Hi!
Yes! Actually, I just got a board design with the LAN9303 to work! In terms of the IDF, it is very similar to the LAN8720. Only 1 register (that is used) is different - the PSCSR(PHY Special Control Status Register). Which, is still mostly the same. The only functional difference is in the function lan8720_negotiate, where it polls this PSCSC for a pscsr.auto_nego_done - which the LAN9303 does not have. So just edit out this check! I've attached the modified esp_eth_phy_lan8720.c below.
As for the hardware setup, the strapping pins on the 9303 are pretty important - so I've attached my hardware schematic. But basically, you need to set it up as a PHY RMII/SMI/CLKOUT-16ma.
LAN9303
https://drive.google.com/file/d/1r2MEXE ... sp=sharing
ESP32
https://drive.google.com/file/d/1tY9rww ... sp=sharing
esp_eth_phy_lan8720.c (Changes Denoted by //EDIT ... //END EDIT)
https://drive.google.com/file/d/12SKOgl ... sp=sharing
Hopes this helps!
-Coach Chuck
Yes! Actually, I just got a board design with the LAN9303 to work! In terms of the IDF, it is very similar to the LAN8720. Only 1 register (that is used) is different - the PSCSR(PHY Special Control Status Register). Which, is still mostly the same. The only functional difference is in the function lan8720_negotiate, where it polls this PSCSC for a pscsr.auto_nego_done - which the LAN9303 does not have. So just edit out this check! I've attached the modified esp_eth_phy_lan8720.c below.
As for the hardware setup, the strapping pins on the 9303 are pretty important - so I've attached my hardware schematic. But basically, you need to set it up as a PHY RMII/SMI/CLKOUT-16ma.
LAN9303
https://drive.google.com/file/d/1r2MEXE ... sp=sharing
ESP32
https://drive.google.com/file/d/1tY9rww ... sp=sharing
esp_eth_phy_lan8720.c (Changes Denoted by //EDIT ... //END EDIT)
https://drive.google.com/file/d/12SKOgl ... sp=sharing
Hopes this helps!
-Coach Chuck
-
- Posts: 2
- Joined: Fri Oct 29, 2021 1:28 am
Re: Adding support for LAN9303 PHY to IDF
@CKH12358
Thanks a lot, this example you be very useful for a upcoming project.
Thanks a lot, this example you be very useful for a upcoming project.
Who is online
Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 375 guests