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

Issue detecting buttonless DFU characteristic

I'm trying to implement an application for the nRF52832 that will provide an OTA update to another external nRF52. The code for the device accepting the update has already been developed and is working fine with nRFConnect run on a Windows PC. When I try to send over an update from the nRF52, however, the board can't seem to detect the BLE characteristic to enter buttonless DFU mode. I can scan for and find the correct service (UUID 0xFE59), but when I try to discover characteristics for this service I find only one, with a UUID of 0x0000. By contrast, when I examine the same service with nRF Connect I see the Secure DFU service (UUID 0xFE59) containing a Buttonless DFU characteristic (UUID 8ec90003-f315-4f60-9fb8-838830daea50).  I'm using the following code to discover the DFU service and characteristic:

#define BLE_DFU_SERVICE_UUID                 0xFE59                       //!< The UUID of the DFU Service.

 

uint32_t dfu_svc_init(void)

{

    ble_uuid_t buttonless_dfu_uuid;

 

    buttonless_dfu_uuid.type = BLE_UUID_TYPE_BLE;

    buttonless_dfu_uuid.uuid = BLE_DFU_SERVICE_UUID;

 

    return ble_db_discovery_evt_register(&buttonless_dfu_uuid);

}

 

void fw_update_on_db_disc_evt(kc_dev_context_t * dev_context, const ble_db_discovery_evt_t * p_evt)

{

    if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE)

    {

        for (uint32_t i = 0; i < p_evt->params.discovered_db.char_count; i++)

     {

         const ble_gatt_db_char_t * p_char = &(p_evt->params.discovered_db.charateristics[i]);

         NRF_LOG_DEBUG("p_char->characteristic.uuid.uuid: 0x%X\r\n", p_char->characteristic.uuid.uuid);

     }

    }

}

Why might I not be seeing the Buttonless DFU characteristic? Is there something I'm missing/not doing correctly in either the service or characteristic discovery? I'm working with SDK 13.

  • Turns out the issue was that I needed to add the Nordic vendor specific UUID in order for the characteristic to be discovered. I changed my init function to the following:

    #define BLE_DFU_SERVICE_UUID 0xFE59 //!< The UUID of the DFU Service.
    #define BLE_NORDIC_VENDOR_BASE_UUID \
    {{ \
    0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, \
    0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0xC9, 0x8E \
    }}

    uint32_t dfu_svc_init(void)
    {
        ble_uuid_t buttonless_dfu_uuid;
        ble_uuid_t nordic_uuid;
        ble_uuid128_t nordic_base_uuid = BLE_NORDIC_VENDOR_BASE_UUID;
        uint8_t nordic_base_uuid_type;
        uint32_t err_code;

        err_code = sd_ble_uuid_vs_add(&nordic_base_uuid, &nordic_base_uuid_type);
        VERIFY_SUCCESS(err_code);

        nordic_uuid.type = nordic_base_uuid_type;
        nordic_uuid.uuid = BLE_DFU_SERVICE_UUID;

        err_code = ble_db_discovery_evt_register(&nordic_uuid);
        VERIFY_SUCCESS(err_code);

        buttonless_dfu_uuid.type = BLE_UUID_TYPE_BLE;
        buttonless_dfu_uuid.uuid = BLE_DFU_SERVICE_UUID;

        return ble_db_discovery_evt_register(&buttonless_dfu_uuid);
    }

Related