This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

The length of nRF51822 device name

Hello everyone, I recently use the nRF51822 with SD9 and S110, I found that the device name was define as: #define BLE_GAP_DEVNAME_MAX_LEN 31 is it means the max length of device name is 31 bytes ? but when I try to change the device name as "0123456789ABCDEFABCDEF", system return an error code :NRF_ERROR_DATA_SIZE, what's the matter ? the new device name is only 21 bytes , isn't it ?

  • No, DEVICE NAME string cannot be 31 Bytes because whole Adv. data (or Scan resp. data) have 31 Bytes max and GAP AD element overhead are at least 2 bytes (Tag and Length). In addition if you want to add Device Name AD into Adv. data then you have at least 3 bytes of additional overhead because of mandatory Flags AD element. When it comes to Device Name Characteristic value that can be pretty much as long as you want so it should accommodate full string without need of any shortening.

Related