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

Buttonless DFU

Hello,

I'm currently testing the bootloader with nrf52832 DK on SDK16.0.0 with Segger Embedded Studio. I followed the guide provided in this link https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader#_cptype=root and everything was working very well.

Then I moved on to try the buttonless DFU that I'm going to implement on our custom board later. So I programmed the DK with the precompiled hex file provided in \examples\dfu\secure_dfu_test_images\ble\nrf52832. On my phone with nRF Connect, it sees the DK advertising as Nordic_Buttonless.

When I try to update it with a zip file that I generated in the bootloader tutorial, it failed. But when I try to update it again this time with hrs_application_s132.zip provided in the same folder as the precompiled the "Buttonless Secure DFU with bonds" hex file, it works and the DK start advertising as Nordic HRM.

So can anyone point out why my application.zip didn't work but hrs_application_s132.zip did?

Parents
  • Hi,

    When I try to update it with a zip file that I generated in the bootloader tutorial, it failed. But when I try to update it again this time with hrs_application_s132.zip provided in the same folder as the precompiled the "Buttonless Secure DFU with bonds" hex file, it works and the DK start advertising as Nordic HRM.

    So can anyone point out why my application.zip didn't work but hrs_application_s132.zip did?

    Since updating with the hrs_application_s132.zip that is shipped with the SDK works, this means that you are using the public key that is shipped with the example bootloader. This corresponds to the private key that was used to sign the example upgrade packages. However, you must use your own key pair, and use your own private key when generating your own update images. And for that to work, you must build the bootloader to use your own public key, by changing examples\dfu\dfu_public_key.c. See Working with keys.

  • Hello Einar,

    So as I understand it, I have to generate another hex file that combines :

    • Debug version of Secure DFU bootloader
    • SoftDevice
    • Buttonless Secure DFU template application
    • Bootloader settings page generated for the application

    But with my own public key when building the "Secure DFU bootloader", right? All right, I'll try it later on. Thanks!

  • Hi,

    Yes and no. The public key is part of the bootloader hex, so you must build a new bootloader. The SoftDevice is the same, and also the application and settings page (as long as the application is exactly the same hex). But you must sign the update zip image with the private key that corresponds to the public key that is in the bootloader.

    The point of all this is that only the holder of the private key that corresponds to the public key in the device is allowed to make valid update images.

  • It doesn't seem to be accepting any firmware update anymore. Here were my steps :

    • Generate private key
    • Generate public key based on the private key
    • Build secure_bootloader_ble with the new public key
    • Build ble_app_buttonless_dfu
    • Build ble_app_blinky that is going to be the new firmware updated on the DK
    • Generate a zip file combining ble_app_blinky and private.key :

    nrfutil pkg generate --hw-version 52 --application-version 1 --application .\ble_app_blinky_pca10040_s132_sdk16.hex --sd-req 0xCB --key-file .\private_sdk16.key app_dfu_package.zip 

    • Generate bootloader setting file :

    nrfutil settings generate --family NRF52 --application .\ble_app_buttonless_dfu_pca10040_s132.hex --application-version 0 --bootloader-version 0 --bl-settings-version 2 --key-file .\private_sdk16.key bootloader_setting.hex 

    • Merge SD with BL :

    mergehex -m .\s132_nrf52_7.0.1_softdevice.hex .\secure_bootloader_ble_s132_pca10040.hex -o SD_BL.hex 

    • Merge SD, BL and ble_app_buttonless_dfu :

    mergehex -m .\SD_BL.hex .\ble_app_buttonless_dfu_pca10040_s132.hex -o SD_BL_APP.hex    

    • Merge SD,BL, app and bootloader setting file
    • Program the DK with SD_BL_APP_Settings.hex

    On my phone with nRF Connect, I managed to connect to Nordic_Buttonless but when I try to DFU the zip file, it shows the message "Starting DFU" and afterwards "Disconnecting" right away.

  • Hi,

    Your approach looks correct. Can you try to build the debug bootloader (example sufficed with _debug) instead, and observe the RTT log? That will probably give a good indication of what goes wrong. It could also be relevant to see the full log from the DFU master (nRF Connect, I assume).

  • I don't think there is much difference between the debug and the non debug version, but after trying the debug version, it worked. The DK accepted the blinky firmware and rejected the hrs_application_s132.zip as it should be. What's weirder is when I re-flash the DK with the non-debug version, there was no more problem like before. I was able to update the DK with my blinky firmware

  • I am glad to hear it works now. But, what you describe is a bit odd. I cannot explain it.

Reply Children
No Data
Related