Skip to content

How to add wiznet5k to Raspberry pi pico -micropython

How to add wiznet5k to Raspberry pi pico -micropython

pranchal

Published February 04, 2022

Components

Hardware components

x 1

Software Apps and online services

Project description

Story

I already test the WIZNET5K library using pyboard. So, I thought that it would be easy to port the Raspberry Pi to Pico. Oops....

I realized that the task was never easy because in ports/rp2 folder about network source code.

------

Github :?https://github.com/irinakim12/micropython/tree/wiznet5k

If you enter in ports/rp2 folder, you can see the Makefile.

I changed the makefile so that w5500 works by default so you just use the "make" command.

MakeFile in ports/rp2
MakeFile in ports/rp2
How to add wiznet5k to Raspberry pi pico -micropython, Story

If you have completed compiling, you will see that firmware.elf and firmware files are created in build-PICO.

You just have to download it to the pico board.

You can program your Pico by connecting it to a computer via USB, then dragging and dropping a file onto it, so we’ve put together a downloadable UF2 file to let you install MicroPython more easily.

https://www.raspberrypi.com/documentation/microcontrollers/micropython.html#drag-and-drop-micropython

import network
from usocket import socket
from machine import Pin,SPI
import rp2

def main(): 
    spi=SPI(0,2_000_000, mosi=Pin(19),miso=Pin(16),sck=Pin(18))
    nic = network.WIZNET5K(spi,Pin(17),Pin(20))
    nic.ifconfig(('192.168.100.20','255.255.255.0','192.168.100.1','8.8.8.8'))
    
    while True:
        if nic.isconnected() == True:
            #print(nic.regs())
            s=socket()
            s.connect(('192.168.100.10',5000))
            while True:
                data = s.recv(1500)
                print(data.decode('utf-8'))
                if data != 'NULL' :
                    s.send(data)
            
main()

I used the Thonny tool and confirmed that it works.

Result

How to add wiznet5k to Raspberry pi pico -micropython, Story

After that, I will try to modify by W5100s and W5100 in the drive of wiznet5k..

How to add wiznet5k to Raspberry pi pico -micropython, Story

https://www.wiznet.io/product-item/wiznet-ethernet-hat/

Schematics

Connect Pico (SPI0) and WIZnet's Chip

Connect Pico (SPI0) and WIZnet's Chip

Comments

Comments