NVM#

NVM.

Provide an interface to manage user data objects (key/value pairs) in the flash memory. User data stored within the flash memory is persistent across reset and power cycling of the device. Because Bluetooth bondings are also stored in the flash area, in addition to the flash storage size, the space available for user data also depends on the number of bondings the device has at the time.

On EFR32[B|M]G1x devices, either PS Store or NVM3 data storage driver can be used. PS Store is supported by the Bluetooth stack only. Using NVM3 is recommended if the device needs to support Dynamic Multiple Protocol (DMP). On EFR32[B|M]G2x devices, only NVM3 is supported. When NVM3 is used, applications can also use the NVM3 APIs directly.

In PS Store, the flash storage size is fixed at 2048 bytes. The maximum data object size associated to a key is 56 bytes. A Bluetooth bonding uses at maximum 138 bytes for secure connections and 174 bytes for legacy pairing.

In NVM3, the flash store size is configurable and the minimum is 3 flash pages. The maximum data object size is configurable up to 4096 bytes. A Bluetooth bonding uses maximum 110 bytes for secure connections and 138 bytes for legacy pairing. For more details, see AN1135 "Using Third Generation NonVolatile Memory (NVM3) Data Storage".

Modules#

Defined Keys

Functions#

sl_status_t
sl_bt_nvm_save(uint16_t key, size_t value_len, const uint8_t *value)
sl_status_t
sl_bt_nvm_load(uint16_t key, size_t max_value_size, size_t *value_len, uint8_t *value)
sl_status_t
sl_bt_nvm_erase(uint16_t key)
sl_status_t

Macros#

#define
#define
#define
#define
#define
#define
#define
#define

Function Documentation#

sl_bt_nvm_save#

sl_status_t sl_bt_nvm_save (uint16_t key, size_t value_len, const uint8_t * value)
Parameters
[in]key

NVM key

[in]value_len

Length of data in value

[in]value

Value to store into the specified NVM key

Store a value into the specified NVM key. Allowed NVM keys are in range from 0x4000 to 0x407F. At most, 56 bytes user data can be stored in one NVM key. The error code 0x018a (command_too_long) is returned if the value data is more than 56 bytes.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10101 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_nvm_load#

sl_status_t sl_bt_nvm_load (uint16_t key, size_t max_value_size, size_t * value_len, uint8_t * value)
Parameters
[in]key

NVM key of the value to be retrieved

[in]max_value_size

Size of output buffer passed in value

[out]value_len

On return, set to the length of output data written to value

[out]value

The returned value of the specified NVM key

Retrieve the value of the specified NVM key.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10118 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_nvm_erase#

sl_status_t sl_bt_nvm_erase (uint16_t key)
Parameters
[in]key

NVM key to delete

Delete a single NVM key and its value from the persistent store.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10132 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_nvm_erase_all#

sl_status_t sl_bt_nvm_erase_all ()

Delete all NVM keys and their corresponding values.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10142 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

Macro Definition Documentation#

sl_bt_cmd_nvm_save_id#

#define sl_bt_cmd_nvm_save_id
Value:
0x020d0020

Definition at line 10066 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_nvm_load_id#

#define sl_bt_cmd_nvm_load_id
Value:
0x030d0020

Definition at line 10067 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_nvm_erase_id#

#define sl_bt_cmd_nvm_erase_id
Value:
0x040d0020

Definition at line 10068 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_nvm_erase_all_id#

#define sl_bt_cmd_nvm_erase_all_id
Value:
0x010d0020

Definition at line 10069 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_nvm_save_id#

#define sl_bt_rsp_nvm_save_id
Value:
0x020d0020

Definition at line 10070 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_nvm_load_id#

#define sl_bt_rsp_nvm_load_id
Value:
0x030d0020

Definition at line 10071 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_nvm_erase_id#

#define sl_bt_rsp_nvm_erase_id
Value:
0x040d0020

Definition at line 10072 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_nvm_erase_all_id#

#define sl_bt_rsp_nvm_erase_all_id
Value:
0x010d0020

Definition at line 10073 of file /mnt/raid/workspaces/ws.0zwF9W456/overlay/gsdk/protocol/bluetooth/build_debug/bt_api/sw/bgapi/inc/sl_bt_api.h