ESP32 + LAN8720 (Connection failed)

haythemjls
Posts: 27
Joined: Mon Apr 06, 2020 1:32 pm

ESP32 + LAN8720 (Connection failed)

Postby haythemjls » Fri Nov 12, 2021 9:01 am

Hello,
I'm working on a project based on ethernet communication via ESP32 + LAN8720 module. I tried to follow two hardware configuration:

-Configuration 1 : (using external clock 50 MHz)

#include <ETH.h>
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN //(4k7 pullup)
// Pin# of the enable signal for the external crystal oscillator
#define ETH_POWER_PIN 17 // (phy_power 4k7 pulldown and extra wire to enable pin)
// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE ETH_PHY_LAN8720
// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR 0
// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN 23
// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN 18



-Configuration 2 : (using internal clock 50 MHz from GPIO17 or GPIO16 or GPIO0)

#include <ETH.h>
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)
#define ETH_POWER_PIN -1
// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE ETH_PHY_LAN8720
// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR 0
// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN 23
// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN 18


Despit these tow configuration, I failed to make the communication succeed and always I get this message :
E (1024) emac: Timed out waiting for PHY register 0x2 to have value 0x0007(mask 0xffff). Current value 0xffff
E (2024) emac: Timed out waiting for PHY register 0x3 to have value 0xc0f0(mask 0xfff0). Current value 0xffff
E (2024) emac: Initialise PHY device Timeout


Any help please.

RabbitRF
Posts: 15
Joined: Tue Mar 01, 2022 12:28 am

Re: ESP32 + LAN8720 (Connection failed)

Postby RabbitRF » Sat Mar 19, 2022 7:59 am

I use LAN8720 with STM32 MCU for other project, it get problem with harmonics and hard to pass EMC standard.
I'm thinking to use ESP WiFi + Ethernet feature.

You are welcome to share experience.

There is ESP32 Ethernet Module, are you using this for start up?

ESP_ondrej
Posts: 166
Joined: Fri May 07, 2021 10:35 am

Re: ESP32 + LAN8720 (Connection failed)

Postby ESP_ondrej » Wed Mar 23, 2022 7:41 am

Hi RabbitRF,

do you use some development board or custom one?

For start you can try the following:
1) Check the hardware if all signal paths are routed and connected correctly.
2) Check if the PHY address configured in Kconfig aligns with bootstrap option of LAN8720.
3) Check if the LAN8720 is properly clocked.

You can try ESP32 Ethernet Kit as metioned by RabbitRF, if it meets your use case.

Who is online

Users browsing this forum: Google [Bot] and 24 guests