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

A question about ota

Hi, all! I am rencently studying ota,and that is what I have done:

  1. Program softdevice 6.0 into my nrf51822 chip.
  2. Program bootloader(version in SDK5.2) into my nrf51822 chip.
  3. Use Nrf_TooBox app to upload an application into my nrf51822 chip by means of OTA.

So far the OTA is finished.But I got the further question:

If the application I upload into my chip is a normal application without the function of DFU(like ble_app_hrs), how could the chip be able to go back to the bootloader again and then run the ota again? If possiable,please tell me what I should do in deteils.

Looking forward to your reply. Thank you very much!

  • I think I got the right answer after reading the similar question in forum. And my solution is:

    1. about application code,just set the NRF_POWER->GPREGRET=1 and on power reset the chip is enough:

         sd_softdevice_disable();	 
         NRF_POWER->GPREGRET = 1;
         NVIC_SystemReset();
      

    or just use

           sd_power_gpregret_set(1);
    

    if you don't disable the softdevice;

    1. about bootloader, set the NRF_POWER->GPREGRET=0 is enough:

    replace the code like this:

        uint32_t a;
        sd_power_gpregret_get(&a);
        if (bootloader_is_pushed || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)) || (a == 1))
        {
             nrf_gpio_pin_set(LED_2);
    
             sd_power_gpregret_set(0);
    
            // Initiate an update of the firmware.
            err_code = bootloader_dfu_start();
            APP_ERROR_CHECK(err_code);
    
            nrf_gpio_pin_clear(LED_2);
         }
    

    If something is wrong or missing, please point it out. Thank you very much!

  • Looks about right. It is very similar to what I do to enter the bootloader by host command.

Related