micropython/ports
Damien George 7d86ac6c01 stm32: Add network driver for Wiznet5k using MACRAW mode and lwIP.
The Wiznet5k series of chips support a MACRAW mode which allows the host to
send and receive Ethernet frames directly.  This can be hooked into the
lwIP stack to provide a full "socket" implementation using this Wiznet
Ethernet device.  This patch adds support for this feature.

To enable the feature one must add the following to mpconfigboard.mk, or
mpconfigport.mk:

    MICROPY_PY_WIZNET5K = 5500

and the following to mpconfigboard.h, or mpconfigport.h:

    #define MICROPY_PY_LWIP (1)

After wiring up the module (X5=CS, X4=RST), usage on a pyboard is:

    import time, network
    nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
    nic.active(1)
    while not nic.isconnected():
        time.sleep_ms(50) # needed to poll the NIC
    print(nic.ifconfig())

Then use the socket module as usual.

Compared to using the built-in TCP/IP stack on the Wiznet module, some
performance is lost in MACRAW mode: with a lot of memory allocated to lwIP
buffers, lwIP gives Around 750,000 bytes/sec max TCP download, compared
with 1M/sec when using the TCP/IP stack on the Wiznet module.
2018-06-01 14:21:38 +10:00
..
bare-arm
cc3200
esp32
esp8266
minimal
pic16bit
qemu-arm
stm32 stm32: Add network driver for Wiznet5k using MACRAW mode and lwIP. 2018-06-01 14:21:38 +10:00
teensy
unix
windows
zephyr