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

nrfutil for nrf52840

Hello,

We are trying to use nrfutil to perform DFU on our linux system which includes two host targets 1 an Intel machine and the other ARM machine

On the Intel machine DFU worked with version 6.1.0, but "pip install nrfutil" installs 5.2.0 version.  Is there a way to force pip to install version 6.1.0

On the ARM machine pip attempts to install 6.1.0 however it fails with the following error:


root@apalis-imx8:/dev# python3 -m pip install nrfutil
Collecting nrfutil
Using cached nrfutil-6.1.0.tar.gz (842 kB)
Requirement already satisfied: click in /usr/lib/python3.8/site-packages (from nrfutil) (7.1.2)
Requirement already satisfied: crcmod in /usr/lib/python3.8/site-packages (from nrfutil) (1.7)
Requirement already satisfied: ecdsa in /usr/lib/python3.8/site-packages (from nrfutil) (0.13.3)
Requirement already satisfied: intelhex in /usr/lib/python3.8/site-packages (from nrfutil) (2.3.0)
Requirement already satisfied: libusb1 in /usr/lib/python3.8/site-packages (from nrfutil) (1.9.2)
ERROR: Could not find a version that satisfies the requirement pc_ble_driver_py>=0.14.2 (from nrfutil) (from versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 0.11.4)
ERROR: No matching distribution found for pc_ble_driver_py>=0.14.2 (from nrfutil)

My question is what is the version of the nrfutil that is recommended along with what version of python for ARM and INTEL machines for the "nrf52840" device?

Thank you.

Omid Athari

Nikola Motor Inc

  • Hi,

    ARM architecture is not supported by nrfutil or pc-ble-driver-py in the releases from Nordic. I assume that your ARM machine fetches the wheels from piwheels (or something similar), and not from PyPi directly. As you can see from the link, there is no build of pc-ble-driver-py available from piwheels newer than v0.11.4.

    Note that pc-ble-driver-py depends on linkable libraries from pc-ble-driver, which are not built for ARM architecture. You may need to rebuild the libraries from source for your architecture to get it working. 

    What are you planning to use nrfutil for? Some of the functionality does not depend directly on pc-ble-driver(-py), and you may be able to run it directly without installing through pip as described in step 3 on this page.

    Best regards,
    Jørgen

  • Thanks for your response.

    Our plan is to use nrfutil for updating the nrf52840 in the system.  The nrfutil will generate the update package would on the Intel machine which would be sent down to the ARM target and at that point nrfutil will apply the package.  That is the plan. 

    I will go thru the material you pointed me to but before that I have a question.

    I was able to install version 5.2.0 on both the arm machine and the Intel machine.  Question is does version 5.2.0 generate and dfu packages for the nrf52840.  I get the following error when attempting to generate a package with 5.2.0. Would you mind taking a look?

    ~/gitlabRepo/ble_service/arm/bin (oa/ota ✘)✹ ᐅ nrfutil version
    nrfutil version 5.2.0
    ~/gitlabRepo/ble_service/arm/bin (oa/ota ✘)✹ ᐅ nrfutil pkg generate --debug-mode --hw-version 52 --application ./nikola-ble.hex application.zip

    |===============================================================|
    |## ## ### ######## ## ## #### ## ## ###### |
    |## ## ## ## ## ## ## ### ## ## ### ## ## ## |
    |## ## ## ## ## ## ## #### ## ## #### ## ## |
    |## ## ## ## ## ######## ## ## ## ## ## ## ## ## ####|
    |## ## ## ######### ## ## ## #### ## ## #### ## ## |
    |## ## ## ## ## ## ## ## ### ## ## ### ## ## |
    | ### ### ## ## ## ## ## ## #### ## ## ###### |
    |===============================================================|
    |You are generating a package with the debug bit enabled in the |
    |init packet. This is only compatible with a debug bootloader |
    |and is not suitable for production. |
    |===============================================================|


    |===============================================================|
    |## ## ### ######## ## ## #### ## ## ###### |
    |## ## ## ## ## ## ## ### ## ## ### ## ## ## |
    |## ## ## ## ## ## ## #### ## ## #### ## ## |
    |## ## ## ## ## ######## ## ## ## ## ## ## ## ## ####|
    |## ## ## ######### ## ## ## #### ## ## #### ## ## |
    |## ## ## ## ## ## ## ## ### ## ## ### ## ## |
    | ### ### ## ## ## ## ## ## #### ## ## ###### |
    |===============================================================|
    |You are not providing a signature key, which means the DFU |
    |files will not be signed, and are vulnerable to tampering. |
    |This is only compatible with a signature-less bootloader and is|
    |not suitable for production environments. |
    |===============================================================|

    Traceback (most recent call last):
    File "/home/nikola/.local/bin/nrfutil", line 33, in <module>
    sys.exit(load_entry_point('nrfutil==5.2.0', 'console_scripts', 'nrfutil')())
    File "/home/nikola/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
    File "/home/nikola/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
    File "/home/nikola/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/nikola/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/home/nikola/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/home/nikola/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
    File "/home/nikola/.local/lib/python3.8/site-packages/nordicsemi/__main__.py", line 867, in generate
    package.generate_package(zipfile_path)
    File "/home/nikola/.local/lib/python3.8/site-packages/nordicsemi/dfu/package.py", line 403, in generate_package
    for key, firmware_data in self.firmwares_data.iteritems():
    AttributeError: 'dict' object has no attribute 'iteritems'
    ~/gitlabRepo/ble_service/arm/bin (oa/ota ✘)✹ ᐅ

  • BTW we are running linux on both the Intel host and the ARM target machine.

  • nrfutil v5.2.0 should be able to generate and perform DFU on nRF52840, the documentation say all version above 2.2.0 will support nRF52840. To support SDK versions later than nRF5 SDK v15.3.0, you need nrfutil v5.0.0 or above.

    Note that Python 3 support was not added to nrfutil until v6.0.0, the error you are seeing it because you run the old version (which only supports Python 2.7.x) on a Python 3.8.x release.

  • I see. So therefore we need to install python2.7 first and then install pip2 and then install nrfutil using pip2. Correct?

    Is there another standalone program to perform the DFU on the arm board.  I was told that there is a c++ program that is capable of uploading the firmware to the device.  Is that correct?

Related