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

Parents
  • 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.

Reply
  • 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.

Children
No Data
Related