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.

The Bluetooth stack uses the NVM3 data storage driver to implement the commmands in this class. Applications can also use the NVM3 APIs directly.

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 9392 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9409 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9423 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9433 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9357 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9358 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9359 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9360 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9361 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9362 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9363 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/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 9364 of file /mnt/raid/workspaces/ws.iS2YF8Lrv/overlay/gsdk/protocol/bluetooth/build/native/sw/bgapi/inc/sl_bt_api.h