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

Repeatedly performing OTA with updated firmware

Hi,

I have the NRF52 dev kit with NRF522832 chip. I am using SDK version 15.2 and the Segger IDE. I am trying to do OTA programming and have used this tutorial:

https://devzone.nordicsemi.com/nordic/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader

I have taken the sample ble_blinky_app in the examples and my own code and this is what I tried out:

1. Generated the private and public key with nrfutil.exe.

2. Used the secure_dfu_bootloader in examples\dfu\secure_bootloader. Mine is the PCA10040 chip so I am using the code in pca10040_ble. I am able to program the bootloader and the dev kit broadcasts DfuTarg.

3. I compiled both blinky app and my own code with the private key and generated two different .zip packages.

4. I used the NRF Connect app to connect to the dev kit DfuTarg and did OTA programming with the DFU button that appears once you connect. The blinky app was programmed and I tested it out.

5. I then tried to reprogram the kit through OTA. This time the kit broadcasted "Nordic Blinky" as the blinky app was programmed. This time I could not find the DFU button. How do I reprogram through OTA when there is another application already programmed?

6. I had to erase the blinky application and reprogram the DFU bootloader in order to perform OTA programming.

How can I repeatedly perform OTA programming? The rest of the tutorial talks about combining bootloader, application and soft device. Do I have to do this? I am having a tough time trying to figure out what exactly I need to do to achieve repeated OTA programming capability.

Thanks in advance.

  • Hi,

    You only need to generate the settings page when you are flashing SD+BL+APP with the programmer and want the bootloader to start the application (in production for instance).

    The bootloader will manage the settings page when you upload the application through DFU. 

  • Hi,

    Thanks again. This is what I did. I took the ble_app_buttonless_dfu. I configured a GPIO as output and connected an LED to it. I flashed the LED 10 times and after the 10th time, I ran the function:

    ble_dfu_buttonless_bootloader_start_finalize();

    This stops the LED flashing and the kit now starts broadcasting DfuTarg. So, this reverts back to the bootloader through software which is exactly what I want. But, after a minute or so, the application starts up again. So, is there a timer in-built into the DFU bootloader?

    In my application, I will be programming the kits initially through OTA. However, later these kits might be fitted on an experimental setup and we may not be able to flash the code by physically connecting a USB cable. So at that time, we need to do OTA programming. So, we could use an app to send a passcode to it through BLE to run that function above and go back to the DFU bootloader. After that we can upload the next firmware through OTA programming.

    Thanks again for your help.

  • Sounds like it's working correctly now. Yes, the bootloader will time out after 2 minutes of inactivity (default). On timeout, it will either reset and go back to DFU mode, or reset and boot the application (if there's is a valid app in bank 0). 

  • Thank you so much for your help. I will verify these answers.

Related