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

nrfutil "image not found error"

Hi there,
I'm using nrfutil (nrfutil version 6.0.1) to dfu via ble (dongle),

Mac (10.15.2), windows (10), linux (raspbian) have been tried out to update the firmware
none has successfully updated the firmware

the command line used to update firmware is </nrfutil dfu ble -pkg <FilePath> -ic NRF52 -n "<DeviceName>" -f>

for windows extra </-p COM1> was added which was the dongle com port,

for raspbian, it was a deadend since the beginning of installation as the latest version available for module (pc-ble-driver-py) was 0.11.4, while requirements was 0.14.1, so I assumed to have it working first on the other 2 platforms,


so, I got for Mac the following error:

Traceback (most recent call last):
  File "/usr/local/bin/nrfutil", line 8, in <module>
    sys.exit(cli())
  File "/Users/ramyezzat/Library/Python/3.7/lib/python/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/ramyezzat/Library/Python/3.7/lib/python/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/ramyezzat/Library/Python/3.7/lib/python/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ramyezzat/Library/Python/3.7/lib/python/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ramyezzat/Library/Python/3.7/lib/python/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/ramyezzat/Library/Python/3.7/lib/python/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 1099, in ble
    ble_driver_init(conn_ic_id)
  File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 68, in ble_driver_init
    from pc_ble_driver_py.ble_driver    import BLEDriver, Flasher
  File "/usr/local/lib/python3.7/site-packages/pc_ble_driver_py/ble_driver.py", line 77, in <module>
    import pc_ble_driver_py.lib.nrf_ble_driver_sd_api_v5 as driver
  File "/usr/local/lib/python3.7/site-packages/pc_ble_driver_py/lib/nrf_ble_driver_sd_api_v5.py", line 13, in <module>
    from . import _nrf_ble_driver_sd_api_v5
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/pc_ble_driver_py/lib/_nrf_ble_driver_sd_api_v5.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python
  Referenced from: /usr/local/lib/python3.7/site-packages/pc_ble_driver_py/lib/_nrf_ble_driver_sd_api_v5.so
  Reason: image not found

and for windows I got the following error:

Traceback (most recent call last):
  File "c:\users\developer\python3\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 2731, in __init__
    snr = [d.serial_number for d in serial_ports if d.port == serial_port][0]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Users\developer\PYTHON3\Scripts\nrfutil-script.py", line 11, in <module>
    load_entry_point('nrfutil==6.0.1', 'console_scripts', 'nrfutil')()
  File "c:\users\developer\python3\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\developer\python3\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\users\developer\python3\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\developer\python3\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\developer\python3\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\developer\python3\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\users\developer\python3\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\__main__.py", line 1120, in ble
    flasher = Flasher(serial_port=port, snr = jlink_snr)
  File "c:\users\developer\python3\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 2733, in __init__
    raise NordicSemiException("Board not found: {}".format(serial_port or snr))
pc_ble_driver_py.exceptions.NordicSemiException: Board not found: COM1


eventually I'd like to wrap the code into another python module,

any idea what could possibly be wrong or missing?

Parents
  • Hi,

    For the window case, you cannot use ASUS USB-BT400. The example you refer to is based on HCI, but nrfutil is based on serialized SoftDevice API's via pc-ble-driver. This is completely different. Therefore, you can only use nrfutil with nRF5 devices.

    For the Mac case, the error indicates that you are using the python version that is shipped with Mac OS, and that will not work. We only test with the python distribution from python.org, and there is a hard requirement that the path is what is used by it (/Library/Frameworks/Python.framework/Versions/3.7/Python).

  • what about Ubuntu, is it possible to use the ASUS dongle? or is it still recommended to use the NRF5 devices?
    and in case using a NRF52 DK is there an example has to be on the DK, or using nrfutil with <-snr <DK serial number>> would be using the ble directly?

  • Ramy said:
    what about Ubuntu, is it possible to use the ASUS dongle? or is it still recommended to use the NRF5 devices?

    No, it is not possible to use a random dongle. Usage of a nRF5 device is not a recommendation, it is a hard requirement. This has nothing to do with the host OS, but is a technical limitation that there is no way around. (To be more specific, you can use a non-Nordic board, but it must contain a nRF5 chip, and you must have a way to program it with the connectivity firmware that it needs. So in practice this is only development boards / development dongles.)

    Ramy said:
    and in case using a NRF52 DK is there an example has to be on the DK, or using nrfutil with <-snr <DK serial number>> would be using the ble directly?

    I did not understand this question. Can you elaborate? 

  • yes reading it again it's confusing

    Is it enough to connect the DK and use the nrfutil + <-snr <DK serial number>>? would the nrfutil will be using the ble on DK board directly?
    or should I build and run an example from SDK?

    thinking about it again, I think it's enough to direct the nrfutil to the connected DK, isn't it?

  • Hi,

    You do not need to build an example from the SDK, but you need to program the correct connectivity firmware for nrfutil. Firmware for the DK can be flashed by nrfutil with the "-f" option. Unlike the nRF Connect BLE app, nrfutil does not do it for you automatically for the dongle. You can refer to this post for more details.

  • thanks a lot for the support!

    one last thing, the linux .whl module of pc_ble_driver_py latest version doesn't meet the nrfutil repo. requirement, where it has to be 0.14.1 or more while the available latest for now is 0.11.2

  • Another question, Is it possible at all to DFU using a generic ble dongle say this ASUS dongle mentioned earlier or another?

    in case not I managed to get the library installed on linux, yet not the pc_ble_driver_py library, still release is earlier than the requirement 

    using the following command line:

    nrfutil dfu ble -ic NRF52 -pkg NAS_lwm_EU868_1_2_3_dfu.zip -p /dev/ttyACM0 -a "F7:E7:B1:D8:72:F3"


    I got the following exception:
    Traceback (most recent call last):
    File "/home/nas0082/.local/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==6.0.1', 'console_scripts', 'nrfutil')()
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
    File "/usr/local/lib/python3.6/dist-packages/nrfutil-6.0.1-py3.6.egg/nordicsemi/__main__.py", line 1099, in ble
    ble_driver_init(conn_ic_id)
    File "/usr/local/lib/python3.6/dist-packages/nrfutil-6.0.1-py3.6.egg/nordicsemi/__main__.py", line 68, in ble_driver_init
    from pc_ble_driver_py.ble_driver import BLEDriver, Flasher
    File "/home/nas0082/.local/lib/python3.6/site-packages/pc_ble_driver_py/ble_driver.py", line 112, in <module>
    driver = importlib.import_module(SWIG_MODULE_NAME)
    File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "/home/nas0082/.local/lib/python3.6/site-packages/pc_ble_driver_py/lib/linux/x86_64/pc_ble_driver_sd_api_v3.py", line 28, in <module>
    _pc_ble_driver_sd_api_v3 = swig_import_helper()
    File "/home/nas0082/.local/lib/python3.6/site-packages/pc_ble_driver_py/lib/linux/x86_64/pc_ble_driver_sd_api_v3.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pc_ble_driver_sd_api_v3', fp, pathname, description)
    File "/usr/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
    File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
    ImportError: dynamic module does not define module export function (PyInit__pc_ble_driver_sd_api_v3)



    for the same linux machine I tried nrfConnect the desktop application I got the following error in the picture

Reply
  • Another question, Is it possible at all to DFU using a generic ble dongle say this ASUS dongle mentioned earlier or another?

    in case not I managed to get the library installed on linux, yet not the pc_ble_driver_py library, still release is earlier than the requirement 

    using the following command line:

    nrfutil dfu ble -ic NRF52 -pkg NAS_lwm_EU868_1_2_3_dfu.zip -p /dev/ttyACM0 -a "F7:E7:B1:D8:72:F3"


    I got the following exception:
    Traceback (most recent call last):
    File "/home/nas0082/.local/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==6.0.1', 'console_scripts', 'nrfutil')()
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/home/nas0082/.local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
    File "/usr/local/lib/python3.6/dist-packages/nrfutil-6.0.1-py3.6.egg/nordicsemi/__main__.py", line 1099, in ble
    ble_driver_init(conn_ic_id)
    File "/usr/local/lib/python3.6/dist-packages/nrfutil-6.0.1-py3.6.egg/nordicsemi/__main__.py", line 68, in ble_driver_init
    from pc_ble_driver_py.ble_driver import BLEDriver, Flasher
    File "/home/nas0082/.local/lib/python3.6/site-packages/pc_ble_driver_py/ble_driver.py", line 112, in <module>
    driver = importlib.import_module(SWIG_MODULE_NAME)
    File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "/home/nas0082/.local/lib/python3.6/site-packages/pc_ble_driver_py/lib/linux/x86_64/pc_ble_driver_sd_api_v3.py", line 28, in <module>
    _pc_ble_driver_sd_api_v3 = swig_import_helper()
    File "/home/nas0082/.local/lib/python3.6/site-packages/pc_ble_driver_py/lib/linux/x86_64/pc_ble_driver_sd_api_v3.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pc_ble_driver_sd_api_v3', fp, pathname, description)
    File "/usr/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
    File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
    ImportError: dynamic module does not define module export function (PyInit__pc_ble_driver_sd_api_v3)



    for the same linux machine I tried nrfConnect the desktop application I got the following error in the picture

Children
  • Hi,

    Ramy said:
    Another question, Is it possible at all to DFU using a generic ble dongle say this ASUS dongle mentioned earlier or another?

    Yes, but then you need to write your own DFU master application. We provide generic DFU master libraries for iOS and Android, but for PC we just provide DFU imålementations that require nRF HW connected to the PC.

    Ramy said:
    I got the following exception:

    Did you install nrfutil with pip this time, and did all dependencies install correctly (particularily pc-ble-driver-py in this case)?

    Ramy said:
    for the same linux machine I tried nrfConnect the desktop application I got the following error in the picture

    The nRF Connect issue may not be related. It also uses the pc-ble-driver (via JavaScrip bindings instead of Python bindings), but everything on top of that is different. The nRF Connect. That should work out of the box, since it is distributed in a self-contained way (using an AppImage that should work on most major Linux distros). Please make a separate thread for that if you need more follow up to keep topics separate.

     

     

  • Did you install nrfutil with pip this time, and did all dependencies install correctly (particularily pc-ble-driver-py in this case)?

    Tried either way, pc_ble_driver_py was installed 0.11.4
    and execution threw same exact exception

  • Hi,

    pc_ble_driver_py version 0.11.4 is the current version when installing with pip for python 2 (pip2). And this will not do with nrfutil 6. Can you please make sure that you use pip for python 3 (for instance by calling "pip3" instead of "pip", if that points to "pip2". If you use pip3 you should get the current version, which is 0.14.1.

  • I'm running pip3, checked <pip3 --version> and <which pip3> even tried downloading the .whl file for cp37 which is my python's version and installed it, it responded "pc_ble_driver_py-0.14.1-cp38-cp38-manylinux2010_x86_64.whl is not a supported wheel on this platform"

  • I see. I lost a bit track here since we have been discussing several platforms. On which platform (exact OS variant and version and exact Python version) do you get the problem with the 0.14.1 whl? And how did you try to install it? From what you write, it looks to me like you are using Python 3.7 in this case, and have obtained a .whl for Python 3.8. I suggest you let pip fetch the package for you so that it will pick a proper one, instead of getting the .whl yourself (and if you do, make sure to pick a correct version).

Related