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

[SDK12][PCA10040]ble_app_buttonless_dfu not resetting to bootloader

Hi,

I have modified my files as mentioned here. When I upload the package, the template device show and I am able to connect. But when I subscribe to the notification and write 0x01, the device doesn't reboot.

In bootloader log it asks to change the ram start address:

:INFO:Inside main
:INFO:In nrf_bootloader_init
:INFO:In real nrf_dfu_init
:INFO:running nrf_dfu_settings_init
:INFO:!!!!!!!!!!!!!!! Resetting bootloader settings !!!!!!!!!!!
:INFO:Erasing old settings at: 0x0007f000
:INFO:Erasing: 0x0007f000, num: 1
:INFO:Writing 0x00000057 words
:INFO:Writing settings...
:INFO:Enter nrf_dfu_continue
:INFO:Single: Invalid bank
:INFO:Enter nrf_dfu_app_is_valid
:INFO:Return false in valid app check
:INFO:In nrf_dfu_transports_init
:INFO:num transports: 1
:INFO:vector table: 0x00075000
SDH:INFO:sd_ble_enable: RAM START at 0x20002c00
SDH:WARNING:sd_ble_enable: app_ram_base should be adjusted to 0x20002798
SDH:WARNING:ram size should be adjusted to 0xd868 
:INFO:After nrf_dfu_transports_init
:INFO:------- nrf_dfu_flash_init-------
:INFO:Waiting for events

Here is the log without changing the base address:

SDH:INFO:sd_ble_enable: RAM START at 0x20002128
:INFO:running nrf_dfu_settings_init
:INFO:!!!!!!!!!!!!!!! Resetting bootloader settings !!!!!!!!!!!
:INFO:Erasing old settings at: 0x200021ac
:INFO:Erasing: 0x200021ac, num: 1
:INFO:Erase failed: 6
:INFO:Failed to erase bootloader settings
APP:INFO:Indication for BLE_DFU is enabled
APP:INFO:Indication for BLE_DFU is disabled
APP:INFO:Indication for BLE_DFU is enabled
APP:INFO:Device is entering bootloader mode!
:INFO:Erasing old settings at: 0x200021ac
:INFO:Erasing: 0x200021ac, num: 1
:INFO:Erase failed: 6
:INFO:Failed to erase bootloader settings

Here is the log after changing the address:

SDH:INFO:sd_ble_enable: RAM START at 0x20002128
:INFO:running nrf_dfu_settings_init
:INFO:!!!!!!!!!!!!!!! Resetting bootloader settings !!!!!!!!!!!
:INFO:Erasing old settings at: 0x200021ac
:INFO:Erasing: 0x200021ac, num: 1
:INFO:Erase failed: 6
:INFO:Failed to erase bootloader settings
APP:INFO:Indication for BLE_DFU is enabled
APP:INFO:Device is entering bootloader mode!
:INFO:Erasing old settings at: 0x200021ac
:INFO:Erasing: 0x200021ac, num: 1
:INFO:Erase failed: 6
:INFO:Failed to erase bootloader settings

I have tried with both debug bootloader and normal one, the problem remains the same. I am using GCC on Linux. Please help.

Thanks in advance :)


[EDIT]

When I power on the board with BUTTON 4 pressed, the device starts in bootloader mode. Here is the log:

:INFO:Inside main
:INFO:In nrf_bootloader_init
:INFO:In real nrf_dfu_init
:INFO:running nrf_dfu_settings_init
:INFO:Enter nrf_dfu_continue
:INFO:Valid App
:INFO:Application sent bootloader request
:INFO:In nrf_dfu_transports_init
:INFO:num transports: 1
:INFO:vector table: 0x00075000
SDH:INFO:sd_ble_enable: RAM START at 0x20002c00
SDH:WARNING:sd_ble_enable: app_ram_base should be adjusted to 0x20002798
SDH:WARNING:ram size should be adjusted to 0xd868 
:INFO:After nrf_dfu_transports_init
:INFO:------- nrf_dfu_flash_init-------
:INFO:Waiting for events

Also LED3 and LED1 are turned on in this state, not LED4. If I connect LED2 will turn on and LED1 will turn off. I guess this is the desired result right?


[EDIT]

This is the process that I'm following:

  • Erase the flash

  • Program Softdevice from buttonless_dfu Makefile using make flash_softdevice

  • Program bootloader_secure from pca10040_debug Makefile using make flash

  • Create package in buttonless_dfu directory using

    nrfutil pkg generate --debug-mode --key-file priv.pem --application _build/nrf52832_xxaa.hex pkg.zip

  • Transfer the zip to phone and upload using nrfConnect

  • Successfully upload the file

  • Device resets.

  • Connect to the device and enable notification on the unknown characteristic

  • Write 0x01 on the characteristic

  • The received response is 20-01-01, and the logs are as mentioned in the question.

I hope I am not doing anything wrong here.

Parents
  • I can confirm that the changes have resolved the problem.

    But this seems to be an issue in the SDK12 only. I checked SDK11 hrs_dfu examples, in the linker files the bootloader region is not mentioned, and the dfu_settings are similar for SDK11 and SDK12, both expecting .bootloaderSetting as mentioned by @Keton. This issue never occured in SDK11.

    Also in the secure_dfu_gcc_nrf52_debug.ld, the bootloader address is stored in UICR address, so it looks like it should be recovered during when we try to enter DFU mode, but that isn't happening in SDK12. For now I'll go with the solution provided by @Keton, but it would be great if someone from Nordic could confirm that this is happening only in SDK12.

  • Just for clarification:

    When I was writting about linker file problems I was referring to .fs_data section in SDK11, for example this: devzone.nordicsemi.com/.../ or this: devzone.nordicsemi.com/.../ It's relevant because it's another example of messed up linker file and flash section in gcc not because it's bootloader related. Till SDK12 dfu used device_manager module and bug was (is?) in peer_manager.

Reply Children
No Data
Related