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

DFU OTA update

I have programmed custom services on my evaluation kit and everything works great. I am now looking to implement updating my application from iOS and Android app.

Using:

SDK 5.2.0 S110 6.0.0

I have been trying to understand how to use the bootloader and do DFU but not able to wrap my head around it. I checked out the Bootloader/DFU example in the documentation. When I open the Keil project and select dfu_dual_bank for s110. I see dfu_dual_bank.c & dfu_transport_ble.c but I don't see those filed included or referenced anywhere.

What is the procedure for add dfu to an existing application for the evaluation kit ? Is the DFU implemented as a service ?

I see services_init in dfu_transport_ble but I don't see a main() function in that file. But don't see other functions being referenced. Also functions like advertising_start() one_ble_evt() ble_evt_dispath() etc are in dfu_transport_ble.c

If I have other services do I need to move these functions from dfu_transport_ble.c to main.c to combine them ?

Not able to understand where to start and how to add.

  • The DFU is it's own project rather than a part of your application. It is set up to reside in high memory out of the way of the application FW you are creating. This way it can receive in the new copy of your application, verify it's correctness and then overwrite your old application with the new copy without overwriting itself. So, the DFU is a project built separately from your main application. For production purposes you can create a post build step that uses the mergehex utility to put the two projects into a single hex file for ease of programming.

    The typical sequence of events start at device reset. The Soft Device gives control to the bootloader in high memory. The bootloader checks if a bootload is being triggered by a mechanism you can define. The example code from Nordic uses the state of a button to know if it should enter bootloader mode. The bootloader also checks the validity of the application FW and if it isn't valid it will enter bootloader mode. In bootloader mode, the device will expose a Nordic custom service and characteristics that the host uses to transfer the new application FW to your device. Note, if bootloader mode is not triggered, the bootloader FW will transfer control to your application FW and now your device will expose you application services and characteristics to the host.

    I'd suggest rereading the documentation a couple of times. It took several passes through it to fully grasp how this works.

  • Thank you so much for that detailed explanation John. Really helps a lot. Reading the document again now. As far as I understand the button has to be pressed in a certain time frame to enter DFU mode with the example code ?

    I did see a forum questions about entering dfu state without button press: devzone.nordicsemi.com/.../ devzone.nordicsemi.com/.../

Related