Skip to content

Conversation

xorbit
Copy link

@xorbit xorbit commented Sep 8, 2025

Description

To be able to support Arduino development on the Silicognition ManT1S board, support for the espressif/lan867x driver first needs to be added to the Arduino Library.
Once the driver is available, support for the ManT1S will be added to the ESP32 Arduino Core.

This PR adds generic LAN867x driver support for chips that support the RMII PHY interface (ESP32 and ESP32P4).
It only touches main/idf_component.yml to pull in this component from the ESP Component Registry.

Related

Support LAN867x driver already supported in ESP-IDF through the ESP Component Registry.

Testing

It was checked that espressif/lan867x lib and include was (only) added to esp32 and esp32p4 output directories.

Local build of esp32-arduino-lib-builder with this addition was used to build Arduino firmware on local ESP32 Arduino Core patched to support the ManT1S board. Building succeeds and runs ETH_LAN8720 example unmodified when Silicognition ManT1S board is selected (ETH_PHY_MDC is defined for the board in the pins_arduino.h so the PHY config in the sketch is ignored and the one defined for the board is used).

The code runs and produces the expected output when connected to a ManT1S-Bridge to provide Internet access:

ETH Got IP
*eth0: <UP,10M,ADDR:0x0> (DHCPC,GARP,IP_MOD) PRIO: 50
      ether F0:24:F9:9E:1D:5B
      inet 192.168.1.190 netmask 255.255.255.0 broadcast 192.168.1.255
      gateway 192.168.1.1 dns 192.168.1.1


connecting to google.com
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-aOCnSAoP8-PrQ5wC-FdnLQ' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
Date: Mon, 08 Sep 2025 22:21:03 GMT
Expires: Wed, 08 Oct 2025 22:21:03 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
closing connection

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

To be able to support Arduino development on the
[Silicognition ManT1S](https://www.crowdsupply.com/silicognition/mant1s)
board, support for the espressif/lan867x driver first needs to
be added to the Arduino Library.

Support for the ManT1S can then be added later to the ESP32
Arduino Core.

This PR adds generic LAN867x driver support for chips that support
the RMII PHY interface (ESP32 and ESP32P4).
@me-no-dev
Copy link
Member

I suggest you add this to the Arduino's configuration instead https://github.com/espressif/arduino-esp32/blob/master/idf_component.yml and also add the appropriate changes to the ETH driver (header and implementation) https://github.com/espressif/arduino-esp32/blob/master/libraries/Ethernet/src/

@xorbit
Copy link
Author

xorbit commented Sep 10, 2025

Adding it to the Arduino core's idf_component.yml was what I tried first but I didn't work.

Are you seriously suggesting to duplicate the driver code from the ESP Component Registry in the Arduino source, instead of pulling in the existing component? That seems like an absolutely horrible thing to do.

@me-no-dev
Copy link
Member

Are you seriously suggesting to duplicate the driver code from the ESP Component Registry in the Arduino source, instead of pulling in the existing component? That seems like an absolutely horrible thing to do.

Nothing of the sort. I do not know why it didn't work for you to add it to Arduino's idf_component.yml as you can see all other components there. Probably something went wrong while you were building the libs. Component should be added there and then ETH lib should be adjusted to support that driver, just like it's done for all other drivers.

@xorbit
Copy link
Author

xorbit commented Sep 11, 2025

I tried it again and it doesn't work. I even deleted my ~/.config/arduino-ide to make sure nothing was being cached.

Added:

  espressif/lan867x:
    version: "^2.0.0"
    rules:
      - if: "target in [esp32, esp32p4]"

to the main arduino-esp32 idf_component.yml, deleted ~/.config/arduino-ide to make sure, started Arduino. Chose my new board from ESP32 Arduino (in Sketchbook) (espressif) (which links to my local repo), hit Verify and got:

/home/xorbit/Projects/Arduino/hardware/espressif/esp32/libraries/Ethernet/src/ETH.cpp:38:10: fatal error: esp_eth_phy_lan867x.h: No such file or directory
   38 | #include "esp_eth_phy_lan867x.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

When I point the esp32-arduino/tools/esp32-arduino-libs instead to the out/tools/esp32-arduino-libs output of the custom-built libraries generated with this PR, it builds and works fine.

What am I missing? I do not understand at which point the Arduino IDE is supposed to go out and get the component from the ESP component registry if it's called out in the main arduino-esp32 idf_component.yml.

@me-no-dev
Copy link
Member

you have probably updated the yaml in the wrong Arduino code. You should update the one in your lib-builder/components/Arduino and do the other changes in your hardware/espressif/esp32 after copying the libs to it

@xorbit
Copy link
Author

xorbit commented Sep 16, 2025

Ok I think I see. Arduino pulls in a library built from this repo, but building the library pulls in Arduino and its idf_component.yml to pull in additional components while building the library. Correct?

Do you recommend I do a PR in arduino-esp32 that includes both the changes to idf_component.yml and adds the board, or just do the change to idf_component.yml in its own PR and do a separate PR for the new board that uses it?

@me-no-dev
Copy link
Member

Here is the pull request and changes to add support for this chip in Arduino: espressif/arduino-esp32#11843

You should add a new pull request after this one is merged for your board. Make sure that you define this and all other necessary thing for ETH in pins_arduino.h

#define ETH_PHY_TYPE ETH_PHY_LAN867X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants