class WIZNET5K – control WIZnet5x00 Ethernet modules
This class allows you to control WIZnet5x00 Ethernet adaptors based on the W5500 chipsets. The particular chipset that is supported by the firmware is selected at compile-time via the MICROPY_PY_NETWORK_WIZNET5K option.
Example usage:
import network
from machine import SPI, Pin
spi = SPI(2) # Default SPI interface for W55MH32
cs = Pin("PB12", Pin.OUT) # nSS for W55MH32 is PB12
rst = Pin("PD9", Pin.OUT) # nRESET for W55MH32 is PD9
pwn = Pin("PE15", Pin.OUT, value =0) # PWN (Powerdown) for W55MH32 is PE15 and it needs to force to powerdown
nic = network.WIZNET5K(spi, cs, rst)
# Reset the WIZnet chip
nic.active(True)
# now use socket as usual
...
Constructors
- class network.WIZNET5K(spi, pin_cs, pin_rst)
Create a WIZNET5K driver object, initialise the WIZnet5x00 module using the given SPI bus and pins, and return the WIZNET5K object.
Arguments are:
spi is an SPI object which is the SPI bus that the WIZnet5x00 is connected to (the MOSI, MISO and SCLK pins).
pin_cs is a Pin object which is connected to the WIZnet5x00 nSS pin.
pin_rst is a Pin object which is connected to the WIZnet5x00 nRESET pin.
All of these objects will be initialised by the driver, so there is no need to initialise them yourself. For W55MH32, please follow the information below:
spi = SPI(2) cs = Pin("PB12", Pin.OUT) rst = Pin("PD9", Pin.OUT) pwn = Pin("PE15", Pin.OUT, value =0) nic = network.WIZNET5K(spi, cs, pwn)
Methods
This class implements most methods from AbstractNIC, which are documented there. Additional methods are:
- WIZNET5K.regs()
Dump the WIZnet5x00 registers. Useful for debugging.