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

nrf_dfu_transports_init() error in background dfu

Hi,

I am using 

  • PCA10056
  • SDK 15.3.0
  • Keil IDE
  • The soft device is S140 
  • JLinkRTTViewer for debug

I am testing background serial-dfu.(refer to https://devzone.nordicsemi.com/f/nordic-q-a/46336/bootloader-no-transport-dual-bank-dfu-and-dependencies)

I erase 52840 whole and write SoftDevice & bootloader.

I used keil debug to download the app and run.

An error occurred with the attachment.

Please advise

Alex

Parents
  • Hi Alex,

    Looks like the error comes from the uart_dfu_transport_init() function in nrf_dfu_serial_uart.c. Please try to debug this function to find out what's returning the error. 

    Best regards,

    Vidar

  • Hi Vidar,

    1 ) It returns 0x08 from nrf_dfu_transport_init (dfu_observer).

          An error occurred with the attachment.

    2) I set NRF_LOG_ENABLE to 1 in the bootloader and the application.

         The bootloader prints messages well, but the application does not print them.

         Please advise.

  • Hi Vidar,

    1. We use a single serial port to communicate with the server and do a background dfu at the same time.
    After executing app_uart () function in main (), dfu_init () is executed.
    I run init 2 times on a single uart, so I think the above error occurs
    Am I correct?
    How should uart_init () be changed if server communication and background dfu are executed simultaneously with one uart?

    2. I commented app_uart () in main () and ran the program
    Please advise me why I am getting a 'cache too small error'?
    I added a log file

    # SEGGER J-Link RTT Viewer V6.52e Terminal Log File
    # Compiled: 12:19:47 on Oct 16 2019
    # Logging started @ 10 Feb 2020 20:40:03
    
    00> <info> app: Initializing fds...
    00> 
    00> <info> app: Reading flash usage statistics...
    00> 
    00> <info> app: Found 1 valid records.
    00> 
    00> <info> app: Found 0 dirty records (ready to be garbage collected).
    00> 
    00> <info> app: Setup Config file found, updating boot count to 8.
    00> 
    00> <info> app: Load Config file found, updating boot count to 9.
    00> 
    00> <info> app: Reset Config file found, updating boot count to 9.
    00> 
    00> 
    00> <error> app: Bootloader start address is not set
    00> 
    00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00> 
    00> <warning> nrf_dfu_settings: Resetting bootloader settings since neither the settings page nor the backup are valid (CRC error).
    00> 
    00> <warning> nrf_dfu_settings: Settings write aborted since it tries writing to forbidden settings.
    00> 
    00> <error> nrf_dfu_settings: nrf_dfu_settings_write_and_backup() failed with error: F
    00> 
    00> ed
    00> 
    00> <info> app: NRF_DFU_EVT_TRANSPORT_ACTIVATED
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00> 
    00> <info> app: Application version 0
    00> 
    00> <debug> ble_scan: Filter set on address type 1, address 0x
    00> 
    00> <debug> ble_scan: D7
    00> 
    00> <debug> ble_scan: D7
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <debug> nrf_dfu_serial: Received ping 1
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B078
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_PING
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x9, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <debug> nrf_dfu_serial: Set receipt notif target: 0
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B078
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_RECEIPT_NOTIF_SET
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x2, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <debug> nrf_dfu_serial: Received serial mtu
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B078
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_MTU_GET
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x7, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B078
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_SELECT (command)
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x6, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <debug> app: Shutting down transports (found: 1)
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B078
    00> 
    00> mmand)
    00> 
    00> <info> app: NRF_DFU_EVT_DFU_STARTED
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x1, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B0FC
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B078
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B0FC
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B0FC
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (command)
    00> 
    00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
    00> 
    00> <debug> nrf_dfu_serial: Sending Response: [0x3, 0x1]
    00> 
    00> <info> nrf_dfu_serial: nrf_dfu_serial_on_packet_received
    00> 
    00> <info> nrf_dfu_serial_uart: Allocated buffer 2000B0FC
    00> 
    00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command)
    00> 
    00> <debug> nrf_dfu_validation: PB: Init packet data len: 64
    00> 
    00> <info> nrf_dfu_validation: Signature required. Checking signature.
    00> 
    00> <info> nrf_dfu_validation: Calculating hash (len: 64)
    00> 
    00> <info> nrf_dfu_validation: Verify signature
    00> 
    00> <info> nrf_dfu_validation: Image verified
    00> 
    00> <debug> app: Enter nrf_dfu_cache_prepare()
    00> 
    00> <debug> app: required_size: 0x29BD0.
    00> 
    00> <debug> app: single_bank: false.
    00> 
    00> <debug> app: keep_app: true.
    00> 
    00> <debug> app: keep_softdevice: true.
    00> 
    00> <debug> app: SD_PRESENT: true.
    00> 
    00> <debug> app: Bank contents:
    00> 
    00> <debug> app: Bank 0 code: 0x00: Size: 0x0
    00> 
    00> <debug> app: Bank 1 code: 0x00: Size: 0x0
    00> 
    00> <debug> app: pass: 0.
    00> 
    00> <debug> app: cache_address: 0x26000.
    00> 
    00> <debug> app: cache_too_small: false.
    00> 
    00> 0xA
    00> 
    00> 
    00> 

  • Hi,

    1. Yes, the driver will return the invalid state error if you try to init the same UART twice. 

    2.  Notice it says "cache_too_small: false". So it is enough cache to store the new image.  However, "cache_address" is wrong. It should start at bank 1, not bank 0 where the current application resides.

  • Hi,

    I am continuing the background dfu test.

    1. Why did the following message appear when I turn the power on?

       app: Incorrect bootloader start address. Set BOOTLOADER_START_ADDR to 0xE4000

    2. Is the log progress correct?

       I don't know why it doesn't progress at all after the last message in the log.

      00> <debug> app: Bank 0 code: 0x01: Size: 0x296F0
      00>
      00> <debug> app: Bank 1 code: 0x00: Size: 0x0
      00>
      00> <debug> app: pass: 0.
      00>
      00> <debug> app: cache_address: 0x50000.
      00>
      00> <debug> app: cache_too_small: false.

    Please advise.

  • Hi,

    Downloading using the bootloader on the target board works well and runs normally.

    Using background dfu causes the same problem as above.

  • Hi,

    1. What is BOOTLOADER_START_ADDR set to in your project settings? The problem is that it doesn't correspond to the actual bootloader start address.

    2. This one looks better. Bank 0 looks to contain valid data and the cache is starting at bank 1.

Reply Children
Related