Zigbee persistent data management and non-volatile memory

Revision as of 12:59, 6 March 2023 by Registered User
Under construction.png Coming soon

1. Introduction

In a Zigbee network, if a node is turned off due to power shutdown or any other reason, the network data stored in its RAM will be lost. This can result in the loss of important information and can affect the functioning of the network. For that, we need to store some type of data, that we call Persistent Data, in a Non-Volatile Memory (NVM). These data might be network settings, security keys, and other configuration information.
The STM32WB storage in Flash memory is done by the mean of dedicated persistent data APIs that we will describe in this wiki.

Memory Mapping
Connectivity NVM MemoryMapping.png

stack notification each time persistent data change, the stack notify the application. To do that, the application must enable stack notification by calling ZbPersistNotifyRegister and implement the associated callback

static void APP_ZIGBEE_persist_notify_cb

when ZbPersistNotifyRegister API is called with NULL arguments, the stack notification is disabled. ZbPersistGet API is provided by the stack to get the persistent data from RAM. cluster attributes can be persistent data if it is declared with ZCL_ATTR_FLAG_PERSISTABLE user must declare the flash memory range in the scatter file for NVM


2. EEPROM Emulator

NVM is typically implemented using flash memory or EEPROM technology, which allows data to be written and rewritten many times, providing long-term data storage capabilities. In a Zigbee network, the EEPROM Emulator is made up of three parts: the EEPROM Emulation header, the NVN layer, and the application layer.

The STM32WB NVM uses the EEPROM emulator that impact the real size available for the persistent data. It is important to note that the available size of EEPROM Emulator is limited, and care should be taken to use this storage space efficiently to ensure the stable and reliable operation of the Zigbee network. Basically, as shown in the figure below, we have a first a header of 4 U64 words is taken for the page, and an EE header for each record that sizes U32 words (2032 bytes). The remaining size per page for data is 2032 bytes.

Flash memory example with EEPROM Emulator
Connectivity NVM EE.png


Persistent data NVM application example An example is provided in STM32CubeWB MCU Package[1]. to do: figure qui explique le use case ce que montre le use case

3. References