NVM3 Access in NCP mode#

NVM3 Access in NCP mode.

Provide convenient methods for applications in NCP mode to manage user data in the Bluetooth region of NVM3. User data stored in NVM3 is persistent across reset and power cycling of the device. Because Bluetooth bondings are also stored in NVM3, the space available for user data also depends on the number of bondings the device has at the time.

It is recommended to use NVM3 APIs directly whenever it is possible, especially for applications in SoC mode.

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 key ranges

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

The NVM3 key in the Bluetooth region

[in]value_len

Length of data in value

[in]value

Value to store into the NVM3 key

Store a value into the specified NVM3 key in the Bluetooth region. Allowed keys are in the range from SL_BT_NVM_KEY_RANGE_USER_MIN (0x4000) to SL_BT_NVM_KEY_RANGE_USER_MAX (0x5FFF). The maximum value length is the lesser of NVM3_DEFAULT_MAX_OBJECT_SIZE configuration in the application and 253 bytes which is the maximum amount this command can accept.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10122 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_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

The NVM3 key in the Bluetooth region

[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 value of the NVM3 key

Retrieve the value of the specified NVM3 key in the Bluetooth region. Allowed keys are in the range from SL_BT_NVM_KEY_RANGE_USER_MIN (0x4000) to SL_BT_NVM_KEY_RANGE_USER_MAX (0x5FFF).

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10141 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_nvm_erase#

sl_status_t sl_bt_nvm_erase (uint16_t key)
Parameters
[in]key

The NVM3 key to delete

Delete a single NVM3 key and its value from the Bluetooth region. Allowed keys are in the range from SL_BT_NVM_KEY_RANGE_USER_MIN (0x4000) to SL_BT_NVM_KEY_RANGE_USER_MAX (0x5FFF).

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10157 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_nvm_erase_all#

sl_status_t sl_bt_nvm_erase_all ()

Delete all NVMs keys and their corresponding values in the Bluetooth region of NVM3. All bluetooth bondings and associated data in NVM3 are deleted too.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 10168 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_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 10081 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_nvm_load_id#

#define sl_bt_cmd_nvm_load_id
Value:
0x030d0020

Definition at line 10082 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_nvm_erase_id#

#define sl_bt_cmd_nvm_erase_id
Value:
0x040d0020

Definition at line 10083 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_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 10084 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_nvm_save_id#

#define sl_bt_rsp_nvm_save_id
Value:
0x020d0020

Definition at line 10085 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_nvm_load_id#

#define sl_bt_rsp_nvm_load_id
Value:
0x030d0020

Definition at line 10086 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_nvm_erase_id#

#define sl_bt_rsp_nvm_erase_id
Value:
0x040d0020

Definition at line 10087 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_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 10088 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h