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

DFU example not working

Hi,

Recently we upgraded from NRF52832 to NRF52840, and as the Development seems to come to an end, one of the last features we need is OTA capability.

currently I am trying to Implement DFU on my application, but I am struggeling.

I downloaded the latest SDK and tried to compile \examples\dfu\secure_bootloader\pca10056_ble project.

after compiling I flashed softdevice (make Flash_Softdevice) and then flashed the bootlader (make Flash) but my board wont advertise.

next step was to try one of the precompiled examples, I successfuly flashed sd_s140_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_without_bonds.hex, and it worked! I could see the DFUtarg advertising, then I tried to flash the softdevice and bootloader_secure_ble_debug_without_bonds_s140.hex seperately, and again, it did not advertise.

what am I doing wrong?

thanks in advance,

Jonas

  • Update: when I use mergehex to merge softdevice and bootloader and application, it works, but if I program it after another it doesnt...?!

    Update2: when I compile and merge the debug bootloader, it works, but not with the non-debug version. also the non debug version is significantly smaller when compiled.

  • In SDK 15.3 the bootloader start address is stored in the MBR section instead of the UICR (since UICR cannot be protected by ACL/BPROT), and that causes problem in the makefile, where the nrfjprog command sectorerase is used, let me explain.

    If you take a look at the makefile of the BLE DFU bootloader examples, you can see that the bootloader is flashed first, and the bootloader start address is stored in the MBR section. Then the Softdevice is flashed onto the chip using nrfjprog and the sectorerase command. The problem here is that sectorerase command will erase the bootloader start address before flashing the MBR.

    Some solutions are:

    • Merge the Softdevice and the bootloader
    • Flash it in the following manner
      • nrfjprog -f nrf52 --program s140_nrf52_6.1.0_softdevice.hex --chiperase
      • nrfjprog -f nrf52 --program nrf52840_xxaa_s140.hex -r

    Best regards,

    Simon

  • wow, thats a really good answer, thanks!

    I still have some questions left though ;)

    in order to use the bootloader with my application, both have to be compiled for the same softdevice, but my application uses the alpha version of the SD140, and the bootloader uses the normal SD140.

    also, I tweaked my RAM addresses of my application to give the softdevice more ram.

    How can I compile the DFU bootloader with the other Softdevice and also give it more ram?

  • What revision of nRF52840 are you using? What SDK are you using, and what softDevice version are you using? Check the Compatibility matrix on what to go for. If you have the newest nRF52840 I would recommend you to use SDK 15.3.0 and SoftDevice S140 v6.1.1 for both the bootloader and the application.

    Check out this tutorial regarding adjustments of RAM

    Best regards,

    Simon

  • ok,

    I have different revisions of the nrf52840, but even the old one seems to work with the new softdevice, is that expected?

    I will try to use SD16.1.1 ifor future, but Im still intereset in how I can build the examples for another SD...

    I tried changing the FLASH origin in th elinker settings to the flash start of the corresponding softdevice, but that didnt do the trick..?

Related