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

SDK 14.2: how to debug application with buttonless DFU

I'm working on modifying an existing app written on a custom nRF52832 board. The app uses softdevice s132, and was written for SDK14.2. The app was originally written with Keil, but I ported it successfully to Segger. The device has a buttonless DFU, written using the bootloader_secure_ble example with minimal changes.

I verified that if I compile my app with "Release" settings (i.e. no debug support, size optimization), and package the app properly, I can update the device flash using over the air DFU (nRF Toolbox) and everything works.

But if I flash the app when connected with J-link to the computer running Segger, the device always starts into the bootloader. So when I do a "build and debug" (or even a "build and run", the code starts from the bootloader and the only way to get it out of it, is to perform an OTA DFU update (which overwrites the app)

How can I flash an app to the nRF52832 and ensure it starts in the app, not in the bootloader? Or, in alternative, how can I exit the bootloader and jump into the app? (the device has no buttons, btw. and in sdk_config.h I have #define BSP_BTN_BLE_ENABLED 0

At the moment I can only proceed by erasing the device flash, then only load the softdevice and my app in debug mode. Without a bootloader in flash, my app starts as expected.

  • How can I flash an app to the nRF52832 and ensure it starts in the app, not in the bootloader?

    Use NRFutil to generate the bootloader settings page (or pages for newer bootloader versions, SDK 15+) and then flash this page in addition to your new firmware.

  • That did the trick, thanks!

    For anyone else bumping into this in the future, I added a batch file called by SES after the debug build with

    nrfutil.exe settings generate --family NRF52 --bootloader-version 2 --bl-settings-version 1 --application-version 219 --application C:\[path]\App1000.hex --key-file C:\[path]\private.pem C:\[path]\dfusettng.hex

    (where [path] is the correct path for my build). Not sure if the private key is required, but having it works fine.

    Then in the SES debug loader, I have "additional load file 0" with the name of the combined bootloader and softdevice, and "additional load file 1" is C:\[path]\dfusettng.hex

Related