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.

Related