This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.

If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

class WIZNET5K – control WIZnet5x00 Ethernet modules

This class allows you to control WIZnet5x00 Ethernet adaptors based on the W5100, W5100S, W5200, W5300 and W5500 chipsets. The particular chipset that is supported by the firmware is selected at compile-time via the MICROPY_PY_NETWORK_WIZNET5K option. The driver is built on WIZnet’s ioLibrary_Driver.

Note

The esp32 port also supports WIZnet W5500 chipsets, but this port uses the network.LAN interface.

On a board with the chip fitted, such as the W5100S-EVB-Pico or the W5500-EVB-Pico, the constructor takes no arguments and configures the SPI bus and pins itself:

import network
nic = network.WIZNET5K()
nic.active(True)
print(nic.ipconfig("addr4"))

# now use socket as usual
...

With an external module, pass the SPI bus and the nSS and nRESET pins:

import network
nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
print(nic.ipconfig("addr4"))

For this example to work the WIZnet5x00 module must have the following connections:

  • MOSI connected to X8

  • MISO connected to X7

  • SCLK connected to X6

  • nSS connected to X5

  • nRESET connected to X4

It is possible to use other SPI buses and other pins for nSS and nRESET.

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.

On a board that has the chip fitted, all three arguments may be omitted and the board’s own SPI bus and pins are used.

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 example, you can use:

nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)

Methods

This class implements most methods from AbstractNIC, which are documented there. Additional methods are:

WIZNET5K.regs()

Dump the WIZnet5x00 registers. Useful for debugging.