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

Best way to locate a buttonless device in DFU mode

I'm using the experimental buttonless DFU app in SDK v13 to automatically change a device without buttons to run in DFU mode for an update.

I'd like to automatically reconnect o the device after the mode switch in the same way as the nRF connect app dues during DFU.

However, once the mode has been switched, the device appears with a different UUID. What is the best way of automatically finding the device again once in this mode?

Ways I can think of (none of which seem guaranteed):

  • The new device UUID seems to always be one more then the initila device, can this be relied on and use a "guessed" UUID
  • Select a device with the name "DFUTarg". Perhaps the first one found or the ose with the strongest RSSI

Any help appreciated.

Cheers,

Rob

Parents
  • This snippet is taken from nrf_ble_dfu.c in the SDK:

    static uint32_t gap_address_change(void)
    {
        uint32_t            err_code;
        ble_gap_addr_t      addr;
    
    #ifdef NRF51
        err_code = sd_ble_gap_address_get(&addr);
    #elif NRF52
        err_code = sd_ble_gap_addr_get(&addr);
    #else
    
    #endif
    
        VERIFY_SUCCESS(err_code);
    
        // Increase the BLE address by one when advertising openly.
        addr.addr[0] += 1;
    
    #ifdef NRF51
        err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr);
    #elif NRF52
        err_code = sd_ble_gap_addr_set(&addr);
    #else
    
    #endif
    
        VERIFY_SUCCESS(err_code);
    
        return NRF_SUCCESS;
    }
    

    so I think it's safe to assume that the address will always be one more than the address of your peripheral.

    Edit: Didn't see the above answer before posting this.

Reply
  • This snippet is taken from nrf_ble_dfu.c in the SDK:

    static uint32_t gap_address_change(void)
    {
        uint32_t            err_code;
        ble_gap_addr_t      addr;
    
    #ifdef NRF51
        err_code = sd_ble_gap_address_get(&addr);
    #elif NRF52
        err_code = sd_ble_gap_addr_get(&addr);
    #else
    
    #endif
    
        VERIFY_SUCCESS(err_code);
    
        // Increase the BLE address by one when advertising openly.
        addr.addr[0] += 1;
    
    #ifdef NRF51
        err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr);
    #elif NRF52
        err_code = sd_ble_gap_addr_set(&addr);
    #else
    
    #endif
    
        VERIFY_SUCCESS(err_code);
    
        return NRF_SUCCESS;
    }
    

    so I think it's safe to assume that the address will always be one more than the address of your peripheral.

    Edit: Didn't see the above answer before posting this.

Children
No Data
Related