Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

NRF52840 Application boots from different flash address

Hi,

   In my project i need to include two different applications(one without soft device and and one with soft device) and a bootloader(secure ble) with nRF 5 SDK 17.1.0.

   Application1 START ADDRESS : 0x27000.

   Application2 START ADDRESS : 0xD8000.

   Bootloader  START ADDRESS : 0xF3000.

   Softdevice  START ADDRESS : 0x1000.

   1.I need to switch between application1 or application 2 from boootloader.How can we do this?.

   2.Is it possible to switch from app1 to app2 or vice versa?.

   we followed this link but it didn't helped. https://devzone.nordicsemi.com/f/nordic-q-a/85074/how-to-change-the-mbr-jump-address-location?pifragment-684=2 

  • Hi Akshay, 

    The bootloader setting by default only concern about the application located right after the softdevice. 

    So you don't need to include app2 into bootloader setting. 

    You can write app 2 after you have flashed everything. 

    Please be aware that app2 will not be able to be updated. If you want to update app 2 there must be some change to be added to the bootloader. 

    In addition, please make sure the bootloader will not allocate the location occupied by app2 to receive new image. 

    If you don't plan do to DFU then it shouldn't be a problem. 

  • Can i use the same gpgret register for switching between app1 and ap2 (0xB0 to go to app1 and 0xB2 to go to app2 ) .Any way this register is used to switch to OTA mode using 0xB1.

  • Hi Akshay, 
    No I don't see any problem doing that. You just need to implement the code in the bootloader to choose which application to jump to. 

  • Hi hung ,

                  we have one more issue where our App2 is a radio test example(pca10112) which from bootloader it is jumping to App2 but it is stuck at    app_timer_init(); -> NRF_ATFIFO_INIT(m_req_fifo); there is no return its just stuck inside this function.

    but i tried on uart peripheral example and also blinky ble example as app2 both  worked but on radio test example it is failing.

    and code i used to jump is :-

    if((nrf_power_gpregret_get() & SWITCH_APPLICATION2)==SWITCH_APPLICATION2){
    NRF_LOG_DEBUG("APP 2 0xD8000.");
    start_app_without_sd(0xD8000);
    }else{
    NRF_LOG_DEBUG("APP 1 0x27000.");
    start_app_with_sd(0x27000);
    }

    void start_app_with_sd(uint32_t startAddress)
    {
    nrf_dfu_mbr_init_sd();

    // Disable and clear interrupts
    NVIC->ICER[0] = 0xFFFFFFFF;
    NVIC->ICPR[0] = 0xFFFFFFFF;
    NVIC->ICER[1] = 0xFFFFFFFF;
    NVIC->ICPR[1] = 0xFFFFFFFF;

    sd_softdevice_vector_table_base_set(startAddress);
    nrf_dfu_mbr_irq_forward_address_set(MBR_SIZE);
    nrf_bootloader_app_start_final(startAddress);
    }

    void start_app_without_sd(uint32_t startAddress)
    {
    NVIC->ICER[0] = 0xFFFFFFFF;
    NVIC->ICPR[0] = 0xFFFFFFFF;
    NVIC->ICER[1] = 0xFFFFFFFF;
    NVIC->ICPR[1] = 0xFFFFFFFF;

    nrf_dfu_mbr_irq_forward_address_set(startAddress);
    nrf_bootloader_app_start_final(startAddress);
    }

      

  • Hi Akshay, 

    As mentioned in the previous reply, please re-post the code with Insert -> code.I can't read your code like that.

    I think it's because interrupt forwarding was not correct. The blinky doesn't use any interrupt when the radio test does use. 

    I think if you don't wan to update the radio test firmware, an easier way to do this is to integrate the radio test into the bootloader. You can perform radio test inside the bootloader if you want. 

Related