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

Why is my device name being truncated?

Using SDK 14.0.0 with SD 132 v5, the device name I'm advertising with here is "000000DK". But the advertising module is truncating it to "0000". It will do this if I have too much advertising data, but I don't. I should have 31 bytes and that should be fine. It was fine with SDK 12.1 and an earlier SD version.

image description

I've read this post on the same subject, but it doesn't explain this:

devzone.nordicsemi.com/.../

It looks like it's the appearance that's overflowing me. This was never a problem before and if I now omit any call to sd_ble_gap_appearance_set(), I get 0x0000 as the appearance field, whereas I think I used to get no appearance field at all. How do I remove the appearance and get the same behaviour I used to have with the earlier SDK/SD?

Parents
  • This is an old thread but thought to give an update in case someone stumbles upon this problem.

    As mentioned before, the advertisement space is limited to 31 bytes including device appearance, name and other advertisement data. To have longer name, you need to get rid of something else (for example appearance, which gives some 4 bytes more space, or UUID, which gives a lot more).

    Here's a demonstration of the advertising_init() function that is used to configure the advertisements. The comments show where you can give more space for the device name (appearance and UUID).

    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; //<< To remove appearance, set this to false
        init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        
        //<< Comment out these 2 lines to remove the UUID from the advertisement
        //<< This gives a lot of space for the name.
        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);
    }

Reply
  • This is an old thread but thought to give an update in case someone stumbles upon this problem.

    As mentioned before, the advertisement space is limited to 31 bytes including device appearance, name and other advertisement data. To have longer name, you need to get rid of something else (for example appearance, which gives some 4 bytes more space, or UUID, which gives a lot more).

    Here's a demonstration of the advertising_init() function that is used to configure the advertisements. The comments show where you can give more space for the device name (appearance and UUID).

    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; //<< To remove appearance, set this to false
        init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        
        //<< Comment out these 2 lines to remove the UUID from the advertisement
        //<< This gives a lot of space for the name.
        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);
    }

Children
No Data
Related