I'm currently using a HostController with pregiven communication protocol for transfering data to the NRF52840 (over uart). The NRF is flashed with the SD140 and I'm using the SDK V16.0. The communication protocol of the host is already implemented in the NRF app. As I have to update only the application I want to implement the transport layer for dfu by myself using the dual bank update procedure. I figured out the borders of bank1 and succesfully transfere and store the new application data in bank1 (crosschecked the flash by nrfjprog -readcode). I'm receiving the most important settings (size, app_crc,...) for the new application by the host (they are generated by nrfutils, then extracted ...) which then are written and stored in the settings for bank1 (see code below). But for storing the settings I had to modify the nrf_dfu_settings.c (static bool settings_forbidden_parts_equal_to_backup(uint8_t * p_compare_addr)) to return always true like in this thread. RTT Log tells me that storing the settings worked then.
For the bootloader I took an example and reduced it by the transport layer.
BL main code:
Lauching the bootloader after receiving and storing the new application also works.
But then the bootloader does not detect the new app in bank1 and hangs in dfu mode (see RTT output).
Is it a problem in the settings storage or a non properly working bootloader?
Bootloader RTT output:
[00000000] <info> app: Inside main
[00000000] <debug> app: In nrf_bootloader_init
[00000000] <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
[00000000] <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
[00000000] <debug> nrf_dfu_settings: Using settings page.
[00000000] <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
[00000000] <debug> nrf_dfu_settings: Writing settings...
[00000000] <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 0
[00000000] <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 0
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, src=0x20003AEC, len=896 bytes), queue usage: 1
[00000000] <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 0
[00000000] <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
[00000000] <debug> nrf_dfu_settings: Writing settings...
[00000000] <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 1
[00000000] <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 0
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x20003E6C, len=896 bytes), queue usage: 1
[00000000] <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 0
[00000000] <info> app: Postvalidating update after reset.
[00000000] <debug> nrf_dfu_settings: Writing settings...
[00000000] <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 1
[00000000] <debug> nrf_dfu_flash: Flash erase success: addr=0x000FF000, pending 0
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FF000, src=0x20003AEC, len=896 bytes), queue usage: 1
[00000000] <debug> nrf_dfu_flash: Flash write success: addr=0x000FF000, pending 0
[00000000] <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
[00000000] <debug> nrf_dfu_settings: Writing settings...
[00000000] <debug> nrf_dfu_settings: Erasing old settings at: 0x000FE000
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FE000, len=1 pages), queue usage: 1
[00000000] <debug> nrf_dfu_flash: Flash erase success: addr=0x000FE000, pending 0
[00000000] <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x000FE000, src=0x20003E6C, len=896 bytes), queue usage: 1
[00000000] <debug> nrf_dfu_flash: Flash write success: addr=0x000FE000, pending 0
[00000000] <debug> app: Enter nrf_bootloader_fw_activate
[00000000] <info> app: No firmware to activate.
[00000000] <debug> app: App is valid
[00000000] <debug> app: DFU mode requested via GPREGRET.
[00000000] <info> nrf_bootloader_wdt: WDT is not enabled
[00000000] <debug> app: in weak nrf_dfu_init_user
[00000000] <debug> app: timer_stop (0x2000005C)
[00000000] <debug> app: timer_activate (0x2000005C)
[00000000] <info> app: Entering DFU mode.
[00000000] <debug> app: Initializing transports (found: 0)
[00000000] <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
[00000000] <debug> app: Enter main loop
[03932160] <debug> app: timer_stop (0x2000005C)
[03932160] <debug> app: timer_fire (0x2000005C)
[03932161] <info> app: Inactivity timeout.
[03932161] <debug> app: Resetting bootloader.
[03932161] <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
[03932164] <debug> nrf_dfu_settings: Destination settings are identical