Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WIZnet W5500-EVB-Pico2 board #10179

Merged
merged 5 commits into from
Apr 2, 2025

Conversation

fasteddy516
Copy link

This adds the WIZnet W5500-EVB-Pico2 development board. It's virtually identical to the existing W5100S-EVB-Pico2 aside from the USB PID and WIZnet ethernet chip.

Copy link
Member

@anecdata anecdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on a W5100S-EVB-Pico2 (the WIZnet library handles the difference in the chips). Looks good operationally.

Looks like I made a couple of mistakes in the W5100S-EVB-Pico2 PR (not sure if we change those now as it may break user code). The WIZnet PRs for the original Pico W5100s and W5500 do not have default UART, I2C, or and SPI Singletons. However, WIZnet docs (arguably) show a preferred UART on GP0 and GP1 (peripheral 0), and of course the SPI used for Ethernet is highlighted. No hints on the silkscreen labels, everything is GPxx though the span of Ethernet pins is generally marked.

But perhaps the most relevant thing here is naming pins GPIO26 and GPIO 27 (doubling up on scarce ADC pins) as SDA and SCL, when the default I2C is called out as GPIO5 and GPIO4... could lead to some confusion. Both are on peripheral 1.

Some guidance from one of the core devs may be helpful. We could potentially go back and edit all of these WIZnet boards to match.

@dhalbert
Copy link
Collaborator

However, WIZnet docs (arguably) show a preferred UART on GP0 and GP1 (peripheral 0),

I looked at that page and could not find something that marked that as preferred (or for the preferred I2C). What am I missing?

@anecdata
Copy link
Member

anecdata commented Mar 26, 2025

In the pinout diagram in the docs, GP0 and GP1 are in a bolder shade of purple than the other UART pins. I don't find any indications of a preference for I2C.

@dhalbert
Copy link
Collaborator

I am a little reluctant to make default UART, I2C, etc., if there is little to no documentation for that. We didn't do that on the Pi Pico, for instance, though there are defaults (more than one set!). @fasteddy516, how did you decide on those defaults?

@fasteddy516
Copy link
Author

I just copied the existing W5100S-EVB-Pico2 then compared with the existing W5500-EVB-Pico. I pulled the MP_QSTR_SDA and MP_QSTR_SCL lines from Commit 40cc500 which maps SDA and SCL to GPIO26 and GPIO27. The GPIO layout for the two boards is identical, so it made sense to keep them the same. I missed the fact that the W5100S-EVB-Pico2 mpconfigboard.h had #define CIRCUITPY_BOARD_I2C_PIN set to GPIO4 and GPIO5. (I also have no idea how the CIRCUITPY_BOARD_I2C defines relate to/differ from the DEFAULT_I2C_BUS_SDA and _SCL that are mentioned in the "How to Add a New Board to CircuitPython" guide that I was following, and why one would be used over the other.)

Dropping the two CIRCUITPY_BOARD_I2C lines would make the I2C definitions the same as the existing RP2040 version of this board. Dropping the SDA and SCL lines in pins.c would make it the same as the W5100S version of this board. I'm not sure which of the existing boards I should try to match. 40cc500 is just over a year old - any chance @jepler recalls what led to the assignment of GPIO26 and 27 to SDA and SCL?

@anecdata
Copy link
Member

I may have done the same thing with the W5100S-EVB-Pico2 since the W5100s and W5500 EVB Pico boards were the only WIZnet definitions at the time.

I misspoke above, I may have been looking at the PR and not the current code. The original Pico1 Wiznet boards do now have all three Singletons defined in pins.c. The UART and SPI pins are called out in mpconfigboard.h, but there are no pin aliases for UART pins GP0 and GP1..

Maybe we decide what's right for this board, then decide how much to retrofit (break?) the previous three boards. I don't have any strong positions either way.

@fasteddy516
Copy link
Author

If we ignore the existing boards and approach this one fresh, it's a Raspberry Pi Pico 2 (The board pinouts/GPIO/peripheral assignments are identical) with a W5500 ethernet chip hardwired to GP16-GP21. I would suggest:

  1. Start with the standard pin config from the existing Pico 2 board.

  2. Add the six pin aliases associated with the hardwired W5500 - currently MOSI, MISO, SCK, W5500_CS, W5500_RST and W5500_INT. I used these names to match the existing WIZnet boards, but would prefer to avoid using the chip-specific and default SPI aliases and go for something like ETH_MOSI, ETH_MISO, ETH_SCK, ETH_CS, and ETH_RST so that they're clearly associated with a hardwired ethernet chip (the W5100S boards have these same pins).

  3. Leave out the default UART and SPI definitions - as @dhalbert pointed out, they're not defined for the Pico 2, which this board is based on.

  4. If we go with the ETH_ pin aliases, those aliases could get added to the existing WIZnet board definitions as well.

I'm happy to make whatever changes make the most sense to everyone.

@fasteddy516
Copy link
Author

Was thinking about this some more - maybe 'W5K_' instead of 'ETH_'. That at least keeps them hardware family-specific and helps relate them to the 'adafruit_wiznet5K' driver. Could even update the driver to recognize and auto-assign appropriately named 'W5K' pins if they exist in 'board'.

@tannewt tannewt requested a review from dhalbert March 27, 2025 18:18
@dhalbert
Copy link
Collaborator

3. Leave out the default UART and SPI definitions - as @dhalbert pointed out, they're not defined for the Pico 2, which this board is based on.

I agree with this and the other points. Could you make those changes and regularize the other related boards if needed? Thanks. Also I like the W5K_ prefix.

@fasteddy516
Copy link
Author

For sure, I'll make those changes. I can regularize the other related boards in a separate pull request unless you prefer it all in one.

@dhalbert
Copy link
Collaborator

I can regularize the other related boards in a separate pull request unless you prefer it all in one.

Either way is fine.

@fasteddy516
Copy link
Author

Should be good to go for this board now. It's effectively the same as a Pico 2, but with the added W5K_ pin aliases. Built for and tested on a W5500-EVB-Pico2 board with code that utilizes the WIZnet ethernet chip and all runs fine.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! - one thing re default and STEMMA I2C

@dhalbert
Copy link
Collaborator

One more thing: it looks like some changes in pins.c caused there to be lines containing only spaces. That was caught by pre-commit. See the failed pre-commit job above.

@fasteddy516
Copy link
Author

I believe should be good to merge now, thanks!

@dhalbert dhalbert dismissed their stale review April 2, 2025 03:51

addressed

@dhalbert dhalbert merged commit f885cac into adafruit:main Apr 2, 2025
16 checks passed
@fasteddy516 fasteddy516 deleted the wiznet_w5500_evb_pico2 branch April 2, 2025 14:25
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.

3 participants