Skip to content

Add support for W55RP20-EVB-Pico and WIZNET_PIO_SPI communication. #10440

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wizhannah
Copy link

The W55RP20-EVB-Pico is an evaluation board for the W55RP20, a SiP (System in Package) chip that integrates the W5500 (wired TCP/IP controller) and the RP2040. As a result, both the features of the Raspberry Pi Pico and the W5500 can be utilized.

The W55RP20 features two identical PIO (Programmable Input/Output) blocks, one of which is used for communication with the W5500. For more detailed information on PIO, please refer to section 3 "PIO" in the RP2040 datasheet.

This PR adds initial support for the W55RP20-EVB-Pico board. The changes included in this PR are as follows:

  1. Added support for W55RP20-EVB-Pico under ports/raspberrypi/boards/
  2. Implemented WIZNET_PIO_SPI in both:
    • common-hal/busio/
    • shared-bindings/busio/
  3. New files were created in the ports/raspberrypi/wiznet_pio_spi directory:
    • wiznet_pio_spi.c
    • wiznet_pio_spi.h
    • wiznet_pio_spi.pio

The wiznet5k_simpleserver example ran without any issues:

import board
import busio
import digitalio

import adafruit_wiznet5k.adafruit_wiznet5k_socketpool as socketpool
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K

print("Wiznet5k SimpleServer Test")

# For Adafruit Ethernet FeatherWing
cs = digitalio.DigitalInOut(board.W5K_CS)

spi_bus = busio.WIZNET_PIO_SPI(board.W5K_SCK, MOSI=board.W5K_MOSI, MISO=board.W5K_MISO)

# Initialize ethernet interface
eth = WIZNET5K(spi_bus, cs, is_dhcp=True)

# Initialize a socket for our server
pool = socketpool.SocketPool(eth)
server = pool.socket()  
server_ip = eth.pretty_ip(eth.ip_address)  
server_port = 50007 
server.bind((server_ip, server_port)) 
server.listen() 

while True:
    print(f"Accepting connections on {server_ip}:{server_port}")
    conn, addr = server.accept()
    print(f"Connection accepted from {addr}, reading exactly 1024 bytes from client")
    with conn:
        data = conn.recv(1024)
        if data:
            print(data)
            conn.send(data)
    print("Connection closed")

image

Additionally, the following examples were also tested and passed successfully:

  • Adafruit IO (DownLink, UpLink, Up&DownLink)
  • DHCP
  • DNS
  • HTTP (Webclient, Webserver)
  • Loopback
  • MQTT
  • SNTP

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 for adding these new boards.

We don't put board- or port-specific stuff in shared-bindings. The idea of shared-bindings is that the Python API is common across all the ports that implement it.

Instead, put the port-specific stuff in ports/raspberrypi/bindings. There are already some RP2xxx-specific things there, which you can use as models.

In this case, it would make sense to create a new module, called, say piospi with a class piospi.SPI(). The you can have a flag, say, CIRCUITPY_PIOSPI, which would be enabled only for these boards.

I am not sure if this is true, but is it the case that this PIO implementation is not limited to Wiznet boards? Could it be used on any PIO-capable RP2 board? That is why I suggested the name above. Internally, you can then drop the "wiznet" part of the names, and just use 'piospi`.

We could also consider naming the top-level module piobusio. for right now only includes SPI, but could include PIO-based I2C or UART in the future.

How does this all sound to you?

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