How to Access the SPI Bus

µC/TCP-IP currently supports only wireless devices that communicate with the host via SPI. Also, many other devices/hardware can share the same SPI bus, so each time the device driver needs to access the SPI bus it must acquire the access and set the SPI controller following the wireless device’s SPI requirements. This procedure must be followed each time the device driver needs to access the SPI:

  1. Acquire the SPI lock by calling network device’s BSP function pointer, NetDev_WiFi_SPI_Lock().
  2. Enable chip select of the wireless device via network device’s BSP function pointer, NetDev_WiFi_SPI_ChipSelEn().
  3. Configure the SPI controller by calling network device’s BSP function pointer, NetDev_WiFi_SPI_SetCfg().
  4. Write data and read data from the SPI with appropriate buffer pointer to write buffer and read buffer to the network device’s BSP function pointer, Net_Dev_SPI_WrRd().
  5. Disable the device’s chip select via network device’s BSP function pointer, NetDev_WiFi_SPI_ChipSelDis().
  6. Release the SPI lock by calling the network device’s BSP function pointer, NetDev_WiFi_SPI_Unlock().