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

Bootloader advertising changed from DfuTarg to Dfu

I want to distinguish between my customized bootloader builds, for that I added some specific manufacturer data to the bootloader. I added 1 byte of manufacturer, but then the DfuTarg advertising name changed to Dfu as shown in the image below (length 0x08 but data are only 3 bytes).

what's the issue !!! does that means that the advertising packet is already full and I shouldn't add any byte??

is there anyway not to send all the 16 bytes of UUID to keep place for manufacturer data??

Bootloader advertising init

static void advertising_init(uint8_t adv_flags)
{
    uint32_t      err_code;
    ble_advdata_t advdata;
    ble_uuid_t    service_uuid;
    uint8_t                     adv_manuf_data_data[1];
    uint8_array_t               adv_manuf_data_array;
    ble_advdata_manuf_data_t    manufacturer;

    service_uuid.type = m_dfu.uuid_type;
    service_uuid.uuid = BLE_DFU_SERVICE_UUID;

    // Build and set advertising data.
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type                     = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance            = false;
    advdata.flags                         = adv_flags;
    advdata.uuids_more_available.uuid_cnt = 1;
    advdata.uuids_more_available.p_uuids  = &service_uuid;
    
    adv_manuf_data_data[0] = (uint8_t)0xBB;
    adv_manuf_data_array.p_data = adv_manuf_data_data;
    adv_manuf_data_array.size = 1;

    manufacturer.company_identifier = 7;
    manufacturer.data = adv_manuf_data_array;

    advdata.p_manuf_specific_data = &manufacturer;

    err_code = ble_advdata_set(&advdata, NULL);
    APP_ERROR_CHECK(err_code);
}

bootloader.rar

image description

Parents
  • Hi Makouda,

    Isn't it already 31 bytes in the RAW data you showed in the above image ?

    Note that there are flags (first 3 bytes), UUID ( next 18) manufacturing data (including 2 bytes company ID , next 5 bytes) so there is only 5 bytes left for the device name. And the adv module has a "smart" feature to use BLE_ADVDATA_SHORT_NAME instead of the FULLNAME if the space is not enough.

    Note that the lengths are also occupy one byte for each of them. If you want to add extra data, you can think of using scan response packet.

    Also please declare uint8_t adv_manuf_data_data[1]; as public/static variable otherwise it will be cleared after the function finishes.

  • hye Hung I didnt really get it. first : even if there is only 5 bytes left for the device name, then why didn't advertise DfuTa instead of Dfu. second I didn't understated when you say manufacturing data (including 2 bytes company ID , next 5 bytes) I only put one byte for manufacturing data !!! aslo by summing 3 + 18 + 2 + 5 + 5 = 33. do you mean only 3 bytes left for the name?????

Reply
  • hye Hung I didnt really get it. first : even if there is only 5 bytes left for the device name, then why didn't advertise DfuTa instead of Dfu. second I didn't understated when you say manufacturing data (including 2 bytes company ID , next 5 bytes) I only put one byte for manufacturing data !!! aslo by summing 3 + 18 + 2 + 5 + 5 = 33. do you mean only 3 bytes left for the name?????

Children
No Data
Related