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

nRF51822 Dfu from own ble application

When starting with nRFgo Studio "Erase all", "Program SoftDevice" & "Program Bootloader" to have a almost virgin base without an application, I succeed perform an over the air update and got a running application afterwards.

But from this point, when e.g. version 1.0 of my application is currently runnung and I want to update it over the air to version 1.1, it currently won't work.

Seems that I have to append my own application with DFU service, isn't it? Is there an example available which provides such functionality (preferably compiles with gcc)? How to extend the sdk's nrf6310/s110/ble_app_hrs example for that ability?

Well, I think the application should not do the update job fully itself. Rather should the application e.g. do maybe some DFU initialization and than transfer the control to the bootloader which performs the main job of the update.

BTW: When using nRF Master Control Panel (on Android), I sometimes see the [DFU] button even when my own application is running. But I think that's a bug in the Android app, because the button is not working properly. The iPhone app "nRF Loader" does not see a DFU target in that case.

Parents
  • Hi Joe,

    The way the DFU bootloader example work is that, the bootloader will always be started first after the softdevice. When it starts it will check if the DFU button is pressed, it will enter DFU mode. If not, it will check for a valid application, in this case you already have the valid application v1.0, it will execute the application, if not it will run the DFU.

    So to force the bootloader to DFU mode you would need to either press the DFU button (bootloader_is_pushed). If you don't want to press the button but have a command from the BLE master to force the device to enter DFU mode you can refer to several similar cases here:

    devzone.nordicsemi.com/.../dfu

    devzone.nordicsemi.com/.../firmware-update-without-button-press

  • Your understanding is correct, Joe. You use your proprietary trigger to set a flag in flash or in GPREGRET register and then reset, after that in the bootloader you check for that flag, if it is set, you enter DFU mode, if it is not, you run to application. (Remember to clear the flag after bootloader run) When the bootloader run into DFU mode, you can use our app (nRF Toolbox, nRF Master Control Panel, nRF Loader) or you can integrate it in your own app. The source codes are provided (not the Master Control Panel) so you should have no problem integrate the DFU feature.

Reply
  • Your understanding is correct, Joe. You use your proprietary trigger to set a flag in flash or in GPREGRET register and then reset, after that in the bootloader you check for that flag, if it is set, you enter DFU mode, if it is not, you run to application. (Remember to clear the flag after bootloader run) When the bootloader run into DFU mode, you can use our app (nRF Toolbox, nRF Master Control Panel, nRF Loader) or you can integrate it in your own app. The source codes are provided (not the Master Control Panel) so you should have no problem integrate the DFU feature.

Children
No Data
Related