New application doesn't run after secure DFU process reaches 100%

nemunoz gravatar image

asked 2018-01-09 20:59:20 +0100

Hi to everyone!

I'm following this guide to learn how to use secure DFU on a nRF52832DK board.

All steps have been done successfully, or I think so, until I reach the D4 step where the new program has to start automatically after DFU process, but it never runs.

Instead, the LED 3 lights up and If I press the button 4, the LED 1 also lights up and I can resend another application over DFU. So I think the board is still in the bootloader.

Indeed, I have some cuestions related to this:

  1. BLE Secure DFU example is only a boot loader or it also has an application?

  2. Depending on the above answer, if it is only a boot loader, do I have to program an application before doing the DFU proccess?

  3. The application, that will be written after DFU proccess, must use SoftDevice? (For my test, I upload my own blinky program. It works well when I flash the board directly through USB. But it doesn't use SoftDevice at all).

Thanks in advance!

edit retag flag offensive close delete report spam


Hi nemunoz, if you are referring to the BLE Secure DFU Bootloader example in question 1, then yes the example is only a bootloader (see link). So if I understand you correctly, you essentially want to do secure DFU with your own blinky example, which is most likely similar to the Blinky example found in the examples/peripheral/blinky folder, right? The Nordic blinky example found here does not require the softdevice either.

Essentially, you just want to follow the guide you refer to & in step C1, you just build your own blinky application hex file. If you were using the Nordic blinky example, you could build the program in Keil or Segger Embedded Studio for example. Then, you can find the hex file inside the _build folder if you are using Keil (Output folder for SES). You will have to use the softdevice since you are doing a secure ...(more)

Bjørn Kvaale ( 2018-01-10 14:54:24 +0100 )editconvert to answer

Hi Bjørn Kvaale.

My blinky example blinks LED1 and LED2 each 100ms (because my custom board only have two LEDS).

But I just tried, in the development board, the Nordic Blinky example (provided in SDK 14.0.0, blinky_pca10040_s132.hex) and it also doesn't run after DFU process. It reach 100% and says the upload was successful, but the application never start.

Again I get stuck in the step D4.

nemunoz ( 2018-01-10 20:49:23 +0100 )editconvert to answer

Hi nemunoz, I just tried doing a secure dfu with the blinky app found in the folder: nRF5_SDK_14.0.0_3bcc1f7\examples\peripheral\blinky\pca10040\s132. Have you tested the blinky program without the bootloader? I had two issues when doing this: firstly, I had to use the blinky example in the peripheral folder that uses the softdevice to be able to create the zip file in step C2 of the secure dfu blog post. Remember to use the 0x9D value after --sd-req, as you are using the SD 132 v 5.0.0 (this can be verified by looking at this folder: nRF5_SDK_14.0.0_3bcc1f7\components\softdevice\s132\hex). What output code did you get once you created the zip file? I got Zip created at app_dfu_package.zip (depends on what you call the zip file). It could be something with the version rule maybe? For me it worked if ...(more)

Bjørn Kvaale ( 2018-01-11 13:23:59 +0100 )editconvert to answer

Hi Bjørn Kvaale.

I take the hex file in the folder: nRF5_SDK_14.0.0_3bcc1f7\examples\peripheral\blinky\hex. Here there are three hex files: one for PCA 10056 and two for PCA 10040. The first one is the blinky without SoftDevice (blinky_pca10040.hex) and the other one is the blinky with SoftDevice (blinky_pca10040_s132.hex). I take the last one because the hex without SoftDevice can not be used to generate the zip file.


  1. I erase all in my development board.

  2. Program SoftDevice (I take s132_nrf52_5.0.0_softdevice.hex file from nRF5_SDK_14.0.0_3bcc1f7/components/softdevice/s132/hex/) using nRFgo Studio.

  3. Download the bootloader from Keil (the project is in nRF5_SDK_14.0.0_3bcc1f7\examples\dfu\bootloader_secure_ble\pca10040, but I know I can also program it from nRFgo Studio).

  4. And generate the zip file.

nemunoz ( 2018-01-11 14:43:50 +0100 )editconvert to answer

To generate the zip file I put in the same folder blinky_pca10040_s132.hex, nrfutil.exe and private.key and execute the next command: nrfutil.exe pkg generate --hw-version 52 --application-version 1 --application blinky_pca10040_s132.hex --sd-req 0x9D --key-file private.key blinky_SD.zip.

The console outputs: zip created at blinky_SD.zip.

Afterwards I upload this zip file to my phone. I used to use AirDroid, but in my last try I used my email.

Finally I use either nRF Connect or nRF Toolbox to upload the application through DFU proccess. But the blinky application never runs. Again it reaches the 100% in the upload proccess in both programs.

nemunoz ( 2018-01-11 14:46:14 +0100 )editconvert to answer

1 answer

Sort by » oldest newest most voted
Bjørn Kvaale gravatar image

answered 2018-01-12 12:47:44 +0100

updated 2018-01-12 12:49:10 +0100

I tried your way with the precompiled hex file, but that didn't work. The reason it doesn't work is because the precompiled hex file has the softdevice included, but in the secure DFU blog post you are looking at, you only want to update the application (not the softdevice too). Try building the blinky example using Keil instead (like it says in step C1). The hex file built by Keil in the _build folder does not include the softdevice. You can check this in nrfgostudio by uploading the precompiled hex file found in the hex folder as an application and seeing that there is a softdevice & application section in memory. If you program the hex file built by Keil, the softdevice will not be in memory.

Like you said previously, you get errors if you try to create a zip file by using the precompiled blinky_pca10040.hex file. I am pretty sure you are doing everything else correctly. So essentially just follow the blog post and build your application using Keil & not using the precompiled hex files. Hope that helps!

edit flag offensive delete publish link more


Ok, it worked!

But it looks like only works with the hex file which has references to SoftDevice. I mean that only works the hex file obtained by compiling (in Keil) the next project: nRF5_SDK_14.0.0_3bcc1f7\examples\peripheral\blinky\pca10040\s132\arm4.

Because the hex one which is in this project nRF5_SDK_14.0.0_3bcc1f7\examples\peripheral\blinky\pca10040\blank\arm4 doesn't work (I can't even create the zip with it).

I think is because SoftDevice is programmed in the board memory. So, any program which doesn't use SoftDevice will not work (as if I upload a program without SoftDevice through USB to the board when the board has SoftDevice).

In conclusion, I think I get the answer to my question #3. And the answer is yes, the hex file must use SoftDevice. Thats why my first hex didn't work either, because it didn't have ...(more)

nemunoz ( 2018-01-12 14:34:08 +0100 )editconvert to answer

No worries. :) Great to here that you figured it out! I also made the mistake of using the blank example first (without the SD). You are correct that you will need to use the blinky example that uses the softdevice, as you flash the softdevice to the DK first in step D1 of the Secure DFU blog post.

Bjørn Kvaale ( 2018-01-12 15:03:36 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower


Asked: 2018-01-09 20:59:20 +0100

Seen: 46 times

Last updated: jan. 12