cancel
Showing results for 
Search instead for 
Did you mean: 

How many pairing device information can the STM32WB has at most?

matt.Ku
Associate II

I want to know maximun number of pairing device information can the STM32WB save.

Is regard to device's flash capacity?

1 ACCEPTED SOLUTION

Accepted Solutions
Remy ISSALYS
ST Employee

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) ]

  • total_size_of_nvm = 2028 bytes (fixed in M0)
  • size_of_sec_record = 80 bytes (this is a constant from the BLE stack)
  • size_of_gatt_record is dependent of the flags chosen in the application in app_conf.h file.

When SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM flag is set in CFG_BLE_OPTIONS:

The GATT DB record in NVM is composed:

  • Per service:
    • 2 bytes for handle
    • 3 bytes if 16-bit UUID or 17 bytes if 128-bit UUID
  • Per characteristic attribute:
    • 2 bytes for handle
    • 3 bytes if 16-bit UUID or 17 bytes if 128-bit UUID
    • 2 bytes for CCCD value (only if the attribute is a CCCD)

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:

  • Per characteristic attribute:
    • 3 bytes for CCCD value (only if the attribute is a CCCD)

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:

  • Per characteristic attribute:
    • 3 bytes for CCCD value (only if the attribute is a CCCD)

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

View solution in original post

1 REPLY 1
Remy ISSALYS
ST Employee

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) ]

  • total_size_of_nvm = 2028 bytes (fixed in M0)
  • size_of_sec_record = 80 bytes (this is a constant from the BLE stack)
  • size_of_gatt_record is dependent of the flags chosen in the application in app_conf.h file.

When SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM flag is set in CFG_BLE_OPTIONS:

The GATT DB record in NVM is composed:

  • Per service:
    • 2 bytes for handle
    • 3 bytes if 16-bit UUID or 17 bytes if 128-bit UUID
  • Per characteristic attribute:
    • 2 bytes for handle
    • 3 bytes if 16-bit UUID or 17 bytes if 128-bit UUID
    • 2 bytes for CCCD value (only if the attribute is a CCCD)

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:

  • Per characteristic attribute:
    • 3 bytes for CCCD value (only if the attribute is a CCCD)

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:

  • Per characteristic attribute:
    • 3 bytes for CCCD value (only if the attribute is a CCCD)

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