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

Buttonless DFU not starting unless reconnect

Hi,

I am trying to implement buttonless DFU by following the ble_app_hrs example provided in the SDK and modifying the bootloader (nRF51_SDK_10.0.0\examples\ble_peripheral\ble_app_hrs\pca10028\s110_with_dfu and nRF51_SDK_10.0.0\examples\dfu\bootloader\pca10028\dual_bank_ble_s110).

I have successfully added the DFU service to my application, created a .zip archive using methods in this post and finally programming the bootloader with the correct bits set using suggestions from this post.

When connecting to my device using the nRF Master Control panel app on Android, the DFU button is present and I am able to enter the DFU mode and select the .zip file with the new firmware.

Once entering the upload mode I see the messages: Initializing... Starting DFU... Starting Bootloader... and finally Connecting... in the nRF Master Control Panel.

Here the application get stuck, and the upload never start.

However, if I now (in the nRF control panel app) go back to the "Scanner" tab and re-scan I can reconnect to my device and press the DFU button again. This time the DFU works. The new firmware is uploaded and and my application starts as expected.

Does anyone have a clue why the DFU gets stuck the first time? Did I perhaps forget to set some flags, or need to modify the bootloader? I would of course like my app to upload directly without having to reconnect.

Thanks for any suggestions /Fredrik

  • No 14 

    I can boot in bootloader usinf NRF COnnect by sending 0x01 and enable notification

    but after that I can't connect to DfuTarg it stays stuck in connecting.

    Forgot to mention It is custom board so I font' have external clock. I changed it to inetrnal in sdk_config for the APP but not sure if I need to do something special for bootloader as well.

    UPDATE: Confirming that making the change in bootloader for clock fixed my issue!

    This would be great if somehow you could detect some clock mismatch between the APP and the bootloader :)

    Here are the log.

    static void wait_for_event()
    {
        while (true)
        {
            app_sched_execute();
            if (!NRF_LOG_PROCESS())
            {
            #ifdef BLE_STACK_SUPPORT_REQD
                (void)sd_app_evt_wait();
            #else
                __WFE();
            #endif
            }
        }
    }


    0> <info> app: Device is preparing to enter bootloader mode.
     0> <info> app: Device will enter bootloader mode.
     0> <info> app: Power management wants to reset to DFU mode
     0>
     0> <info> app: reset_prepare disconnect from peer
     0> <info> app: reset_prepare app_timer_stop_all
     0> <info> app: reset_prepare ble_conn_params_stop
     0> <info> app: startDFU enter
     0>
     0> <info> app: Inside main
     0> <debug> app: In nrf_bootloader_init
     0> <debug> app: In real nrf_dfu_init
     0> <debug> nrf_dfu_settings: Running
    nrf_dfu_settings_init(sd_irq_initialized=false).
     0> <debug> nrf_dfu_flash: Calling
    nrf_dfu_flash_init(sd_irq_initialized=false)...
     0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
     0> <debug> app: Initializing the clock.
     0> <debug> app: Enter nrf_dfu_continue
     0> <debug> app: Valid App
     0> <debug> app: In nrf_dfu_enter_check user
     0> <debug> app: enter FDU
     0> <debug> app: Application sent bootloader request
     0> <debug> app: In nrf_dfu_transports_init
     0> <debug> app: num transports: 1
     0> <debug> app: Initializing BLE DFU transport
     0> <debug> app: vector table: 0x00073000
     0> <debug> app: vector table: 0x00073000
     0> <debug> app: Error code - sd_softdevice_vector_table_base_set: 0x00000000
     0> <debug> app: Enabling SoftDevice.
     0> <warning> nrf_sdh_ble: RAM starts at 0x20002830, can be adjusted
    to 0x20002180.
     0> <warning> nrf_sdh_ble: RAM size can be adjusted to 0xDE80.
     0> <debug> app: SoftDevice enabled.
     0> <debug> app: nrf_dfu_settings_adv_name_is_valid FALSE
     0> <debug> app: Regular adv name
     0> <debug> app: #### Advertising NO BONDING ####
     0> <debug> app: Finished initializing BLE DFU transport
     0> <debug> app: After nrf_dfu_transports_init
     0> <debug> nrf_dfu_flash: Calling
    nrf_dfu_flash_init(sd_irq_initialized=true)...
     0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
     0> <debug> app: Waiting for events
     0> <debug> app: #### Advertising NO BONDING ####
     0> <debug> app: #### Advertising NO BONDING ####
     0> <debug> app: #### Advertising NO BONDING ####
     0> <debug> app: #### Advertising NO BONDING ####
     0> <debug> app: #### Advertising NO BONDING ####
     0> <debug> app: #### Advertising NO BONDING ####

  • : Happy to hear that you found the cause and the solution to the issue. It is the developer that should ensure that the correct clock configuration is used in the bootloader and/or application when running code on custom boards. However, I agree that it would be a useful feature and I will pass on this feedback. 

Related