diff options
author | Damien George <damien.p.george@gmail.com> | 2018-06-01 14:21:38 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-06-01 14:21:38 +1000 |
commit | 7d86ac6c0197abddd4ccff92154af326da083558 (patch) | |
tree | 1b1438847e27fe11eaa607a9394dfbb36e752455 /tests/extmod/vfs_basic.py | |
parent | 5a5bc4a61f660829b8f57c297ff90ec43f86b173 (diff) |
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.
Diffstat (limited to 'tests/extmod/vfs_basic.py')
0 files changed, 0 insertions, 0 deletions