Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52832 BLE secure DFU bootloader

I'm trying to follow the SDK 15.2.0, nRF52832 development board,  BLE Secure DFU bootloader example.  I cannot seem to get beyond exception error running nrfutil to download new image: Exception: Connection Failure - Device not found!. 

The device is visible in nRF Connect v2.5.0, board contains image sd_132_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_without_bonds.hex loaded earlier with nRFgo Studio v1.21.2.10.  I found no means of downloading using nRF Connect, though I could enable buttonless DFU.

I'm using nrfutil command line

nrfutil dfu ble -ic NRF52 -f -pkg c:\CGM\nRF5_SDK_15.2.0_9412b96\examples\dfu\secure_dfu_test_images\ble\nrf52832\ble_app_buttonless_dfu_with_bonds_s132.zip

When done it appears to have erased the original application.

Clearly I'm missing something......

Parents
  • I managed to make it work by following these steps:

    • Flash sd_s132_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_without_bonds.hex onto an nRF52832 board
    • Reset that board while pressing button 4 (Enter DFU mode)
    • Open nRF Connect and notice the advertising name (Which is switched to DfuTest after entering DFU mode)
    • Connect another nRF52832 to the computer, and run the following command: nrfutil dfu ble -ic NRF52 -f -pkg ble_app_buttonless_dfu_with_bonds_s132.zip -n "DfuTest"
    • Choose the correct COM port and board (not the board with the bootloader)

    Then I didn't get the Connection Failure error anymore, but I encountered another problem (log from device with bootloader):

    <info> app: Setting vector table to bootloader: 0x00072000
    <error> app: Fatal error
    <warning> app: System reset

    I will try to look into this, but hopefully I was able to help you one step ahead.

    Best regards, Simon

  • Hi Simon,  Thank your for looking into this so quickly!

    Question: Why  'Connect another nRF52832'?  This board would also need to have 'DfuTest' installed and in that mode for it to work, wouldn't it?  Why cannot simply connect the original board with the bootloader? 

    Another  Question:  The nrfutil parameter -n "DfuTest', the doc is unclear to me.  What happens if DfuTest is not running, I would expect an error, yes?  Or is -n parameter only specify a 'preferred' device, to be updated if found?

    My task is to verify OTA update, so I did the following test.  The goal here is to update an existing image.  Here I wish to update the 'with_bonds' image with the image 'without_bonds'

    Steps taken:

    Downloaded app using nRFgo Studio
     sd_s132_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_without_bonds.hex
     Able to place in DFU mode (DfuTest) or in app mode (Nordic_Buttonless)

    Enter DfuTest mode, run following:
     nrfutil dfu ble -ic NRF52 -f -pkg ble_app_buttonless_dfu_with_bonds_s132.zip -n "DfuTest"

    results:

    Please select connectivity serial port:
            0 : COM19 - 682437910
    Enter your choice: : 0
    Flashing connectivity firmware...
    Connectivity firmware flashed.
      [------------------------------------]    0%
    Traceback (most recent call last):
      File "nordicsemi\__main__.py", line 1133, in <module>
      File "site-packages\click\core.py", line 722, in __call__
      File "site-packages\click\core.py", line 697, in main
      File "site-packages\click\core.py", line 1066, in invoke
      File "site-packages\click\core.py", line 1066, in invoke
      File "site-packages\click\core.py", line 895, in invoke
      File "site-packages\click\core.py", line 535, in invoke
      File "nordicsemi\__main__.py", line 951, in ble
      File "nordicsemi\dfu\dfu.py", line 129, in dfu_send_images
      File "nordicsemi\dfu\dfu.py", line 90, in _dfu_send_image
      File "nordicsemi\dfu\dfu_transport_ble.py", line 453, in open
      File "nordicsemi\dfu\dfu_transport_ble.py", line 142, in connect
      File "nordicsemi\dfu\dfu_transport_ble.py", line 245, in verify_stable_connection
    Exception: Connection Failure - Device not found!
    Failed to execute script __main__

    Board does not appear in nRFConnect, unable to get board to advertise, does not enter DFU mode.

    BTW unclear what the parameter -f exactly means or does.  What is connectivity firmware? 

Reply
  • Hi Simon,  Thank your for looking into this so quickly!

    Question: Why  'Connect another nRF52832'?  This board would also need to have 'DfuTest' installed and in that mode for it to work, wouldn't it?  Why cannot simply connect the original board with the bootloader? 

    Another  Question:  The nrfutil parameter -n "DfuTest', the doc is unclear to me.  What happens if DfuTest is not running, I would expect an error, yes?  Or is -n parameter only specify a 'preferred' device, to be updated if found?

    My task is to verify OTA update, so I did the following test.  The goal here is to update an existing image.  Here I wish to update the 'with_bonds' image with the image 'without_bonds'

    Steps taken:

    Downloaded app using nRFgo Studio
     sd_s132_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_without_bonds.hex
     Able to place in DFU mode (DfuTest) or in app mode (Nordic_Buttonless)

    Enter DfuTest mode, run following:
     nrfutil dfu ble -ic NRF52 -f -pkg ble_app_buttonless_dfu_with_bonds_s132.zip -n "DfuTest"

    results:

    Please select connectivity serial port:
            0 : COM19 - 682437910
    Enter your choice: : 0
    Flashing connectivity firmware...
    Connectivity firmware flashed.
      [------------------------------------]    0%
    Traceback (most recent call last):
      File "nordicsemi\__main__.py", line 1133, in <module>
      File "site-packages\click\core.py", line 722, in __call__
      File "site-packages\click\core.py", line 697, in main
      File "site-packages\click\core.py", line 1066, in invoke
      File "site-packages\click\core.py", line 1066, in invoke
      File "site-packages\click\core.py", line 895, in invoke
      File "site-packages\click\core.py", line 535, in invoke
      File "nordicsemi\__main__.py", line 951, in ble
      File "nordicsemi\dfu\dfu.py", line 129, in dfu_send_images
      File "nordicsemi\dfu\dfu.py", line 90, in _dfu_send_image
      File "nordicsemi\dfu\dfu_transport_ble.py", line 453, in open
      File "nordicsemi\dfu\dfu_transport_ble.py", line 142, in connect
      File "nordicsemi\dfu\dfu_transport_ble.py", line 245, in verify_stable_connection
    Exception: Connection Failure - Device not found!
    Failed to execute script __main__

    Board does not appear in nRFConnect, unable to get board to advertise, does not enter DFU mode.

    BTW unclear what the parameter -f exactly means or does.  What is connectivity firmware? 

Children
  • gringlediscus said:
    Why  'Connect another nRF52832'?  This board would also need to have 'DfuTest' installed and in that mode for it to work, wouldn't it?  Why cannot simply connect the original board with the bootloader?

    When you are using the BLE Secure DFU Bootloader, you must upload the firmware over BLE, thus another device is required to transfer the DFU data (ble_app_buttonless_dfu_with_bonds_s132.zip) over BLE. However, if you want to perform a DFU from the computer to the nRF52832, you might want to look into the Secure DFU Bootloader over Serial Link (UART/USB) example.

    As described in the documentation for the BLE Secure DFU Bootloader, performing a DFU over BLE can be done in two ways: from another device (using nrfutil commands) or from the phone (using nRF Toolbox or nRF Connect).

    gringlediscus said:
    The nrfutil parameter -n "DfuTest', the doc is unclear to me.  What happens if DfuTest is not running, I would expect an error, yes?  Or is -n parameter only specify a 'preferred' device, to be updated if found?

     This parameter describes which device to perform DFU on. The option -a can also be used to choose a specific target, which requires the BLE address of the target device as input. 

    The command "nrfutil dfu ble --help" gives information about all the different options. If DfuTest is not running on the target device, the device is not in DFU mode and you wont be able to perform a DFU

    Here is a nice tutorial for the Secure DFU Bootloader:

    https://devzone.nordicsemi.com/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader

    Best regards, Simon

Related