ports/rp2/boards: Add WIZnet-EVB-boards and wiznet6k submodule - #18035
wiznet-grace wants to merge 1 commit into
Conversation
2235bff to
9f9fb87
Compare
|
Code size report: |
8dbf4bc to
7a8344d
Compare
|
|
||
| ``` | ||
| >>> import network | ||
| >>> nic = network.WIZNET5K() |
There was a problem hiding this comment.
| >>> nic = network.WIZNET5K() | |
| >>> nic = network.WIZNET6K() |
... and presumably the same in the other W5K examples below?
An example demonstrating the use of an explicit call to SPI/PIO_SPI might be nice too, as that allows the default speeds to be overridden... last time I tried this the SPI and PIO_SPI constructor calls weren't 100% compatible.
There was a problem hiding this comment.
Thank you for pointing this out
You are right — I missed updating the README. I’ll fix this and add the correct README sections for each board.
I’ll also update the examples to use WIZNET6K() and add explicit SPI/PIO-SPI initialization examples as you suggested.
Thanks again for the helpful feedback!
d1e15d5 to
8653aae
Compare
|
See #18024. The existing wiznet5k code does not propagate the hostname when using DHCP. I also identified that when the hostname is set by the DHCP server (such as dnsmasq), it is ignored by LWIP (so not just the wiznet drivers), but it is possible to workaround that by sending a DNS request for the assigned IP to get the hostname, and then set it. |
Thank you for pointing this out! I’ve revised the code accordingly and will push the changes again. To summarize the modifications:
In this mode, the DHCP hostname is taken from MicroPython’s modnetwork layer. By default it uses the value defined in the board configuration (mpconfigboard.h via MICROPY_PY_NETWORK_HOSTNAME_DEFAULT), and it can also be overridden at runtime in Python with network.hostname("...").
In this mode, the DHCP client logic comes from ioLibrary. Here, the hostname is hardcoded as "WIZnet" with the last 3 bytes of the MAC address appended, resulting in something like WIZnetABC123. As seen in Wireshark captures, DHCP Option 12 is always set in this format. In summary:
Thanks again for highlighting this—it helped clarify the difference between the two paths. |
3faaedd to
c43f168
Compare
|
I just tested this applied against the 1.26.0 release version, with just an RPi Pico and a W5500 module on a breadboard, and now Also - I noticed an extreaneous 2.5mb ports/rp2/build_log.txt file in the diff which I assume should not be there. edit: I changed the MAC on the module so it would get a new lease but it still didn't seem to send out the hostname to the router. Very possible I just configured my board variant wrong however. Still maybe worth other testing |
Thanks a lot for testing this! And thanks for pointing out the stray ports/rp2/build_log.txt file — that was accidentally included. I’ll delete it right away. |
c43f168 to
a4af5ef
Compare
I just reviewed the details you added.
So the device is already sending the Host Name correctly. This means the issue is more likely on the router configuration or firmware behavior side rather than on the device code. |
This should probably be moved from this pull request to a discussion instead. |
|
@Lobo-T , thanks a lot for the fast feedback. I didn't know there were pico 2 chips with only 2MB of Flash.... |
0821ce2 to
408ef41
Compare
|
Hello. @tofDE. Because the MicroPython firmware for RP2350 with W5500 support is larger than the original, we have allocated the maximum possible space for the filesystem, which results in the current 1.4MB (1408KB) storage limit. Also, while investigating this, I noticed a small typo in the ports/rp2/boards/W5500_EVB_PICO2/board.json file and have corrected it. Thanks for your valuable feedback! |
408ef41 to
e0768ba
Compare
|
Rebased this PR onto latest master at 4319927. Resolved the ports/rp2/CMakeLists.txt merge conflict, and I’ve re-run builds/tests locally to confirm everything is working. Force-pushed, so commit SHAs have changed. |
|
Hi @dpgeorge, I'd like to add two additional commits to this PR:
Would it be okay to include these in this PR? Happy to split into a separate PR if you'd prefer. |
72b9ccb to
b05f9a5
Compare
|
Rebased onto latest master (b05f9a5). Resolved conflicts in Also aligned all 9 WIZnet EVB boards to consistently set |
b799301 to
4671b80
Compare
|
Rebased onto master and force-pushed with the fixes amended in. This addresses a W6300-EVB-Pico2 report where
Basic ethernet operation confirmed on all boards. |
|
Thanks @wiznet-grace It took me a while to work out this PR (4671b80) doesn't apply cleanly on current master (b006887) but does apply clean on the older commit 06bcfd5 from 1 August 2026 - dunno what the problem is, but this PR may require another small rebase? I've built this PR for all the supported boards, no issues. I've tested it on Unfortunately I don't have the time to review the source code in detail. @dpgeorge is there any chance of this landing soon? I'm sure that would make a lot of people very happy! Thanks. 😃 |
Signed-off-by: wiznet-grace <Grace@wiznet.io>
4671b80 to
0db4474
Compare
Rebased onto current master (b006887) — the rebase is the only change, no code Thank you for the builds and the hardware testing, it's always appreciated. |
MilhouseVH
left a comment
There was a problem hiding this comment.
PR applies cleanly, builds and works fine on the following boards:
W5500_EVB_PICO
W5500_EVB_PICO2
W55RP20_EVB_PICO
W6300_EVB_PICO2
Many thanks Grace! 👍
|
I really hope this finally lands in 1.30... it's missed the cut enough times to perhaps start thinking there's some sort of agenda against it. \o/ |
projectgus
left a comment
There was a problem hiding this comment.
Thanks @wiznet-grace for keeping this PR up to date for so long, and sorry it's taken so long to review it.
One reason it's taken so long is that it is a very big PR that touches multiple parts of MicroPython and adds multiple features.
Do you think it could be possible to split it up? Maybe as 3 PRs in order:
- Add Wiznet6k driver for W6xxx chips and boards only. I think we could merge this PR quite quickly.
- Add PIO_SPI driver. I have some questions below about whether this is a "Wiznet" feature, or a feature we add on the rp2 port for general use.
- Update Wiznet5k driver to use Wiznet6k code, PIO_SPI driver. This raises some complex questions (also below).
Splitting the PRs up will be more work at the beginning, but it'd be a lot easier for us to review and merge each one.
I've left some inline comments but I haven't reviewed everything because this PR is so big. From the high level view, some other things to consider:
- The new Wiznet6k driver will need documentation (i.e.
docs/library/network.WIZNET5K.rstequivalent). - Need to understand what the future for Wiznet5k driver is, and how we manage backwards compatibility and documentation so this is clear for users. Using different drivers for the same chip on different boards isn't really an option.
- Has the new W6xxx support been tested on any ports apart from rp2?
| } mp_machine_soft_spi_obj_t; | ||
|
|
||
| // PIO QSPI object. | ||
| typedef mp_machine_soft_spi_obj_t machine_wiznet_pio_spi_obj_t; |
There was a problem hiding this comment.
extmod/ is generally for cross-port machine features. If I understand correctly, the "Wiznet PIO SPI" function is only relevant for rp2 port.
Is there anything Wiznet-specific about this class? For MicroPython, it seems like it would make more sense to:
- Add a
machine.PIOSPIobject to the rp2 port, that can be used anywhere that regularmachine.SPIcan be used. - Add support to the Wiznet driver to accept any "SPI object" as the driver, including the "PIOSPI" object.
What do you think?
I'm not necessarily saying you have to make this change for this PR, but if we're adding these features then it's important for us to think about how it works for the whole of MicroPython and not just the Wiznet drivers.
There was a problem hiding this comment.
Agreed. I'll rework it as a general-purpose PIO SPI rather than a WIZnet-specific one, and submit that as a separate PR.
| #if _WIZCHIP_ < W5200 | ||
| uint8_t sn_size[8] = {8, 0, 0, 0, 8, 0, 0, 0}; | ||
| #elif (_WIZCHIP_ == W5200 || _WIZCHIP_ == W5300 || _WIZCHIP_ == W5500 || _WIZCHIP_ == W6100) | ||
| uint8_t sn_size[16] = {16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0}; |
There was a problem hiding this comment.
We already have drivers for the Wiznet 5K series in network_wiznet5k.c. How should we approach this, can we remove the network_wiznet5k.c driver and replace it with this one?
There was a problem hiding this comment.
Answered in the main review thread — yes, it can be removed and replaced with this one.
| if(NOT DEFINED MICROPY_HW_FLASH_STORAGE_BYTES) | ||
| set(MICROPY_HW_FLASH_STORAGE_BYTES 1441792) # 1408 * 1024 | ||
| endif() | ||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable -Wno-unused-variable -Wno-misleading-indentation -Wno-incompatible-pointer-types -Wno-error=unused-function -Wno-comment -Wno-unused-function") |
There was a problem hiding this comment.
We can't disable warnings for all source files like this.
If there are external files which need this change applied then can do it for single source files in ports/rp2/CMakeLists.txt like this:
https://github.com/micropython/micropython/blob/master/ports/rp2/CMakeLists.txt#L641
However if the warnings are coming from MicroPython code then they need to be fixed, not ignored.
There was a problem hiding this comment.
(Same comment applies for all of the new mpconfigboard.cmake files.)
There was a problem hiding this comment.
Yes, I added those deliberately, because the vendored ioLibrary_Driver still has warnings of its own. I'll take them out and check whether any of the warnings are coming from the MicroPython code rather than the library.
| set(MICROPY_HW_FLASH_STORAGE_BYTES 1441792) # 1408 * 1024 | ||
| endif() | ||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable -Wno-unused-variable -Wno-misleading-indentation -Wno-incompatible-pointer-types -Wno-error=unused-function -Wno-comment -Wno-unused-function") | ||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb -mcpu=cortex-m0plus") |
There was a problem hiding this comment.
This line shouldn't be necessary, the rp2 build process should already be setting these flags.
There was a problem hiding this comment.
(Same comment applies for all of the new mpconfigboard.cmake files.)
There was a problem hiding this comment.
Understood — I'll test that and confirm.
| ``` | ||
| >>> import network | ||
| >>> nic = network.WIZNET5K() | ||
| >>> nic = network.WIZNET6K() |
There was a problem hiding this comment.
This will be a breaking change for anyone already using this board, the driver name is changing.
It's also a confusing API if some boards need WIZNET5K() for Wiznet 5K and some need WIZNET6K(). See earlier comment about the future of the wiznet5k driver.
There was a problem hiding this comment.
Answered in the main review thread!

Summary
This PR adds full support for WIZnet Ethernet controller EVB (Evaluation Board) series
(W5100S, W5500, W6100, W6300, W55RP20) to the MicroPython RP2 port.
Key Changes
Migration from wiznet5k → wiznet6k
W5100S_EVB_PICOW5500_EVB_PICONew Board Support (7 boards)
W5100S_EVB_PICO2– Pico2 with W5100S (#16280)W5500_EVB_PICO2– Pico2 with W5500 (#16280)W55RP20_EVB_PICO– RP2040 + W5500 SiP (#16476)→ Dedicated PIO driver files added
W6100_EVB_PICO– Pico with W6100W6100_EVB_PICO2– Pico2 with W6100W6300_EVB_PICO– Pico with W6300 QSPI→ Dedicated PIO driver files added
W6300_EVB_PICO2– Pico2 with W6300 QSPI→ Dedicated PIO driver files added
Network Stack Integration
extmod/network_wiznet6k.c(~1,197 lines) – full-featured network driverlib/wiznet6k– WIZnet official ioLibrary as a submodulePIO-based SPI Driver
wiznet_pio_spi.[c|h|pio],machine_wiznet_pio_spi.c(~1,223 lines)Driver Code Size
network_wiznet6k.c: 1,197 linesFile Structure
Testing
Trade-offs and Alternatives