5.9.4.5 OTA File Read SPI

NMI_API sint8 m2m_ota_host_file_read_spi
(
uint8    u8Handler,
uint8    *pu8Buff,
uint32    u32Offset,
uint32    u32Size
);

The file read via SPI is similar to the read via HIF. The use of a callback is not considered, because to access the WINC’s Flash via SPI, the WINC must be set into a certain mode to allow for safe read/write of its Flash. Therefore, it is typical to use a loop to read all the data necessary while the WINC is in that state and then restart the WINC.

To use this API, the application must call m2m_wifi_download_mode to make the WINC safe for read/write Flash access and once the read is completed, the WINC must be reinitialized (m2m_wifi_reinit, m2m_ota_init) and to connect to the network again if the Application based on the request. pu8Buff is a pointer to a buffer provided by the Application and to where the data will be read to.

Advantages (vs HIF read)

  • SPI read is faster than HIF Read.

Disadvantages (vs HIF read)

  • Requires the WINC to set into a special mode and restart later.
  • Generally blocks as the read are done within a loop to minimize WINC reset.