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

Not able to perform last step of OTA DFU on nRF52840 - error from nrfutil

Dear DevZone,
I'm trying to perform a BLE OTA DFU with two nRF52840 Dev Kits.
I followed the step by step guide from Nordic provided at the following link: devzone.nordicsemi.com/.../getting-started-with-nordics-secure-dfu-bootloader
In particular:

  • I generated public and private keys
  • I compiled the uECC lubrary
  • I built the bootloader having substituted the public_key of reference
  • I generated the DFU .zip packet with example blinky using the following nrfutil command: nrfutil pkg generate --hw-version 52 --application-version 0X00 --application C:\...\blinky_pca10056_mbr.hex --sd-req 0xB6 --key-file C:\...\private.key app_dfu_package.zip
  • I flashed firstly the softdevice, then the bootloader (examples\dfu\bootloader_secure_ble) on the target device (the one I want to update with OTA DFU)

Here, I verified through nRFConnect that the program start advertising the presence of the devkit as DfuTarg (I connected the other devkit to the PC as master, without code on it). Contrarily to what written in the guide, led 1 and 2 light up instead of led 3, but looking at this ticket, the state I experience should be the correct one for the entrance in DFU mode.

Now, the problem occurs when I try to perform the OTA DFU. To do this, I use nrfutil and the command:

nrfutil dfu ble -ic NRF52  -f -pkg C:\..\app_dfu_package.zip

In fact, it shows the following error:

Traceback (most recent call last):
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 2787, in call_cmd
    return subprocess.check_output(
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['nrfjprog', '--snr', '683098617', '--memrd', '327680', '--w', '8', '--n', '24', '--family', 'NRF52']' returned non-zero exit status 18.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\gimilani\AppData\Local\Programs\Python\Python38-32\Scripts\nrfutil.exe\__main__.py", line 7, in <module>
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\nordicsemi\__main__.py", line 1160, in ble
    if flasher.fw_check():
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 2741, in fw_check
    fw_struct = Flasher.parse_fw_struct(self.read_fw_struct())
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 2764, in read_fw_struct
    data = self.call_cmd(args)
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\wrapt\wrappers.py", line 605, in __call__
    return self._self_wrapper(self.__wrapped__, self._self_instance,
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\wrapt\decorators.py", line 445, in _synchronized
    return wrapped(*args, **kwargs)
  File "c:\users\gimilani\appdata\local\programs\python\python38-32\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 2792, in call_cmd
    raise RuntimeError("Invalid Connectivity IC ID: {}".format(self.family))
RuntimeError: Invalid Connectivity IC ID: NRF52

Do you have any suggestions on this?

I also tried to perform the DFU through nRF Connect from mobile app-PC, but I cannot find the way to add the .zip packet in order to be sent(below the screenshot). 

Thank you very much in advance,

best regards,

Gianluca

Parents
  • Hello Gianluca,

     

    I also tried to perform the DFU through nRF Connect from mobile app-PC, but I cannot find the way to add the .zip packet in order to be sent(below the screenshot). 

     Try to click the the blue DFU icon with the arrows around it:

    As for the nrfutil approach:

    The command looks correct. Can you verify that you use the USB contact at the short end of the nRF52DK, and that you have not opened the COM port in another application (such as nRF Connect). Try to close any other applications that may use the debugger, and try to call the command again.

    If that doesn't work, what nrfutil version are you using? Find out using the command "nrfutil version"

    BR,

    Edvin

  • Dear Edvin, 

    thank you very much for the answer.

    For the nrfutil approach:

    - I'm using the USB port in the short side of the nRF dev kit connected to the PC

    - I closed all the applications with COM port opened such as nRF Connect and using debugger such as Segger Embedded studio

    but it is still not working and the same message appears.

    - The nrfutil version installed is the 6.1.0

    6 2017-q1-update of the GNU Arm Embedded Toolchain installed

    For the nRF Connect approach

    - Thanks for the hint, sorry but I didn't notice it. I managed to correctly upload the zip folder and I tried to perform the DFU (the loading bar reached 100% and a message stating the successful end of the process appeared)

    - Unfortunately, the LEDs didn't start to blink! Note that if I upload the blinky example in the traditional way via USB (even after having uploaded the softdevice and the bootloader), it works correctly.

    This is the memory reading after uploading through DFU (I hope you can see):

    Do you have any suggestions?

    Thanks,

    Gianluca

Reply
  • Dear Edvin, 

    thank you very much for the answer.

    For the nrfutil approach:

    - I'm using the USB port in the short side of the nRF dev kit connected to the PC

    - I closed all the applications with COM port opened such as nRF Connect and using debugger such as Segger Embedded studio

    but it is still not working and the same message appears.

    - The nrfutil version installed is the 6.1.0

    6 2017-q1-update of the GNU Arm Embedded Toolchain installed

    For the nRF Connect approach

    - Thanks for the hint, sorry but I didn't notice it. I managed to correctly upload the zip folder and I tried to perform the DFU (the loading bar reached 100% and a message stating the successful end of the process appeared)

    - Unfortunately, the LEDs didn't start to blink! Note that if I upload the blinky example in the traditional way via USB (even after having uploaded the softdevice and the bootloader), it works correctly.

    This is the memory reading after uploading through DFU (I hope you can see):

    Do you have any suggestions?

    Thanks,

    Gianluca

Children
  • Hello Gianluca,

    Yes, I see that the example found in SDK\examples\peripheral\blinky\pca10056\mbr doesn't like that there is a softdevice present. If you are using this example only for testing, I suggest that you test this with an example found in the SDK\examples\ble_peripheral folder, such as the ble_app_blinky. NB: it doesn't blink, but it lights up and starts advertising.

    Or you can use any other example using the softdevice.

    Just checking, Are you using another DK for your dfu command:

    nrfutil dfu ble ...

    ?

    And have you tried erasing it before calling this? As long as you use the -f flag nrfutil should flash it with the proper FW.

  • Dear Edvin,

    thank you again for your support, it is fundamental for us.

    For the nRF Connect approach:

    • Some little differences appear using the ble_app_blinky with respect to the blinky example, but still is not advertising correctly after uploading. In particular:
    • I firstly tried uploading the ble_app_blinky application in the traditional way (USB) and it worked correctly, lighting up before with LED1 then with LED2 and advertising as 'Nordic Blinky'
    • Then, I tried to upload via OTA DFU: I firstly uploaded SoftDevice and bootloader, I created the new package and I run the DFU. Differently to the blinky example, the program showed this loading bar(see the figure below), so I expected a good result this time. A message telling the successful end of the process appeared.

      

    • Unfortunately, after that, the device does not start advertising and all LEDs turn off apart from led5 
    • Moreover, in the BLE application in nRF Connect, the device Scan do not find the target device anymore.

    The memory reading after the OTA DFU is similar to the one provided in the last comment, the differences are represented by the parts highlighted in the figure below:

    For the nrfutil approach:

    yes I'm trying using another DK connected to the PC, I erased all the content and I close nRF Connect before running the command, but the result is the same.

    Thank you very much,

    Gianluca

  • Hello,

    Can you double check that your bootloader and the application hex file you used to generate the application image use the same softdevice. What .hex file do you use to generate the application DFU image?

    If nRF Connect says the transfer completed successfully, then the application was transferred, so most likely, the application crashes before it starts advertising. Did you do any changes to the project? Perhaps you can try all this with a clean unmodified version of the SDK? And use the .hex file that is generated when you compile the project, and not the ones located in the SDK\example\ble_peripheral\ble_app_blinky\hex folder. Perhaps that was what you were doing?

  • Dear Edvin, 

    thank you very much, indeed I was using the .hex file located in the SDK\example\ble_peripheral\ble_app_blinky\hex folder.

    Switching to the one that is generated when you compile the project, it worked correctly!

    I would ask you about one doubt: I have a custom application which I want to update via OTA DFU.

    Are the instructions given in the following links valid only if your custom application makes use of the BLE or also if not (for instance the first link refers to the UART example)?

     

    I ask this because my custom application does not use BLE but ESB (Enhanced ShockBurst). So my question is:

    should I follow those instructions, or is it better to follow another approach like the one described in the following link? (below a figure)

    In the second case, do you know if there is any documentation on how to create the transport layer for the ESB?

    Thank you very much in advance. If you think I should open a new ticket for this doubt, let me know please.

    Best regards,

    Gianluca

Related