AN370
Rev. 1.0
69
7.10. Non-Volatile Memory (NVM) Copy Module
The non-volatile memory (NVM) module copies formatted (composed) code and data blocks from the NVM. The
data within NVM block can be copied to CODE/XDATA RAM, as well as to the internal DATA/IDATA RAM. The sole
purpose of this module is for the user to load user application code and data overlays from NVM by the application
at runtime.
If using overlays, the user application consists of the main program (User Boot), which is loaded to the CODE/
XDATA RAM upon boot and run. The application can be written to be able to load new or additional code and/or
data from NVM in the form of an overlay. That mechanism will allow the use of the 7 kB of NVM available code/data
for user application, while having only 4 kB of RAM where the code can be run from. For details on the overlay
technique see “AN518: Si4010 Memory Overlay Technique" application note.
Extremely frequent read of the NVM can cause wear out failure of the memory. This phenomenon should only be
considered in the rare case of more or less continuous boot or overlay read of the NVM. E.g., a keyfob that wakes
up and boots 4 k user code on every button press allows at least 1400 button presses per minute (!) over a 10 year
period to get a 10 ppm failure rate. AN577
describes how to calculate failure rate of the NVM.
The data will be programmed into the NVM by a special application provided by Silicon Labs. See “AN511: NVM
Programming Utility User’s Guide" for details.
The NVM handling is split into several functions. Usually the overlay will consist of a single IntelHEX compiled and
linked output file, which will be converted to a single NVM block. In the case of loading an overlay consisting of one
NVM block, the user needs to enter only the overlay starting address where the converted overlay resides in the
NVM. Below is an example of a wrapper function which enables the NVM, copies a single NVM block, and disables
the NVM to conserve power.
The setting up of the NVM by vNvm_McEnableRead() can take up to 30 µs. It usually takes 3.6 ms per 1 kB of
NVM data to be copied from NVM by bNvm_CopyBlock() function.
Important note about interrupts
: It is highly recommended that interrupts be disabled around the call to the
bNvm_CopyBlock() and bNvmLoadBlock() functions. If this is not possible, then it is highly recommended that the
most time consuming interrupts are disabled. The interrupt disruption of the NVM load process should be kept at a
minimum in the order of units of microseconds.
In general, the interrupts should be disabled before the vNvm_McEnableRead() call and enabled only after the
vNvm_McDisableRead() call. There should be no other activity in between these two functions when the NVM
module function calls as shown in the bNvmLoadBlock() function example below.
/*
*------------------------------------------------------------------------------
*
* INCLUDES:
*/
#include "si4010.h"
#include "si4010_api_rom.h"
/*
*==============================================================================
*
* VISIBLE FUNCTIONS:
*/
BYTE vNvmLoadBlock