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,
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:
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
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..?
jonas.woerner said:but my application uses the alpha version of the SD140, and the bootloader uses the normal SD140.
Could you specify exactly what SoftDevice you are using for respectively the bootloader and the application. When changing the SoftDevice for an application you may have to do some API related changes to your code. The migration guides can be found along with the SoftDevice after downloading it.
I was using S140 5.0.2alpha, but I have updated my main app to use S140 V6.0 and used the bootloader from SDK 15.0, now everything works as expected! :)