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

Firmware not starting after DFU

Hello, I have the following question. I'm trying to program my firmware via DFU Bootloader and nRF Connect (smartphone). That works perfectly with the test board SparkFun nRF52832 Breakout. But if I do the same with my own hardware, the firmware won't start. The upload goes perfectly, but DFU will start again in two seconds. If the firmware is flashed without a DFU, it works without a problem. It looks like the problem is with the hardware. But I compared everything and found no mistake. What could be causing the error in the hardware that does not allow the flashed firmware to start?

SDK_17.0.0_9d13099, nRF52832

Schematic board SparkFun


Thanks in advance

  • Hello,

    I don't know what sort of bootloader you are using, but please check out the equvialent _debug project, such as:

    SDK\examples\dfu\secure_bootloader\pca10040_uart_debug

    And monitor the RTT log. What does it say? When the DFU is finished, but it restarts in DFU mode, does the RTT log say anything about why the DFU mode was re-entered?

    What changes did you do to the bootloader project? Have you tested a bootloader from an unmodified SDK?

    Best regards,

    Edvin

  • Thank you for your prompt reply. I use nRF5_SDK_17.0.0_9d13099 \ examples \ dfu \ secure_bootloader \ pca10040_s132_ble as the bootloader. I've only commented out the functions for LEDs and #include "boards.h" from the example. RTT log shows nothing during update:

    LOG: J-Link RTT Viewer V6.92: Logging started.
    LOG: Connecting to J-Link via USB...
    LOG: Device "NRF52832_XXAA" selected.
    LOG: InitTarget() start
    LOG: InitTarget() end
    LOG: Found SW-DP with ID 0x2BA01477
    LOG: DPv0 detected
    LOG: Scanning AP map to find all available APs
    LOG: AP[2]: Stopped AP scan as end of AP map has been reached
    LOG: AP[0]: AHB-AP (IDR: 0x24770011)
    LOG: AP[1]: JTAG-AP (IDR: 0x02880000)
    LOG: Iterating through AP map to find AHB-AP to use
    LOG: AP[0]: Core found
    LOG: AP[0]: AHB-AP ROM base: 0xE00FF000
    LOG: CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    LOG: Found Cortex-M4 r0p1, Little endian.
    LOG: FPUnit: 6 code (BP) slots and 2 literal slots
    LOG: CoreSight components:
    LOG: ROMTbl[0] @ E00FF000
    LOG: ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
    LOG: ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    LOG: ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    LOG: ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    LOG: ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    LOG: ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    LOG: RTT Viewer connected.

    What should I activate in order for the RTT log to say something?

  • Sorry Edvin,

    This is the last part of log when I use DFU with debug function:

    .......
    
    00> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0002C000, len=1 pages), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Creating object with size: 1324. Offset: 0x00006000, CRC: 0x12CFD00B
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash erase success: addr=0x0002C000, pending 1
    00> 
    00> <debug> nrf_dfu_ble: Buffer 0x200082AC acquired, len 244 (244)
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002C000, src=0x200082AC, len=244 bytes), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x0002C000, pending 1
    00> 
    00> <debug> nrf_dfu_ble: Freeing buffer 0x200082AC
    00> 
    00> <debug> nrf_dfu_ble: Buffer 0x200082AC acquired, len 244 (244)
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002C0F4, src=0x200082AC, len=244 bytes), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x0002C0F4, pending 1
    00> 
    00> <debug> nrf_dfu_ble: Freeing buffer 0x200082AC
    00> 
    00> <debug> nrf_dfu_ble: Buffer 0x200082AC acquired, len 244 (244)
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002C1E8, src=0x200082AC, len=244 bytes), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x0002C1E8, pending 1
    00> 
    00> <debug> nrf_dfu_ble: Freeing buffer 0x200082AC
    00> 
    00> <debug> nrf_dfu_ble: Buffer 0x200082AC acquired, len 244 (244)
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002C2DC, src=0x200082AC, len=244 bytes), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x0002C2DC, pending 1
    00> 
    00> <debug> nrf_dfu_ble: Freeing buffer 0x200082AC
    00> 
    00> <debug> nrf_dfu_ble: Buffer 0x200082AC acquired, len 244 (244)
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002C3D0, src=0x200082AC, len=244 bytes), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x0002C3D0, pending 1
    00> 
    00> <debug> nrf_dfu_ble: Freeing buffer 0x200082AC
    00> 
    00> <debug> nrf_dfu_ble: Buffer 0x200082AC acquired, len 104 (244)
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (data)
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0002C4C4, src=0x200082AC, len=104 bytes), queue usage: 1
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_flash: Flash write success: addr=0x0002C4C4, pending 1
    00> 
    00> <debug> nrf_dfu_ble: Freeing buffer 0x200082AC
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (data)
    00> 
    00> <debug> nrf_dfu_req_handler: Offset:25900, CRC:0x2A9E2C99
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (data)
    00> 
    00> <debug> nrf_dfu_req_handler: Whole firmware image received. Postvalidating.
    00> 
    00> <debug> nrf_dfu_validation: Hash verification. start address: 0x26000, size: 0x652C
    00> 
    00> <debug> nrf_dfu_validation: Invalidating old application in bank 0.
    00> 
    00> <debug> nrf_dfu_settings: Writing settings...
    00> 
    00> <debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
    00> 
    00> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 1<info> app: Inside main
    00> 
    00> <debug> app: In nrf_bootloader_init
    00> 
    00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00> 
    00> <debug> nrf_dfu_settings: Using settings page.
    00> 
    00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <debug> app: Enter nrf_bootloader_fw_activate
    00> 
    00> <info> app: No firmware to activate.
    00> 
    00> <info> app: Boot validation failed. No valid app to boot.
    00> 
    00> <debug> app: DFU mode because app is not valid.
    00> 
    00> <info> nrf_bootloader_wdt: WDT is not enabled
    00> 
    00> <debug> app: in weak nrf_dfu_init_user
    00> 
    00> <debug> app: timer_stop (0x20005984)
    00> 
    00> <debug> app: timer_activate (0x20005984)
    00> 
    00> <info> app: Entering DFU mode.
    00> 
    00> <debug> app: Initializing transports (found: 1)
    00> 
    00> <debug> nrf_dfu_ble: Initializing BLE DFU transport
    00> 
    00> <debug> nrf_dfu_ble: Setting up vector table: 0x00071000
    00> 
    00> <debug> nrf_dfu_ble: Enabling SoftDevice.
    00> 
    00> <debug> nrf_dfu_ble: Configuring BLE stack.
    00> 
    00> <debug> nrf_dfu_ble: Enabling the BLE stack.
    00> 
    00> <debug> nrf_dfu_ble: No advertising name found
    00> 
    00> <debug> nrf_dfu_ble: Using default advertising name
    00> 
    00> <debug> nrf_dfu_ble: Advertising...
    00> 
    00> <debug> nrf_dfu_ble: BLE DFU transport initialized.
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
    00> 
    00> <debug> app: Enter main loop
    00> 
    00> <debug> nrf_dfu_ble: Connected
    00> 
    00> <debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
    00> 
    00> <debug> nrf_dfu_ble: max_conn_interval: 12
    00> 
    00> <debug> nrf_dfu_ble: min_conn_interval: 12
    00> 
    00> <debug> nrf_dfu_ble: slave_latency: 0
    00> 
    00> <debug> nrf_dfu_ble: conn_sup_timeout: 600
    00> 
    00> <debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
    00> 
    00> <debug> nrf_dfu_ble: max_conn_interval: 6
    00> 
    00> <debug> nrf_dfu_ble: min_conn_interval: 6
    00> 
    00> <debug> nrf_dfu_ble: slave_latency: 0
    00> 
    00> <debug> nrf_dfu_ble: conn_sup_timeout: 500
    00> 
    00> <debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
    00> 
    00> <debug> nrf_dfu_ble: max_conn_interval: 12
    00> 
    00> <debug> nrf_dfu_ble: min_conn_interval: 12
    00> 
    00> <debug> nrf_dfu_ble: slave_latency: 0
    00> 
    00> <debug> nrf_dfu_ble: conn_sup_timeout: 600
    00> 
    00> <debug> nrf_dfu_ble: Advertising...
    00> 
    00> <debug> nrf_dfu_settings: Using settings page.
    00> 
    00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.

  • So the log above says that app is invalid: <debug> app: DFU mode because app is not valid. What can be the error when app works without DFU. And with other SparkFun hardware, the app also works with DFU? What else can I look for?

    Thanks

  • Hello,

    On the SparkFun hardware, did you program the bootloader yourself, or was it pre-programmed?

    How did you program the bootloader and application on your custom hardware? Did you generate and program the bootloader settings? If you compiled the bootloader yourself, did you do any changes to the bootloader project? If so, which ones?

    Do you see the bootloader advertisements? have you tried to update the firmware via DFU? If so, how did you generate the DFU image?

    Best regards,

    Edvin

Related