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

set custom GAP name failing due wrong max name length

I am using the code

err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)deviceName, nameLen);

I have made sure that nameLen is less than BLE_GAP_DEVNAME_MAX_LEN and that deviceName is null terminated at BLE_GAP_DEVNAME_MAX_LEN

but the err_code I get is NRF_ERROR_INVALID_PARAM when nameLen is 23

but if I set nameLen to a number less than or equal to 14, it works without any errors.

If I set nameLen to 15, it gives me NRF_ERROR_DATA_SIZE instead

BLE_GAP_DEVNAME_MAX_LEN is 31 inside ble_gap.h , is this number wrong?

I am using S110 version 5.2.1 on nRF51844

Parents
  • My suspicion is that this is a limitation in the length of the advertising packet, which is maximum 31 bytes. What other data is in your advertising packet? Try to reduce other data in your advertising packet and then increase your device name length.

Reply
  • My suspicion is that this is a limitation in the length of the advertising packet, which is maximum 31 bytes. What other data is in your advertising packet? Try to reduce other data in your advertising packet and then increase your device name length.

Children