2023-03-20 09:34 PM
I want to know maximun number of pairing device information can the STM32WB save.
Is regard to device's flash capacity?
Solved! Go to Solution.
2023-03-31 07:17 AM
Hello,
The computation of number n of bonded devices that can be stored in NVM is the following:
n = (total_size_of_nvm-1) / [ (size_of_sec_record+1) + (size_of_gatt record+1) ]
When SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM flag is set in CFG_BLE_OPTIONS:
The GATT DB record in NVM is composed:
Example with default GATT configuration + 1 service with UUID_16 + 3 characteristics with UUID_16 with 1 characteristic with notification property
size_of_gatt_record = 5 bytes for the GATT service (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 7 bytes for the Service Changed characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID + 2 bytes for CCCD)
+ 5 bytes for the GAP service (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the Device Name characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the Appearance characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the Peripheral Preferred Connection Parameters characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the service
+ 5 bytes for the 1st characteristic attribute
+ 5 bytes for the 2nd characteristic attribute
+ 7 bytes for the 3rd characteristic attribute (CCCD)
= 54 bytes
In this case 14 bonded devices can be store in NVM.
When SHCI_C2_BLE_INIT_OPTIONS_REDUC_GATTDB_NVM flag and SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC flag are set in CFG_BLE_OPTIONS:
The GATT record in NVM is composed:
Default GATT configuration + 1 service with UUID_16 + 3 characteristics with UUID_16 with 1 characteristic with notification property
size_of_gatt_record = 3 bytes for the GATT service (Service Changed - CCCD)
+ 3 bytes for the characteristic attribute (CCCD)
= 6 bytes
In this case 23 bonded devices can be store in NVM.
When SHCI_C2_BLE_INIT_OPTIONS_REDUC_GATTDB_NVM flag and SHCI_C2_BLE_INIT_OPTIONS_NO_SVC_CHANGE_DESC flag are set in CFG_BLE_OPTIONS:
The GATT record in NVM is composed:
Default GATT configuration + 1 service with UUID_16 + 3 characteristics with UUID_16 with 1 characteristic with notification property
size_of_gatt_record = 3 bytes for the characteristic attribute (CCCD)
= 3 bytes
In this case 23 bonded devices can be store in NVM.
Best Regards
2023-03-31 07:17 AM
Hello,
The computation of number n of bonded devices that can be stored in NVM is the following:
n = (total_size_of_nvm-1) / [ (size_of_sec_record+1) + (size_of_gatt record+1) ]
When SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM flag is set in CFG_BLE_OPTIONS:
The GATT DB record in NVM is composed:
Example with default GATT configuration + 1 service with UUID_16 + 3 characteristics with UUID_16 with 1 characteristic with notification property
size_of_gatt_record = 5 bytes for the GATT service (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 7 bytes for the Service Changed characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID + 2 bytes for CCCD)
+ 5 bytes for the GAP service (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the Device Name characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the Appearance characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the Peripheral Preferred Connection Parameters characteristic (2 bytes for handle + 3 bytes for service 16-bit UUID)
+ 5 bytes for the service
+ 5 bytes for the 1st characteristic attribute
+ 5 bytes for the 2nd characteristic attribute
+ 7 bytes for the 3rd characteristic attribute (CCCD)
= 54 bytes
In this case 14 bonded devices can be store in NVM.
When SHCI_C2_BLE_INIT_OPTIONS_REDUC_GATTDB_NVM flag and SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC flag are set in CFG_BLE_OPTIONS:
The GATT record in NVM is composed:
Default GATT configuration + 1 service with UUID_16 + 3 characteristics with UUID_16 with 1 characteristic with notification property
size_of_gatt_record = 3 bytes for the GATT service (Service Changed - CCCD)
+ 3 bytes for the characteristic attribute (CCCD)
= 6 bytes
In this case 23 bonded devices can be store in NVM.
When SHCI_C2_BLE_INIT_OPTIONS_REDUC_GATTDB_NVM flag and SHCI_C2_BLE_INIT_OPTIONS_NO_SVC_CHANGE_DESC flag are set in CFG_BLE_OPTIONS:
The GATT record in NVM is composed:
Default GATT configuration + 1 service with UUID_16 + 3 characteristics with UUID_16 with 1 characteristic with notification property
size_of_gatt_record = 3 bytes for the characteristic attribute (CCCD)
= 3 bytes
In this case 23 bonded devices can be store in NVM.
Best Regards