ESP32——Ethernet communication test based on LAN8720A

Reference link:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit.html#rmii-clock-sourced-externally-by-phyhttps://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit.html#rmii-clock-sourced-externally-by-phy

1. Introduction

This is a test record of an official example "examples\ethernet\basic".

Due to the selection of the ESP32-WROVER-IE-N8R8 module for future project requirements, the GPIO17 pin cannot be used and the common method of providing the clock to the PHY chip from the ESP32 cannot be used, which will be mentioned later.

2. Circuit diagram and program

This diagram is the final version, the first version does not have MT9700 related circuits.

Pin and PHY_ADDR address definitions

#define CONFIG_EXAMPLE_ETH_MDC_GPIO 23
#define CONFIG_EXAMPLE_ETH_MDIO_GPIO 18
#define CONFIG_EXAMPLE_ETH_PHY_RST_GPIO 15
#define CONFIG_EXAMPLE_ETH_PHY_ADDR 0

configuration item

3. Debugging

    The sample program can run, but it cannot be started normally after the first power-on. You need to press the reset button (usually you need to press it several times to succeed once). The official link provided at the beginning of this document explains the reason in detail. Simply put, if the power supply is not separated, LAN8720A will first output a 50MHZ clock to the GPIO0 port of the ESP32 module. The level cannot be stabilized at a high level, causing the module to fail to start and run. . After modifying the circuit diagram and the program (start the MT9700 first after powering on), test again, and it is normal.

Note: The following problems were encountered during the test. The reason is that the power ground of LAN8720A is located at the bottom of the chip, which was forgotten during soldering.

E (514) lan8720: lan8720_pwrctl(359): power up failed
E (514) lan8720: lan8720_init(421): power control failed
E (514) esp_eth: esp_eth_driver_install(205): init phy failed

Guess you like

Origin blog.csdn.net/tsliuch/article/details/129054210