1.2.9 NVM Access

This topic provides information on how the SPI flash within the WINC device can be read, written and erased.

The WINC device contains a SPI flash device within which firmware and data are stored. It is sometime applicable for the application to update or query a specific area within the flash. This interface allows the application to query and update the NVM flash.

The flash can only be access through this interface if the WINC device has been placed into a held state such that the WINC firmware is not accessing the flash.

Flexible Flash Map

How the flash is arranged is called the flash map. Depending on which WINC device, firmware and application is being run this map may be altered from the default map, therefore the application should avoid any access which assumes fixed locations for entries within the flash.

To support the application the NVM access interface must be called with a specified region, this region identifies which area within the flash the application is interacting with.

All addresses supplied to the NVM interface are relative to the start of the region specified, therefore, except for raw access, the addresses are not physical addresses within the flash area.

RegionDescription
WDRV_WINC_NVM_REGION_RAWThe entire flash area
WDRV_WINC_NVM_REGION_FIRMWARE_ACTIVEWINC firmware (active)
WDRV_WINC_NVM_REGION_FIRMWARE_INACTIVEWINC firmware (inactive)
WDRV_WINC_NVM_REGION_PLL_TABLEPLL table values (cannot be erased, use combined region below)
WDRV_WINC_NVM_REGION_GAIN_TABLEGain table values (cannot be erased, use combined region below)
WDRV_WINC_NVM_REGION_PLL_AND_GAIN_TABLESCombined PLL and gain table
WDRV_WINC_NVM_REGION_ROOT_CERTSRoot certificates
WDRV_WINC_NVM_REGION_LOCAL_CERTSLocal TLS certificates
WDRV_WINC_NVM_REGION_CONN_PARAMConnection parameters
WDRV_WINC_NVM_REGION_HTTP_FILESHTTP server files
WDRV_WINC_NVM_REGION_HOST_FILEHost file download area

Enabling Access

To enable access to the flash from the application the WINC must be placed into a held state. The application must call WDRV_WINC_Open with the DRV_IO_INTENT_EXCLUSIVE intent to ensure the WINC firmware is not running.

Erase Sectors

To erase a sector with a region the function WDRV_WINC_NVMEraseSector can be called specifying the starting sector within the region to start the erase operation on and the number of sectors to erase.

Read Data

To read a block of data the application can call WDRV_WINC_NVMRead specifying the offset address within the region and the number of bytes to be read.

Write Data

To write a block of data the application can call WDRV_WINC_NVMWrite specifying the offset address within the region and the number of bytes to be written.