Persistent Store (flash)#

Persistent Store (PS) commands manage user data in PS keys in the flash memory of the Bluetooth device. User data stored within the flash memory is persistent across reset and power cycling of the device. The persistent store size is 2048 bytes. Because Bluetooth bondings are also stored in this area, the space available for user data additionally depends on the number of bondings the device has at the time. The size of a Bluetooth bonding is around 150 bytes.

The maximum user data size associated to a PS key is 56 bytes.

flash commands#

flash_ps_erase#

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

C API#

/* Function */  
struct gecko_msg_flash_ps_erase_rsp_t *gecko_cmd_flash_ps_erase(uint16 key);  
  
/* Response id */  
gecko_rsp_flash_ps_erase_id  
  
/* Response structure */  
struct gecko_msg_flash_ps_erase_rsp_t  
{  
  uint16 result;  
}  

Command Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

key

PS key to delete

Response Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

result

Result code

  • 0: success

  • Non-zero: an error has occurred

For other values see Error codes

flash_ps_erase_all#

Delete all PS keys and their corresponding values.

C API#

/* Function */  
struct gecko_msg_flash_ps_erase_all_rsp_t *gecko_cmd_flash_ps_erase_all();  
  
/* Response id */  
gecko_rsp_flash_ps_erase_all_id  
  
/* Response structure */  
struct gecko_msg_flash_ps_erase_all_rsp_t  
{  
  uint16 result;  
}  

Command does not have parameters (for BGAPI headers refer to#

link)

Response Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

result

Result code

  • 0: success

  • Non-zero: an error has occurred

For other values see Error codes

flash_ps_load#

Retrieve the value of the specified PS key.

C API#

/* Function */  
struct gecko_msg_flash_ps_load_rsp_t *gecko_cmd_flash_ps_load(uint16 key);  
  
/* Response id */  
gecko_rsp_flash_ps_load_id  
  
/* Response structure */  
struct gecko_msg_flash_ps_load_rsp_t  
{  
  uint16 result;  
  uint8array value;  
}  

Command Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

key

PS key of the value to be retrieved

Response Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

result

Result code

  • 0: success

  • Non-zero: an error has occurred

For other values see Error codes
uint8array | value | The returned value of the specified PS key

flash_ps_save#

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

C API#

/* Function */  
struct gecko_msg_flash_ps_save_rsp_t *gecko_cmd_flash_ps_save(uint16 key, uint8 value_len, const uint8 *value_data);  
  
/* Response id */  
gecko_rsp_flash_ps_save_id  
  
/* Response structure */  
struct gecko_msg_flash_ps_save_rsp_t  
{  
  uint16 result;  
}  

Command Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

key

PS key

uint8

value_len

Array length.

uint8array

value_data

Value to store into the specified PS key

Response Parameters (for BGAPI headers refer to link)#

Type

Name

Description

uint16

result

Result code

  • 0: success

  • Non-zero: an error has occurred

For other values see Error codes

flash defines#

flash_ps_keys#

Define keys

Defines#

Value

Name

Description

44

flash_ps_key_local_bd_addr

If defined override address stored during

firmware update

49

flash_ps_key_tx_power

Maximum allowed transmitting power

50

flash_ps_key_ctune

Crystal tuning value override

51

flash_ps_key_application_gsn

Application Global State Number value

53

flash_ps_key_ota_flags

OTA configuration flags

54

flash_ps_key_ota_device_name

Device name to be used for OTA

55

flash_ps_key_device_irk

Identity Resolving Key

56

flash_ps_key_bonding_priority_list

Bonding priority list

57

flash_ps_key_ota_advertisement_packet

OTA advertising packet

58

flash_ps_key_ota_scan_response_packet

OTA scan response packet

59

flash_ps_key_application_ai

Application Advertising Identifier value

60

flash_ps_key_identity_addr_type

Identity address type. 0: public

(default), 1: static

61

flash_ps_key_gatt_db_hash

GATT DB hash

62

flash_ps_key_ota_rf_path

RF Path used in OTA

16383

flash_ps_key_bonding_db_config

Bonding database configuration