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

BLE Central: Service Not Found, while trying to implement a DFU Client

Hello.

I wish to implement a DFU Client. One (USB connected) nRF52840 based device should update an other (Wireless) nRF52840 device.

As the SDK only has a DFU service and not a DFU client, I'd figured I'd have to implement that myself. As a base, I started at ble_lbs_c.

I have replaced

#define LBS_UUID_BASE {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, \
0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00}
#define LBS_UUID_SERVICE 0x1523

by

#define BLE_DFU_UUID_BASE     { 0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, \
                            0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0xC9, 0x8E }
#define BLE_DFU_SERVICE (0xFE59)

Now, the central connects to a peripheral in bootloader, but it is not able to find the bootloader service.

When I scan the device with the Android version of nRF Connect, it does show there is a service 0xFE59.

When I add a on_adv_report handler, a call to ble_advdata_uuid_find reveals there is no uuid data in the advertisement.

How can I properly detect the DFU Service running on a peripheral from a central?

Parents
  • I have made some progress. Looking up on the ble_db_discovery_start function, it states says

    This API propagates the error code returned by the SoftDevice API sd_ble_gattc_primary_services_discover. 

    Then when I call

                sd_ble_gattc_primary_services_discover( p_gap_evt->conn_handle, 3, NULL);

    before calling

    err_code = ble_db_discovery_start(&m_db_disc, p_gap_evt->conn_handle);

    the Service gets discovered.  Only if I call both, and in that order.

    This is some ugly hack, and I am looking to do this properly.

Reply
  • I have made some progress. Looking up on the ble_db_discovery_start function, it states says

    This API propagates the error code returned by the SoftDevice API sd_ble_gattc_primary_services_discover. 

    Then when I call

                sd_ble_gattc_primary_services_discover( p_gap_evt->conn_handle, 3, NULL);

    before calling

    err_code = ble_db_discovery_start(&m_db_disc, p_gap_evt->conn_handle);

    the Service gets discovered.  Only if I call both, and in that order.

    This is some ugly hack, and I am looking to do this properly.

Children
Related