Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Ethernet PHY KSZ8081/RNB and basic example (IDFGH-4775) #6578

Closed

Conversation

linkineo
Copy link
Contributor

I derived the driver written for the KSZ8041 to work for the KSZ8081 PHY. Actually required reading the vendor-specific PHY Control Register 1.
Could test it with the basic esp-idf ethernet example and got an IP over DHCP. Tested for 10/100Mbps, Half and Full duplex.
Could test all functions except ksz8081_negotiate(), for which I now only control the auto-negotiation status over the standard bmsr register as Microchip seems to have removed a second register as it was the case for 8041.

@CLAassistant
Copy link

CLAassistant commented Feb 19, 2021

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title Added support for Ethernet PHY KSZ8081/RNB and basic example Added support for Ethernet PHY KSZ8081/RNB and basic example (IDFGH-4775) Feb 19, 2021
@Alvin1Zhang
Copy link
Collaborator

Thanks for your contribution.

@RJPoelstra
Copy link

I can also confirm that this works.
Is it just me, or are the PHY control bit definitions for 8041 in the reverse order?

@suda-morris
Copy link
Collaborator

Well spotted @RJPoelstra! Yes, after I read the datasheet, confirmed that the bit definitions of pc2r_reg_t is wrong, will fix it ASAP

@espressif-bot espressif-bot added the Status: In Progress Work is in progress label Mar 12, 2021
@linkineo
Copy link
Contributor Author

Added support for using KSZ8081 in protocol examples. Tested with icmp_echo and mqtt/tcp.

@espressif-bot espressif-bot added Status: Done Issue is done internally and removed Status: In Progress Work is in progress labels Mar 31, 2021
espressif-bot pushed a commit that referenced this pull request Apr 1, 2021
@suda-morris
Copy link
Collaborator

Thanks for your contribution, we will close it as we have merged your PR in 98a4c70

@suda-morris suda-morris closed this Apr 2, 2021
@brandonros
Copy link

Can this be backported to a branch like release/4.3? Arduino doesn't compile without this.

CXX build/arduino/libraries/WiFi/src//ETH.o
/Users/brandonros/Desktop/esp-idf-v4.3/examples/get-started/sample_project/components/arduino/libraries/WiFi/src/ETH.cpp: In member function 'bool ETHClass::begin(uint8_t, int, int, int, eth_phy_type_t)':
/Users/brandonros/Desktop/esp-idf-v4.3/examples/get-started/sample_project/components/arduino/libraries/WiFi/src/ETH.cpp:174:23: error: 'esp_eth_phy_new_ksz8081' was not declared in this scope
             eth_phy = esp_eth_phy_new_ksz8081(&phy_config);
                       ^~~~~~~~~~~~~~~~~~~~~~~
/Users/brandonros/Desktop/esp-idf-v4.3/examples/get-started/sample_project/components/arduino/libraries/WiFi/src/ETH.cpp:174:23: note: suggested alternative: 'esp_eth_phy_new_ksz8041'
             eth_phy = esp_eth_phy_new_ksz8081(&phy_config);
                       ^~~~~~~~~~~~~~~~~~~~~~~
                       esp_eth_phy_new_ksz8041
make[1]: *** [libraries/WiFi/src//ETH.o] Error 1
make: *** [component-arduino-build] Error 2

@linkineo
Copy link
Contributor Author

My PR was based on 4.3 and compiling.
I also just compiled successfully the get-started/sample_project project.
I don't exactly get your setup, I see you have a componentssubfolder in the sample_projectfolder, which is not how things are organized in 4.3 or master branches (see here). I guess I would need some more details on how to reproduce your setup.

@Takashi426
Copy link

i am using ksz8061 i don't get ip address with in buit example code ethernet folder basic and i have add connectin as

GPIO17 - PHY_POWER : clock in
GPIO22 - EMAC_TXD1 : TX1
GPIO19 - EMAC_TXD0 : TX0
GPIO21 - EMAC_TX_EN : TX_EN
GPIO26 - EMAC_RXD1 : RX1
GPIO25 - EMAC_RXD0 : RX0
GPIO27 - EMAC_RX_DV : CRS
GPIO23 - SMI_MDC : MDC
GPIO18 - SMI_MDIO : MDIO
GND : GND
3V3 : VCC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants