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

Device Name Issue

Hi,
I am following the below link for creating custom services/characteristics.
https://github.com/bjornspockeli/nRF52-Bluetooth-Course 
 I have set the device name as follows but BLE is advertising only with the first 4 chars.

#define DEVICE_NAME "Nordic_Template" /**< Name of device. Will be included in the advertising data. */

The BLE advertising name is showing "Nord".

The device shows only the first 4 letters.

Does any suggestion please?

Thanks!
  • Hi

    I think the advdata.name_type is set to BLE_ADVDATA_SHORT_NAME in your advertising_init() function, as this will only take up 4 bytes of the advertisement and use the first 4 characters of the device name. You can try changing this to BLE_ADVDATA_FULL_NAME to add the full device name in your advertisement. Keep in mind that using a name as long as Nordic_Template will take up 15/31 of the bytes that are available for an advertisement package, so you won't be able to fit much else into that advertising packet.

    Best regards,

    Simon

  • Hi

    I have checked in  advertising_init() . Here is the function.
    Its already  BLE_ADVDATA_FULL_NAME

    static void advertising_init(void)
    {
    ret_code_t err_code;
    ble_advertising_init_t init;

    memset(&init, 0, sizeof(init));

    init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance = true;
    init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.advdata.uuids_complete.p_uuids = m_adv_uuids;

    init.config.ble_adv_fast_enabled = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout = APP_ADV_DURATION;

    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }

  • Okay, then you're likely seeing this "short" device name because the advertising packet is filled with other advertising data, and only has room for 4 bytes for the advertising name. You have a few options here. If you need the full advertising name in the advertising packet, you can reduce the length of the advertising name, or you can remove some of the other advertising data. You can alternatively add the full name to a scan response packet if you'd like (see this guide for more information on scan response packets). 

    Best regards,

    Simon

  • Hi
    I have checked the given link but still getting the issue.
    I am attaching the project. Can you please check where I am making mistake? Thanks
    Project

  • Problem Solved. By moving UUID's to the scan response instead of the advertising. Like this.

        init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
        init.srdata.uuids_complete.p_uuids  = m_adv_uuids;


    Thanks!

Related