1. 03 Jun, 2019 1 commit
    • Damien George's avatar
      stm32/modnetwork: Replace generic netif NIC polling with specific code. · ce8262a1
      Damien George authored
      It doesn't work to tie the polling of an underlying NIC driver (eg to check
      the NIC for pending Ethernet frames) with its associated lwIP netif.  This
      is because most NICs are implemented with IRQs and don't need polling,
      because there can be multiple lwIP netif's per NIC driver, and because it
      restricts the use of the netif->state variable.  Instead the NIC should
      have its own specific way of processing incoming Ethernet frame.
      
      This patch removes this generic NIC polling feature, and for the only
      driver that uses it (Wiznet5k) replaces it with an explicit call to the
      poll function (which could eventually be improved by using a proper
      external interrupt).
      ce8262a1
  2. 05 Apr, 2019 3 commits
  3. 01 Jun, 2018 1 commit
    • Damien George's avatar
      stm32: Add network driver for Wiznet5k using MACRAW mode and lwIP. · 7d86ac6c
      Damien George authored
      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 mem...
      7d86ac6c