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.
Region | Description |
---|---|
WDRV_WINC_NVM_REGION_RAW | The entire flash area |
WDRV_WINC_NVM_REGION_FIRMWARE_ACTIVE | WINC firmware (active) |
WDRV_WINC_NVM_REGION_FIRMWARE_INACTIVE | WINC firmware (inactive) |
WDRV_WINC_NVM_REGION_PLL_TABLE | PLL table values (cannot be erased, use combined region below) |
WDRV_WINC_NVM_REGION_GAIN_TABLE | Gain table values (cannot be erased, use combined region below) |
WDRV_WINC_NVM_REGION_PLL_AND_GAIN_TABLES | Combined PLL and gain table |
WDRV_WINC_NVM_REGION_ROOT_CERTS | Root certificates |
WDRV_WINC_NVM_REGION_LOCAL_CERTS | Local TLS certificates |
WDRV_WINC_NVM_REGION_CONN_PARAM | Connection parameters |
WDRV_WINC_NVM_REGION_HTTP_FILES | HTTP server files |
WDRV_WINC_NVM_REGION_HOST_FILE | Host 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.