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

Secure DFU Bootloader BLE not working with nRF Connect PC

What could be the reasons that cause DFU Bootloader BLE not working with nRF Connect on PC (while it works with nRF Connect on iOS)? I have had various problem with nRF Connect on PC so far:

1/ With my custom board: I modified the custom_board.h and create a new bootloader for my custom board. I can find the board on nRF Connect scanner, connect to it, but can't load new zip file through the DFU service. I attached the screenshot, the nRF Connect log file and the log file from my custom board (nRF52382) for more information.

 nrfConnect_bootloader_log.txt

00> <info> app: Inside main
00> <debug> app: In nrf_bootloader_init
00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
00> <debug> nrf_dfu_settings: Resetting bootloader settings.
00> <debug> nrf_dfu_settings: Writing settings...
00> <debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
00> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 0
00> <debug> nrf_dfu_flash: Flash erase success: addr=0x0007F000, pending 0
00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007F000, src=0x200092A4, len=440 bytes), queue usage: 1
00> <debug> nrf_dfu_flash: Flash write success: addr=0x0007F000, pending 0
00> <debug> app: Enter nrf_bootloader_fw_activate
00> <info> app: No firmwareto activate.
00> <debug> app: Enter nrf_dfu_app_is_valid
00> <debug> app: Return false in valid app check
00> <debug> app: DFU mode because app is not valid.
00> <info> nrf_bootloader_wdt: WDT is not enabled
00> <debug> app: in weak nrf_dfu_init_user
00> <info> app_timer: RTC: initialized.
00> <info> app: Entering DFU mode.
00> <debug> app: Initializing transports (found: 1)
00> <debug> nrf_dfu_ble: Initializing BLE DFU transport
00> <debug> nrf_dfu_ble: Setting up vector table: 0x00072000
00> <debug> nrf_dfu_ble: Enabling SoftDevice.
00> <debug> nrf_dfu_ble: Configuring BLE stack.
00> <debug> nrf_dfu_ble: Enabling the BLE stack.
00> <debug> nrf_dfu_ble: No advertising name found
00> <debug> nrf_dfu_ble: Using default advertising name
00> <debug> nrf_dfu_ble: Advertising...
00> <debug> nrf_dfu_ble: BLE DFU transport initialized.
00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
00> <debug> app: Enter main loop
00> <debug> nrf_dfu_ble: Connected
00> <debug> nrf_dfu_ble: Received BLE_GAP_EVT_CONN_PARAM_UPDATE
00> <debug> nrf_dfu_ble: max_conn_interval: 12
00> <debug> nrf_dfu_ble: min_conn_interval: 12
00> <debug> nrf_dfu_ble: slave_latency: 0
00> <debug> nrf_dfu_ble: conn_sup_timeout: 600
00> <debug> nrf_dfu_ble: Finished handling conn sec update
00> <debug> nrf_dfu_ble: Set receipt notif
00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_RECEIPT_NOTIF_SET
00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
00> <debug> nrf_dfu_ble: Received BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST (request: 247, reply: 247).
00> <debug> nrf_dfu_ble: Received BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST.
00> <debug> nrf_dfu_ble: Received BLE_GAP_EVT_DATA_LENGTH_UPDATE (251, max_rx_time 2120).
00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_SELECT (command)
00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
00> <debug> app: Shutting down transports (found: 1)
00> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_CREATE (command)
00> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1

2/ With my nRF52 development board (PCA 10040): For this board, I tried both the bootloaders from SDK15.0.0\examples\dfu\secure_bootloader\pca10040_ble and pca10040_ble_debug. In both case the nRF Connect on PC does not see the board on the scanner. There is no "DFU Targ" device. I had this problem with my custom board before, and fixed it by changing the LF Clock  setting in sdk_config.h but with PCA10040 I have tried different combinations settings but it still didn't work.

Note that the bootloaders work okay on both boards when I used nRF Connect on iOS. I use softdevice s132v6.0.0 and sdk15.0.0.

Parents
  • Hello,

    Can you try to upload the image again? The resolution was really low. Alternatively, can you note down what the error message was saying?

    Is it the exact same DFU packet you are trying to send over nRF Connect for Desktop and nRF Connect for iOS?

    BR,

    Edvin

  • The error messages are:

    "Failed to write to attribute with handle: 13: Error occured when writing. Errorcode: Unknown value (0x8005)

    Failed to write to attribute with handle: 15: Error occured when writing. Errorcode: Unknown value (0x8005)

    When writing 'CREATE' command to Control Point Characteristic of DFU Target: Could not write CREATE command: Failed to write to attribute with handle: 15: Error occured when writing. Errorcode: Unknown value (0x8005)

    Failed to disconnect (Unknown value)"

    The log from nRF Connect that I attached above also has some error messages. 

    Yes, I used the same packet for both PC and iOS.

  • Have you done any changes to the bootloader project? Did you e.g. enable bonding in the bootloader project? Perhaps you have bonded with the iOS device, but not the PC?

    When you do this, what is programmed on your nRF? Bootloader + softdevice? Is there an app present?

    Have you tried to follow this guide?

    Does it happen if you delete the entire flash of the nRF (nrfjprog -e) and flash bootloader + softdevice, and then try again?

  • In the bootloader project, I only change the custom_board.h and the low frequency clock configuration:

    #define NRF_SDH_CLOCK_LF_SRC 	    	2
    #define NRF_SDH_CLOCK_LF_RC_CTIV 		0
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 	0
    #define NRF_SDH_CLOCK_LF_ACCURACY   	7

    I have tried with only bootloader and softdevice and the result stays the same (works with iOS but not with PC version)

  • Just to see if this is clock related, try to set NRF_SDH_CLOCK_LF_ACCURACY to 1.

    What is NRF_DFU_BLE_REQUIRES_BONDS in sdk_config.h?

    Does the same happen if you try to run the bootloader on a DK, or does it only happen on the custom board?

    Are you completely sure you didn't change anything else? Perhaps you changed some files from another project that are also used in the bootloader project? Can you please try to unzip an unmodified SDK, and only change the private and public keys, your board file and the clock settings listed above?

  • I forgot to mention, I also need to switch the library for micro-ecc because I use IAR 8 (according to SDK v16 Note Release). 

    I have tried to unzip an unmodified SDK, but got the same error. After the error, the DK that I used for nRF Connect BLE Scan froze. After power cycle the DK, it can scan normally, but it doesn't see the DFU Targ device. I have to reprogram the DK in order to see the DFU Targ on Scanner.

    I have tried the bootloader with a DK, and same thing happened. Could it be something wrong with nRF Connect? I have nRF Connect v3.3.0 and Bluetooth Low Energy tool v2.3.2

Reply
  • I forgot to mention, I also need to switch the library for micro-ecc because I use IAR 8 (according to SDK v16 Note Release). 

    I have tried to unzip an unmodified SDK, but got the same error. After the error, the DK that I used for nRF Connect BLE Scan froze. After power cycle the DK, it can scan normally, but it doesn't see the DFU Targ device. I have to reprogram the DK in order to see the DFU Targ on Scanner.

    I have tried the bootloader with a DK, and same thing happened. Could it be something wrong with nRF Connect? I have nRF Connect v3.3.0 and Bluetooth Low Energy tool v2.3.2

Children
Related