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

nrf52840 - DFU via USB - Bootloader seems to work but app will not start.

Hi there,

I'm developing on an nRF52840 using the nRF52 SDK in version 15.3.0 (15.3.0_59ac345). My project consists of the main application, the softdevice and a bootloader with usb dfu support from the SDK's example section (examples/dfu/secure_bootloader/pca10056_usb).
The main application was ported from another project that is running on an nRF52832. In this project the application is updated via buttonless dfu and that works fine.

In the current project the firmware update is performed via usb. The update process itself seem to work fine. The bootloader works and the firmware package can be downloaded by the nrfutil via usb.
But the main application is not startet by the bootloader.

For initial setup I'm flashing the bootloader, the softevice and the application directly via jtag port to the nRF52840. Here the application will not start either.

To understand the problem you can do the following steps. For simplification I used an example from the SDK 15.3.0 (15.3.0_59ac345). The basic configuration meets the configuration of my application.
By the way I'm developing on an linux distibution. So maybe you need to adapt the following commands.


#1. get the softdevice
cp nRF5_SDK_15.3.0_59ac345/components/softdevice/s140/hex/s140_nrf52_6.1.1_softdevice.hex .

#2. get the bootloader
cp nRF5_SDK_15.3.0_59ac345/examples/dfu/secure_bootloader/pca10056_usb_debug/armgcc/_build/nrf52840_xxaa_debug.hex ./nrf52840_xxaa_bl_debug.hex

#3. get the application
cp nRF5_SDK_15.3.0_59ac345/examples/ble_peripheral/ble_app_buttonless_dfu/pca10056/s140/armgcc/_build/nrf52840_xxaa.hex ./nrf52840_xxaa_app.hex

#4. generate the application settings page for bootloader
nrfutil settings generate --family NRF52840 --application ./nrf52840_xxaa_app.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 settings_nrf52840_xxaa_app.hex

#5. merge the bootloader with application settings file
mergehex -m nrf52840_xxaa_bl_debug.hex settings_nrf52840_xxaa_app.hex -o ./nrf52840_xxaa_bl_w_settings.hex

#6. erase the chip
nrfjprog -f nrf52 --eraseall
nrfjprog -f nrf52 --reset

#7. program the softdevice
nrfjprog -f nrf52 --program s140_nrf52_6.1.1_softdevice.hex -r

#8. program the bootloader
nrfjprog -f nrf52 --program nrf52840_xxaa_bl_w_settings.hex -r

#9. program the application
nrfjprog -f nrf52 --program nrf52840_xxaa_app.hex -r


Now I would expect the application to start after a devie reset. But nothing.

Activating the debug output I get the following issue:

[snip]

SEGGER J-Link V6.46e - Real time terminal output
J-Link EDU Mini V1 compiled May 27 2019 15:50:07 V1.0, SN=801000575
Process: JLinkExe
<info> app: Inside main
<debug> app: In nrf_bootloader_init
<debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
<debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
<debug> nrf_dfu_settings: Using settings page.
<debug> nrf_dfu_settings: Copying forbidden parts from backup page.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<debug> app: Enter nrf_bootloader_fw_activate
<info> app: No firmware to activate.
<debug> app: App is valid
<warning> nrf_dfu_settings: No additional data erased
<info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<debug> app: Running nrf_bootloader_app_start with address: 0x00001000
<debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0

[/snip]

So the bootloader seems to work. But the application won't run.

After reading some posts here in the forum and after testing with a bootloader that provides ble dfu support (examples/dfu/secure_bootloader/pca10056_ble) I'm very sure that there's
something wrong with the applications configuraion. But I can not figure out what's wrong.

So do you have any ideas?
Is there any example code of an application that works with a bootloader that supports usb dfu?



Thank you and best regards, Marco.

Parents Reply Children
No Data
Related