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

Jumping to Bootloader from the Application

How can I jump to the bootloader from the application without anything BLE related. Possibly through a botton?

I'm on the newest SDK v11.

Parents
  • In order to jump to the bootloader , you have to add this define in your application project

    #define BOOTLOADER_DFU_START 0xB1
    

    and call the following functions when the button is pressed:

    if (button_is_pressed)
    
    {
        //  Write to the the GPREGRET REGISTER and reset the chip
    
       //You can use the sd_-functions 
    
        err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START);
    
        APP_ERROR_CHECK(err_code);
    
        sd_nvic_SystemReset();   
    
    
       //OR set the register directly and then call NVIC_SystemReset(); 
    
        NRF_POWER->GPREGRET = BOOTLOADER_DFU_START;
    
        NVIC_SystemReset();
    }
    

    In the bootloader you have to remove the init_softdevice check in ble_stack_init(), i.e.

    //if (init_softdevice)
    
    //{
        err_code = sd_mbr_command(&com);
    
        APP_ERROR_CHECK(err_code);
    //}
    

    -Bjørn

Reply
  • In order to jump to the bootloader , you have to add this define in your application project

    #define BOOTLOADER_DFU_START 0xB1
    

    and call the following functions when the button is pressed:

    if (button_is_pressed)
    
    {
        //  Write to the the GPREGRET REGISTER and reset the chip
    
       //You can use the sd_-functions 
    
        err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START);
    
        APP_ERROR_CHECK(err_code);
    
        sd_nvic_SystemReset();   
    
    
       //OR set the register directly and then call NVIC_SystemReset(); 
    
        NRF_POWER->GPREGRET = BOOTLOADER_DFU_START;
    
        NVIC_SystemReset();
    }
    

    In the bootloader you have to remove the init_softdevice check in ble_stack_init(), i.e.

    //if (init_softdevice)
    
    //{
        err_code = sd_mbr_command(&com);
    
        APP_ERROR_CHECK(err_code);
    //}
    

    -Bjørn

Children
Related