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