-
It's been a while since I last looked for answer to this question (last being mp version 1.17). I still couldn't quite find an answer. Here is a recent post, related to LAN8720 chip with ESP32. The OP had to compile micropython using IDF V 4.x. That's a very long route. I've done IDF V3.3 and V4.x projects for quite some time but also was a while ago. Now that 1.20 is out, I see this exciting release node blurb: "The esp32 port now uses synchronous BLE events which allows support for BLE pairing and bonding. The LAN driver adds support for LAN8710, KSZ8081, configuration of ETH ref_clk pin, and support for SPI-based Ethernet chips. " https://github.com/micropython/micropython/releases/tag/v1.20.0 And I was able to find corresponding doc under ESP32 1.20 as well: https://docs.micropython.org/en/v1.20.0/esp32/quickref.html#lan So I wonder if anyone has test driven this release with ethernet support yet. I'll post my progress in case someone else comes along with the same question. |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 87 replies
-
Yes, the ESP32 port supports Ethernet. Either via external SPI MAC (e.g. wiznet) (this is new in 1.20), or with the internal MAC using just an external PHY (this has been supported for a while). e.g. on one of the espressif dev-kit boards. |
Beta Was this translation helpful? Give feedback.
-
Hi @jimmo Thanks for confirming. I could only see how to use the LAN8720 with the official document I linked to. Is there any document on using SPI MAC such as wiznet ws5500? Thanks. |
Beta Was this translation helpful? Give feedback.
-
OK I seem to have found some answers, under network document: https://docs.micropython.org/en/v1.20.0/library/network.WIZNET5K.html The doc says "The particular chipset that is supported by the firmware is selected at compile-time via the MICROPY_PY_NETWORK_WIZNET5K option." So I assume that this option wasn't turned on with the regular 1.20.bin firmware. I checked network:
So WIZNET5K isn't defined, confirmed with trying to run it and getting undefined. So is there any compiled firmware that has WIZNET5K enabled that I can download? Thanks. |
Beta Was this translation helpful? Give feedback.
-
Thanks @jimmo Proper documentation is always highly appreciated as I hate to guess out things with source code. I'm a c/c++ developer with plenty of python experience but I've never written c/c++ code to make python stiff, i.e. the MP ESP32-IDF project. For MP ESP32-IDF developers, is the VSCODE plugin working now? When I was working with IDF 3.3, there wasn't such plugins. Then when I transitioned to IDF 4.x (not yet 4.4), VSCODE plugin was there but broken so I used eclipse IDE with plugin, which is extremely slow. If getting set up with the development toolchain isn't too hard, I can dive in and dome some work. At least add some comments. The code as it stands, is very bare (minimal comments): https://github.com/micropython/micropython/blob/master/ports/esp32/network_lan.c |
Beta Was this translation helpful? Give feedback.
-
A working example is in this WIP MR for the Ribbit Network Sensor. It is using the a POE Featherwing based on a W5500, attached to a Adafruit ESP32-S3 feather: spi = machine.SPI(
1,
sck=machine.Pin(36),
mosi=machine.Pin(35),
miso=machine.Pin(37),
)
iface = network.LAN(
phy_type=network.PHY_W5500,
phy_addr=1,
spi=spi,
cs=machine.Pin(10),
int=machine.Pin(12),
) |
Beta Was this translation helpful? Give feedback.
-
Other boards and SPI chip combinations (KSZ8851SNL, DM9051) should work in a similar way. You need to configure the SPI interface correctly, know the SPI address and the Chip Select pin, and typically you need an Interrupt pin from the chip, which some boards might or might not have wired up by default. I only had access to this particular Adafruit Feather + POE Featherwing combination while implementing this, the rest of the support comes from the example implementation in ESP-IDF. |
Beta Was this translation helpful? Give feedback.
-
Thank you @damz I have a standalone W5500 module I can test. Would you be willing to share a compiled .bin for ESP32 WROOM processors? Or is it possible to install or update the network component on a bin that has w5k not enabled? I have a regular ESP32 feather. I'll do my best to set up my toolchain to compile mp but that's really a long route to get this feature. |
Beta Was this translation helpful? Give feedback.
-
I forgot to ask. What is the preferred tool chain for mp development? Is it VSCODE or is it something else? I'm reading on contributor's guide etc. to hopefully figure that out. Is it the make method? I know it's popular but not so much with ESP-IDF since V3.3. Last time I checked, it was ninja. I also have a question on LANN8720 chips. With this chip, I must dedicate all 10 RMII pins to it, so only having about 14-16 pins left (depending on wrover or wroom), correct? |
Beta Was this translation helpful? Give feedback.
-
Hope add |
Beta Was this translation helpful? Give feedback.
-
FWIW, https://github.com/przemobe/micropy-ENC28J60 works with the ENC28J60 adapter. I used "MicroPython v1.22.1" on a Raspberry Pi Pico, in case google brings anyone here. It was my first step with Ethernet and MicroPython and a solid one at that. ( I know it's not esp32 ) |
Beta Was this translation helpful? Give feedback.
Did you also modify
mpconfigboard.cmake
to point toboards/PINNACLE_GENERIC_SPIRAM/sdkconfig.board
?