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

Device name too short?

When trying out the ble_app_hrs_freertos example in nRF5 SDK 11.0.0-2.alpha_bc3f6a0, I seem to only get 14-character long device name announcements.

This happens when using components/softdevice/s132/hex/s132_nrf52_2.0.0-7.alpha_softdevice.hex.

I haven't had a chance yet to try it with s132_nrf52_1.0.0-3.alpha_softdevice.hex, which I had experience using from the nRF52 SDK 0.9.2.

Parents
  • I reproduced the behavior, and did some investigation.

    The SDK module ble_advertising.c shortens the name if there is not room for the full name in the advertisement packet. (Added in SDK 11). The total amount of bytes in the advertisement cannot exceed 31 bytes.

    From ble_advdata.c:

    else
        {
            // Else short name needs to be used. Or application has requested use of short name.
            adv_data_format = BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME;
    
            // If application has set a preference on the short name size, it needs to be considered,
            // else fit what can be fit.
            if ((BLE_ADVDATA_SHORT_NAME == p_advdata->name_type) &&
                    (p_advdata->short_name_len <= rem_adv_data_len))
            {
                // Short name fits available size.
                actual_length = p_advdata->short_name_len;
            }
            // Else whatever can fit the data buffer will be packed.
            else
            {
                actual_length = rem_adv_data_len;
            }
        }
    
Reply
  • I reproduced the behavior, and did some investigation.

    The SDK module ble_advertising.c shortens the name if there is not room for the full name in the advertisement packet. (Added in SDK 11). The total amount of bytes in the advertisement cannot exceed 31 bytes.

    From ble_advdata.c:

    else
        {
            // Else short name needs to be used. Or application has requested use of short name.
            adv_data_format = BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME;
    
            // If application has set a preference on the short name size, it needs to be considered,
            // else fit what can be fit.
            if ((BLE_ADVDATA_SHORT_NAME == p_advdata->name_type) &&
                    (p_advdata->short_name_len <= rem_adv_data_len))
            {
                // Short name fits available size.
                actual_length = p_advdata->short_name_len;
            }
            // Else whatever can fit the data buffer will be packed.
            else
            {
                actual_length = rem_adv_data_len;
            }
        }
    
Children
Related