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

Set a name in beacon example SDK 12

Hey guys,

I have followed this tutorial that shows how to modify advertising data, and more particularly the name.

What I want to do is set a name in the beacon example of the SKD 12. With this example, nRF Connect sees my device as "N/A". So here is what I have done so far:

I have defined the device name :

#define DEVICE_NAME                      "test"

As there is no "gap_params_init()" in this example, I have tried to send only the name in the softdevice with those lines between "ble_stack_init()" and "advertising_init()":

ble_gap_conn_sec_mode_t sec_mode;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
err_code = sd_ble_gap_device_name_set(&sec_mode,
                                      (const uint8_t *)DEVICE_NAME,
                                      strlen(DEVICE_NAME));

Finally, I have changed one line in "advertising_init()", from :

advdata.name_type             = BLE_ADVDATA_NO_NAME;

To :

advdata.name_type             = BLE_ADVDATA_FULL_NAME;

This last change give me an error (12) when "ble_advdata_set" is executed. I have found that error 12 is NRF_ERROR_DATA_SIZE.

So I have tried to increase APP_ADV_DATA_LENGTH from 0x15 to 0x19 ( 4 bytes of "test") but I get the same error.

Can someone help me to find what I am missing or what I am doing wrong?

Thanks for your help!

Related