BLE DFU softdevice loading issue in bootloader

I've been trying to setup BLE DFU bootloading for my nrf52840, using this tutorial:
https://novelbits.io/nrf52-ota-dfu-ble-part-4/

I've come a long way, I've created an blinky app which works button less. 
also setup the bootloader which includes my public key.

Using the nrfConnect app I can initiate the DFU bootloader only to get it into an infinite bootloop.

To diagnose a bit further I hooked on the debugger and setup the booloader to print the debug logs to its uarts.

I can trace the issue currently to the initialization of the softdevice.

in function "ble_stack_init"

err_code = nrf_dfu_mbr_init_sd();
VERIFY_SUCCESS(err_code);

Gets executed and I am always rewarded with an return code: 7

This is where the bootloader resets.


If I disable the initialization by setting NRF_DFU_BLE_SKIP_SD_INIT=1
the next function "nrf_sdh_enable_request();" returns 1
and the bootloader also resets.

Does anyone have a clue what I am doing wrong?
I've been at this for days without any real progress.

I know the softdevice must work, otherwise the blinky application would not be able to communicate with the nrfConnect app

Attached below is a small snippet of the Application + bootloader logs

<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
<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
<info> app: Setting vector table to bootloader: 0x000ED000
<info> app: Setting vector table to main app: 0x00027000
<info> app_timer: RTC: initialized.
<info> app: Blinky. V4.0
<info> app: USBD CDC ACM example started.
<info> app: No USB power detection enabled
Starting USB now
<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
<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
<info> app: Setting vector table to bootloader: 0x000ED000
<info> app: Setting vector table to main app: 0x00027000
<info> app_timer: RTC: initialized.
<info> app: Blinky. V4.0
<info> app: USBD CDC ACM example started.
<info> app: No USB power detection enabled
Starting USB now
<info> app: Connected
<info> app: Device is preparing to enter bootloader mode

<info> app: Device will enter bootloader mode

<info> app: Power management wants to reset to DFU mode.
<info> app: Power management allowed to reset to DFU mode.
<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
<debug> app: DFU mode requested via GPREGRET.
<info> nrf_bootloader_wdt: WDT is not enabled
<debug> app: in weak nrf_dfu_init_user
<debug> app: timer_stop (0x200059A0)
<debug> app: timer_activate (0x200059A0)
<info> app: Entering DFU mode.
<debug> app: Initializing transports (found: 1)
<debug> nrf_dfu_ble: Initializing BLE DFU transport
<debug> app: Failed to initialize transport 0, error 7
<error> app: Could not initalize DFU transport: 0x00000007
<error> app: Received an error: 0x00000003!
<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
<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
<info> app: Setting vector table to bootloader: 0x000ED000
<info> app: Setting vector table to main app: 0x00027000
<info> app_timer: RTC: initialized.
<info> app: Blinky. V4.0
<info> app: USBD CDC ACM example started.
<info> app: No USB power detection enabled
Starting USB now

Parents
  • Hi Hieu,

    I am using a Seeed board:
    https://www.seeedstudio.com/Seeed-XIAO-BLE-Sense-nRF52840-p-5253.html

    My thoughts on the PCA10059 was that it is closest to the design of the Seeed board.
    The log I've obtained by configuring the Serial port to log it to my USBttl device.

    (I've hooked it with some pin headers up to the board)

    Interesting point that you reach such different memory profile.

    The code I've been using should be very close to the default which I downloaded from the nordic semi website.
    (I first wanted to make sure I could pull off this bootloading feat before I continued the development on the board.)

    Maybe It is good to mention I use Ubuntu linux.

    And to merge the applications I've been using the mergehex tool provided by nordic semi 

    (nRf Command Line Tools pulled from the website)

    I hope this helps?

    regards,

    Sebastiaan

Reply
  • Hi Hieu,

    I am using a Seeed board:
    https://www.seeedstudio.com/Seeed-XIAO-BLE-Sense-nRF52840-p-5253.html

    My thoughts on the PCA10059 was that it is closest to the design of the Seeed board.
    The log I've obtained by configuring the Serial port to log it to my USBttl device.

    (I've hooked it with some pin headers up to the board)

    Interesting point that you reach such different memory profile.

    The code I've been using should be very close to the default which I downloaded from the nordic semi website.
    (I first wanted to make sure I could pull off this bootloading feat before I continued the development on the board.)

    Maybe It is good to mention I use Ubuntu linux.

    And to merge the applications I've been using the mergehex tool provided by nordic semi 

    (nRf Command Line Tools pulled from the website)

    I hope this helps?

    regards,

    Sebastiaan

Children
  • Hi Sebastiaan,

    Sebastiaan said:

    I am using a Seeed board:
    https://www.seeedstudio.com/Seeed-XIAO-BLE-Sense-nRF52840-p-5253.html

    My thoughts on the PCA10059 was that it is closest to the design of the Seeed board.

    I see. It should be fine then. There might be some pin conflicts, especially since we are on the blinky example. But it should not be a problem.
    I will keep a note of this though, if our next steps yield no results.

    Sebastiaan said:
    Interesting point that you reach such different memory profile.

    Yes, and it might be the cause... Before digging in deep, allow me a simple check first, because one of your hex files might have problem then if this memory layout is not intentional.

    Could you confirm that you have these four files and only those four, and send them over if possible?

    1. SoftDevice

    2. Bootloader

    3. Application

    4. Bootloader Settings

    Meanwhile, could you please also retrace your step with the article to make sure all files are generated with the appropriate config?

    Sebastiaan said:

    Maybe It is good to mention I use Ubuntu linux.

    And to merge the applications I've been using the mergehex tool provided by nordic semi 

    (nRf Command Line Tools pulled from the website)

    This is also something that should be fine, but I will also keep a note. Are you using Segger Embedded Studio or some other toolchain?

    Best regards,

    Hieu

Related