ESP32-Gateway rev H. ETH_LAN8720 with micropython

Started by BenoitS, April 16, 2022, 05:00:30 PM

Previous topic - Next topic

BenoitS

Hello,

it have the same issue as here but with micropython.

LAN 8720 is usable with micropython V1.14 and IDF 3.X, but not with V1.18 and IDF 4

For micropython V1.14, I'm using successfully following instruction:
network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), power = machine.Pin(12), phy_type = network.PHY_LAN8720, phy_addr = 0, clock_mode = network.ETH_CLOCK_GPIO17_OUT)

For micropython, I didn't find any solution, even with patching micropython and/or idf sources.

Is there any solution as you provide for arduino ? It could allow to use last improvement of micropython.

Regards,
Benoit

LubOlimex

Report it to the Micropython team.

Make sure to properly report your ESP32-GATEWAY board. There is huge difference for the Ethernet circuitry between revisions:

- ESP32-GATEWAY GPIO pinout Rev.A to Rev.E - the circuitry is similar to ESP32-EVB boards
- ESP32-GATEWAY GPIO pinout Rev.F and up - Ethernet circuitry is similar to ESP32-POE and ESP32-POE-ISO - clock source moved from GPIO0 to GPIO17 and GPIO5 added as ethernet power on/off pin
Technical support and documentation manager at Olimex

BenoitS

Hello,
so I found myself the solution. With ESP IDF V4, LAN8720 Clock setting can't anymore be defined during runtime. They shall be fixed during micropython build.

As nobody publish micropython V1.18 for ESP32-POE, you need to do it yourself.
For that you need:
- to install an arm compiler:
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

- to get and install esp idf sources :
https://docs.micropython.org/en/latest/esp32/tutorial/intro.html
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/build-system.html

- to get and install micropython sources
- to create a new build with specific LAN8270 (clock output on GPIO17)

- to flash it

And finally initialize Ethernet with
lan = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), power = machine.Pin(12), phy_type = network.PHY_LAN8720, phy_addr = 0)


It's quite complex for a beginners with an esp32, and publishing a micropython build easily usable would be welcomed
Regards,
Benoit