nrfutil dfu ble failure: pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: NRF_ERROR_TIMEOUT

Hi,

I am trying to to perform a DFU update to my device using an ANNA-B112 evaluation kit connected to my Ubuntu machine. The device supports DFU update. Here's what I'm doing and the result:

> nrfutil dfu ble -pkg MyPackage.zip -ic NRF52 -p /dev/ttyACM1 -n "MyDevice" -f

Board already flashed with connectivity firmware.
  [------------------------------------]    0%
Traceback (most recent call last):
  File "nordicsemi/__main__.py", line 1555, in <module>
  File "click/core.py", line 1137, in __call__
  File "click/core.py", line 1062, in main
  File "click/core.py", line 1668, in invoke
  File "click/core.py", line 1668, in invoke
  File "click/core.py", line 1404, in invoke
  File "click/core.py", line 763, in invoke
  File "nordicsemi/__main__.py", line 1215, in ble
  File "nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
  File "nordicsemi/dfu/dfu.py", line 88, in _dfu_send_image
  File "nordicsemi/dfu/dfu_transport_ble.py", line 474, in open
  File "nordicsemi/dfu/dfu_transport_ble.py", line 103, in open
  File "pc_ble_driver_py/ble_driver.py", line 106, in wrapper
pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: NRF_ERROR_TIMEOUT
[2665744] Failed to execute script '__main__' due to unhandled exception!

With this little information in the error message and the way nrfutil is distributed nowadays, it is pretty hard to start debugging this issue. What is actually failing here and any ideas to fix it?

Parents
  • Hi,

    Which version of nRFutil are you using? Did you download it from the main page, or are you using the legacy version?

    regards

    Jared 

  • Version 7.7.1 and downloaded from the main page

  • Hi,

    It seems like nrfutil is not able to establish a connection with your device. Can you try to use nRF Command line tools and see if the device is listed if you run:

    nrfjprog --ids

    and then see if you're able to recover the device if you run:

    nrfjprog --recover

    Next double check that you're using the correct serial port by running 

    ls /dev/tty*

    regards

    Jared 

  • Thanks for the response! I feel like there is a misunderstanding here. When performing the BLE DFU using nrfutil, there are two devices involved:

    1. The development kit performing the DFU
    2. The target device to which DFU is performed

    It seems to me that there is no problem in establishing a connection to device 1, i.e., the ANNA-B112 evaluation kit. I am able to use all of the above nrfjprog commands you suggested and it is recognized by nrufil as it is able to flash the connectivity firmware and verify that it is indeed flashed to the device as can be seen in the logs I posted in the original post:

    Board already flashed with connectivity firmware.

    Or are you implying that nrfutil is not able to establish a connection to device 2, i.e., my target BLE device? That would make sense and would be a starting point in debugging this issue. However, if that is the case, I fail to see how could I use the nrfjprog and ls commands you suggested to verify this issue. The BLE device is not connected to the PC in any way. I can however see the target device when scanning for bluetooth devices.

Reply
  • Thanks for the response! I feel like there is a misunderstanding here. When performing the BLE DFU using nrfutil, there are two devices involved:

    1. The development kit performing the DFU
    2. The target device to which DFU is performed

    It seems to me that there is no problem in establishing a connection to device 1, i.e., the ANNA-B112 evaluation kit. I am able to use all of the above nrfjprog commands you suggested and it is recognized by nrufil as it is able to flash the connectivity firmware and verify that it is indeed flashed to the device as can be seen in the logs I posted in the original post:

    Board already flashed with connectivity firmware.

    Or are you implying that nrfutil is not able to establish a connection to device 2, i.e., my target BLE device? That would make sense and would be a starting point in debugging this issue. However, if that is the case, I fail to see how could I use the nrfjprog and ls commands you suggested to verify this issue. The BLE device is not connected to the PC in any way. I can however see the target device when scanning for bluetooth devices.

Children
  • Hi,

    I see. I honestly believed that the issue was the first case but thanks for clarifying. 

    1. Can you specify what SDK version you used on the target device? Is it BLE OTA from nRF5SDK or from nRF Connect SDK?
    2. When you scan for the device, do you see it advertise with the name "MyDevice" specifically? 

    Also, with nrfutil you can add --verbose option to make the logs more verbose. It would be great if you can do that and reshare the log again.

    regards

    Jared 

  • Hi,

    1. We are using nRF5SDK 17.1.0

    2. Yes

    We are able to do the DFU update from PC by customizing the deprecated nrfutil python package (without customizing it, it is not possible to do it from PC directly. A development kit is needed). The problem is with this new nrfutil that is not distributed as a python package. We cannot currently use the deprecated nrfutil python package, as installed with pip, because it does not support new Python versions.

    Additionally, DFU update is working from the Nordic DFU mobile application.

  • Hi,

    I have looked more thoroughly through what might be the original issue here, and although nrfutil detects the connectivity firmware on the device, it looks like the firmware does not work as intended.

    More precisely, the error is due to nrfutil failing to establish a connection with the connectivity device. The lines of code referred to by the error log are from pc-ble-driver-py and pc-nrfutil, which are both still available on GitHub. With the new nrfutil, those are the old libraries still getting run if you nrfutil install nrf5sdk-tools and then run nrfutil nrf5sdk-tools dfu (or nrfutil dfu). Please note that when run this way you get a compiled version, so you should not run into Python 2 issues.

    Alternatively, nrfutil device program --fimrware <upgrade.zip> --serial-number <serial number> may work, but only if nrfutil detects the nRF52 Dongle as the connectivity device.

    If you actually do need some patch on the DFU implementation itself, then of course the only remaining option would be to use the legacy nrfutil, in python form, patch it, and run it with Python 2. This should however not be the issue, if DFU from our smartphone application works. Rather, the issue must then be with the connectivity device and/or PC side application.

    If you are using a custom board (or third party module) for connectivity device, then changes may be needed for the connectivity firmware itself. The connectivity firmware is a patched version of the serialization example from nRF5 SDK, and patches and instructions are found in the pc-ble-driver repository on GitHub. Modify the firmware to work with the custom board, manually program the board with this firmware, and run nrfutil afterwards. Now nrfutil should see that the connectivity device does have connectivity firmware, so the firmware will not get overwritten with the hex file included with nrfutil, and nrfutil should be able to connect and use the connectivity device.

    Please note that in almost all cases it would be much easier to just use an already supported device as connectivity device, than to port the connectivity firmware to a previously unsupported device.

    Regards,
    Terje

  • Hi,

    Thanks for the info. From your reply it seems to me that it it is not working because we are using ANNA-B112 evaluation kit instead of nRF5 development kit.

    The problem is that we would like to be able to perform DFU from the command line as part of a CI pipeline step and currently it is not possible to use old versions of Python. Previously we achieved this by patching nrfutil to support DFU without the connectivity device and it worked. I guess we will have to get an nRF5 development kit or is there another way to perform DFU from the command line by just using the PC without an additional connectivity device?

  • I have now acquired the official nRF52 development kit and I still get the same error: NRF_ERROR_TIMEOUT.

    Edit. actually I was now able to get it to work. Plugging the DK created two devices: ttyACM1 and ttyACM0. I had to use ttyACM0 instead of ttyACM1. Thanks for the help.

Related