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

Buttonless DFU jumps to Application not Bootloader

Hi everybody,

we have implemented DFU with button and it works like a charm. Now we want to improve that and implemented the buttonless version too. Though, instead of starting the bootloader the application is restarted. There may be something wrong with addresses causing this behavior.

Here is the code called when triggering DFU from application:

static void boot_start(void) {
	ble_conn_params_stop();
	sd_power_gpregret_clr(POWER_GPREGRET_GPREGRET_Msk);
	sd_power_gpregret_set(BOOTLOADER_DFU_START);
	sd_softdevice_disable();
	interrupts_disable();
	sd_softdevice_vector_table_base_set(CODE_REGION_1_START);	
	bootloader_util_app_start(CODE_REGION_1_START);
}

Looking forward to your reply.

Best Philipp

  • Could you state the SDK version you are using ?

    I assume you flashed the normal bootloader before you update the buttonless DFU application via the DFU process, as described here.

  • I am suing SDK11 with a makefile project using Eclipse and GCC. Our bootloader is based on Noric examples, though adjusted to our board. In bootloader, we check then content of gpregret to differentiate between button and button-less DFU, e.g. initiating ble stack.

    Though, when in bootloader I lightup an LED. Also, during normal startup I see theis LED blinking when going through bootloader. this is not the case, when initiating button-less DFU. Only the application is restarted, which is why I assume something with addresses maybe wrong. I just can find the cause....

  • @Philipss: Please state with step by step how you tested your set-up. You can start with step one: flashing the softdevice.

  • @Hung Is this sufficient or do you need more details for specific steps?

    1. Flash devices with batch script in following order: Softdevices, bootloader, app & app valid settings 2) Restart devices (I can see the bootloader is started first due to LED briefly lighting up)
    2. Connecting to device with nRF Connect App
    3. Writting the 'magic word' to our 'DFU service' to trigger buttonless DFU
    4. Devices disconnects correctly
    5. Device restarts into the application (not going over bootloader as LED is not blinking briefly)
  • Thanks Philipp, it's more clear now. Could you explain why you have these code:

    sd_softdevice_vector_table_base_set(CODE_REGION_1_START);   
    bootloader_util_app_start(CODE_REGION_1_START);
    

    Note that CODE_REGION_1_START is where your application start, not where the bootloader start (it start from NRF_UICR->NRFFW[0] . In addition, if you want to forward bond information you may need to set them into the no-init RAM memory using svc call dfu_ble_svc_peer_data_set().

    I would suggest you to have a look at the function bootloader_start() in dfu_app_handler.c in the ble_app_hrs\pca100040\s132_with_dfu example (our buttonless DFU application example)

    One easier way of doing this is to simply set GPREGRET, then disconnect and do a softreset (NVIC_SystemReset). But this way, you don't forward bonding information to the bootloader.

    Note that from SDK v12 the bootloader is refactored and is not compatible with the old one, it's strongly suggested to use the new secure bootloader from SDK v12.

Related