Hello there!
We are using nRF51822_xxac SoC with nRF5 SDK v12.3.0 and S130 Softdevice. We are kind of obliged to stick with nRF51822 because nRF52840 SoCs were out of stock at the moment we wanted to place the order.
We are currently finalizing the application code but also want to have the ability to update our application with DFU over the BLE transport link. I was following this Nordic's step-by-step guide that explains how to implement secure DFU and here is what happens on my side:
- I was able to generate a public/private key pair with the nrfutil.exe tool.
- dfu_public_key.c file stored in the examples/dfu/bootloader_secure folder is replaced with the public key generated in step 1.
- micro-ecc external library is successfully compiled. As a consequence, micro_ecc_lib_nrf51.a static library file is generated in external/micro-ecc/nrf51_armgcc/armgcc folder.
- The bootloader is built by using the Makefile from examples/dfu/bootloader_secure/pca10028/armgcc. As a consequence, nrf51822_xxac_s130.hex file is generated.
- DFU .zip packet that contains only the application is successfully generated with the following script command:
nrfutil pkg generate --hw-version 51 --application-version 1 --application <path_to_the_app.hex file> --sd-req 0x87 --key-file <path_to_the private.key file> app_dfu_package.zip
--sd-req 0x87 is used to signalize that our application runs with s130 v2.0.1 Softdevice - Now, when the time has come to actually do DFU, I flash
- Softdevice.
- Bootloader. As a consequence, my nRF51822 SoC starts advertising as DfuTarg
- Using the nRFConnect app and iPhone 11, OTA DFU is performed using the .zip file generated in step 4. The process finishes successfully but my nRF51822 SoC does not start advertising as Nordic_HRM (the Nordic HRM example is used for the application). It's kind of stuck because it neither advertises as DfuTarg.
I used the Programmer tool from nRF Connect for Desktop suite to verify the memory layout after each step and here is what I find:
- Memory content after flashing Softdevice:
There is an MBR region of ~2KB + Softdevice region of about 106KB which is, to the best of my understanding, correct.
- Memory content after flashing bootloader:
- Memory content after performing DFU (sending .zip package over BLE):
As you can see, the Softdevice region increased from ~106KB to ~157KB (for about ~51KB which is the size of the application). It should not be like this, to the best of my understanding. We should have an application region on the top of the Softdevice region which is ~51KB in size.
As I said earlier, after OTA DFU update, nRF51822 SoC does not advertise at all. Once I press Reset button on Programmer window, device start advertising again as DfuTarg. Here is the memory content after the second DFU update with the same .zip package:
There is an application region of ~51KB on the top of increased Softdevice but, again, nRF51822 SoC does not advertise.
Do you have any idea about what I am missing here?
I feel the issue has something with how memory is partitioned but have no idea where exactly this should be fixed. I would really appreciate your help. Perhaps I should use mergehex tool to merge all .hex files (Softdevice + bootloader + application) into a single .hex file?
Thanks in advance for your time and efforts!
Sincerely,
Bojan.