What do I need for software updates (DFU) via BLE?

Hello,

we would like to update our application software. There is plenty documentation from Nordic all over the place, some relevant, some outdated, with boot loader, without, a BLE DFU service a.s.o. but we could not find any top level documentation what you really need. I do not want examples because our software is pretty much finished.

So what I would like to know is:

1. what do I need on the BLE peripheral side to do over the air application software update (we don't care about softdevice update and if it's possible without bootloader the better).

2. What do I need on the phone / desktop side? The nrfTollbox seems to have a DFU function but I could not get that to work; the file select leads to some obscure file manager download which eventually fails. I downloaded the nrf-connect (great name btw., same as you sdk now) for desktop and it works fine with an pca10056 DK but the desktop software does not seem to have any DFU built in. Have I missed that or is there an nrf-Toolbox for desktop available?

I have the feeling it's very easy and it's all there but I just cannot see it.

Kind Regards,

  • A key question is which SDK are you using? The nRF Connect SDK or the nRF5 SDK? I'm going to assume nRF5 SDK here. 

    1. what do I need on the BLE peripheral side to do over the air application software update

    You need a bootloader of course, and a means to enter the bootloader. Nordic provides the secure bootloader as part of the nRF5 SDK. The "means to enter" can be a BLE DFU service, but it can also be as simple as holding a button pressed during powerup. This is up to your requirements. The DFU service is convenient for updating via a phone app.

    2. What do I need on the phone / desktop side?

    Forget nRF Toolbox. The nRF Connect for desktop does have DFU, I use it all the time. This user guide shows where it is.

  • Hello mrono,

    thank you very much for your fast reply.

    Yes, you were right, I am using then nrf SDK, sorry, forgot to mention that.

    And thank you for your clear answers, I wish the Nordic documentation would have expressed that somewhere instead of plenty of contradicting and confusing information. I will try to get that working; that I never saw the DFU in the nrf connect is most likely due to the fact that the device did not have the service in it.

    Kind Regards,

  • Hello,

    thanks to mronos answer I got the bootloader compiled (I'd really like to know why nordic doesn't provide examples that compile instead of having to spend hours working through tutorials and make lots of changes to files, settings, linker allocations etc.), ran it and downloaded software onto the device via ble. Great !

    Now I am trying to start the dfu from my application software so that I can finally dump all that nordic stuff on my customers desk and say good-bye to it for good.

    But I am getting a compile error in "ble_dfu_unbonded.c" that I cannot figure out: "unknown type name 'nrf_dfu_set_adv_name_svci_async_t'". One post here I found that suggested to define "NRF_DFU_SVCI_ENABLED" (love this nordic software, very intuitive and easy to figure out by yourself) but that did not work either.

    Anybody an idea what is going wrong?

    Kind Regards

    p.s.: is there actually an easy way to simply jump back to the boot loader? I have my own service that could trigger that.

  • But I am getting a compile error in "ble_dfu_unbonded.c" that I cannot figure out: "unknown type name 'nrf_dfu_set_adv_name_svci_async_t'". One post here I found that suggested to define "NRF_DFU_SVCI_ENABLED"

    In addition to that I think you need NRF_DFU_TRANSPORT_BLE=1

    I agree about the ease of figuring out... I think I got these from the buttonless dfu example a long time ago, but taking a module from one example to another is not easy with this sdk.

    p.s.: is there actually an easy way to simply jump back to the boot loader? I have my own service that could trigger that.

    Yes, the bootloader entry method GPREGRET does that. You write a magic value to a certain register which the bootloader reads.

  • Hello mrono,

    NRF_DFU_TRANSPORT_BLE=1 did the trick and I owe you big time for saving me tons of time and not having my blood pressure going sky high when digging through nordic "code". If you are ever in the south of Ireland I'll buy you a pint (or more). So I got it compiled.

    After sheer endless permutations of the nordic attribute table size (hard coded numbers, not sure when I saw something like this the last time) and the inherent permutations of sd ram allocation I finally got it even to start up.

    I can see the dfu service in my application but when I start it from the nrf connect desktop I get the following microsoft style error message on the debug message output:

    <info> app: Writing peer data to the bootloader...
    <error> app: Request to enter bootloader mode failed asynchroneously.

    Apart from the typo in "asynchronously" it doesn't really tell me a lot. Application (at least my part) is still running after that but nordic part (ble) is dead.

    Is there any documentation about the nordic proprietary dfu service available so that I can check that I did all the required steps to get to the boot loader? Or is it expected that sdk users reverse engineer everything from their bloated example "code"?

    Kind Regards,

Related