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

We're porting an nRFS52832 app from an earlier version (14) to 15.2. Using sd_ble_gap_device_name_set( &secMode, dN, len ) with a string of length=9 will only show 5 chars (e.g. with nRFconnect). What's going wrong?

We're porting an nRFS52832 app from an earlier version (14) to 15.2.
Using sd_ble_gap_device_name_set( &secMode, dN, len ) with a string of length=9 will only show 5 chars (e.g. with nRFconnect). What's going wrong?

Parents
  • Hi. 

    The only reason that I can think of that is causing the device name to be shortened is that your advertising packet is full. If you exceed the limit of 31 bytes in the advertising packet, the advertising name will automatically be cut. 

    Did you advertising packet remain the same after migrating to v.15.2? If you added more data to the advertising packet, this might be the reason for the shortened name. If your advertising data remained the same over the migration, this should work as in v.14. 
    If you could post your code related to the advertising, I can take a look.

    Best regards, 
    Joakim Jakobsen

  • Hi Joakim

    thanks for your answer. The code is in fact completely different compared to SDK 14, as the routines are not the same. Where can I influence the advertising data packet to make it smaller?

    Below the code for init advertising. Just let me know if you need some additional info about some of the used const or subroutines.

    Best Regards

    Beat

    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.short_name_len          = 9;  
        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.advdata.uuids_complete.uuid_cnt = 1;
        init.advdata.uuids_complete.p_uuids  = (ble_uuid_t *)&mAdvList;
        init.advdata.p_manuf_specific_data   = (ble_advdata_manuf_data_t *)&mAdvManuf;

        init.config.ble_adv_fast_enabled  = true;
        init.config.ble_adv_fast_interval =    40; // APP_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout  = 18000; // 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);
    }

  • Beat Forster said:
    The code is in fact completely different compared to SDK 14

     Then the issue is most likely cause by too much data in the advertising packet.

    Where you can shave off some bytes from your advertising data needs to be up to you. There is some header that needs to be included in the advertising packet, so there is actually only 29 bytes of user configurable data available. 
    You are including the UUID in your advertising packet, I don't know if this is a custom 128-bit UUID? Is it is, this will take a large chunk of the available advertising data (16 bytes). With the advertising name of 9 bytes, this will add up to 25 bytes and only 4 bytes left. I see that you also included some manufacturer specific data? This might be the best place to reduce the amount of data in the advertising packet. 

    Note that you could also add a scan response packet with additional data. This will allow you to add an additional 31 bytes of data to your advertising. 

    An example of how to add data to the scan response packet, can bee seen in the ble_app_uart example. 

    Best regards, 
    Joakim Jakobsen

  • Hi Joakim

    thanks for your detailed answer and your hints. I'll check that in detail, especially with your sample code. Though the code is different to SDK 14, I think we're using the same advertising data there without a size restriction. Currently up to 5 chars will be sent with SDK 15.2, so it's still unclear to me why it works with SDK 14.

    Best Regards

    Beat

  • No problem. 

    If you can upload main.c file (or preferably your entire project) I could take a closer look and do some tests on my side. 

    I can turn the ticket private first, if you don't want to share your code on the public forum. 

    Best regards, 
    Joakim Jakobsen

Reply Children
Related