November 08, 2026, 01:36:40 AM

ESP32-P4 micropython port

Started by kerekesg, October 26, 2025, 01:26:53 AM

Previous topic - Next topic

kerekesg

Just in case anyone would need to run micropython on the ESP32-P4, you can get a build firmware from here:

https://codeberg.org/kerekesg/micropython-olimex-esp32-p4

AI helped me, but it works well on my Olimex ESP32-P4 board.

LubOlimex

Thank you for this, I am sure someone will find it helpful!
Technical support and documentation manager at Olimex

puhuri

I was testing ESP-P4-DevKit (rev D1) ethernet on micropython. Seems that I cannot find the right set of parameters to initialize connection.

With vanilla Micropython ESP32_P4 v1.29 (PRE_V3 variant:(sysname='esp32', nodename='esp32', release='1.29.0', version='v1.29.0 on 2026-08-24', machine='Generic ESP32P4 with pre revision 3 chip with ESP32-P4')) the error message is OSError: esp_eth_driver_install failed with invalid argument for all the cases.

With kerekesg firmware (sysname='esp32', nodename='esp32', release='1.27.0-preview', version='v1.27.0-preview.339.gbe4892097e.dirty on 2025-10-23', machine='Olimex ESP32-P4-DevKit with ESP32-P4') the error is a bit more useful:

E (30570) esp_eth: esp_eth_driver_install(209): can't set eth->mac or eth->phy to null
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
I've tried several intialization parameters but no luck (leaving some parameters out and trying out variations). The most correct I think is (based on schematic and micropython source):

lan=network.LAN(0, mdc=Pin(31), mdio=Pin(52), phy_type=network.PHY_IP101, phy_addr=1,  reset=Pin(51), ref_clk=Pin(50), ref_clk_mode=0)
but that fails with above error. With kerekesg firmware there seems to be an issue with GPIO configuration as Pin(52) results "ValueError: invalid pin" (Pin(32) works fine, for example).

The ref_clock_mode is a bit guess, 0 is input AFAIK but tried also 1.

Would just want to use wired network connection for a location as the wifi connection there is a bit spotty.

Have not yet tried to compile own firmware (with updated micropython), just trying to first check that it is not something trivial I'm missing here.