Unable to install nRF Util for nRF5 SDK for Secure BLE DFU update on MacOS

I am using nRF52840 DK and SDK17.1.0.

Have python3.11 installed on my macbook air(MacOS Monterey 12.0.1).

Also had nrf5.2.0 installed in dec last year.

Now I want to generate key for Secure DFU update via BLE. So as per the nrf document,  nRF Util 7.0.0 version is needed for DFU functionality.

I tried uninstalling 5.2.0 version and installing by --upgrade or install commands with --no-cache-dir command. It keeps installing version 5.2.0.

And then while generating private key it gives  these syntax errors

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nordicsemi/__main__.py", line 434, in generate

    signer.gen_key(key_file)

  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nordicsemi/dfu/signing.py", line 79, in gen_key

    sk_file.write(self.sk.to_pem())

TypeError: write() argument must be str, not bytes

I was able to remove these errors by changing the code.but then it gave more such errors. 

I even downloaded nrfutil from https://www.nordicsemi.com/Products/Development-tools/nRF-Util site. I added this file to /usr/local/bin but it didn't solve the issue. Please suggest how to install nRFutil 7.0.0 version so that I can go ahead with generating private and public keys for DFU.

Should I uninstall Python 3.11 and re-install that again? Will that take care of adding latest nrfutil? So am I not adding the file to the correct path? Or is there some other command to install version 7.0.0?

Thanks

Parents
  • Hi SG1, 

    Could you show me the full log when you receive this error : 

    File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/nordicsemi/__main__.py", line 434, in generate

        signer.gen_key(key_file)

    I assume you have installed nrf5sdk-tools ? How exactly did you install nRFutil v7.0 ? 

    If you are using nRFutil for nRF5 SDK , you can still use version 5.2.0 (or latest legacy version which is 6.1) instead of version 7.0 

  • Hi,

    Thanks for the reply.

    I downloaded nrfutil from https://www.nordicsemi.com/Products/Development-tools/nRF-Util

    to Windows PC. After that when I checked the nrfutil version it showed me 7.5.0.

    So was able to continue my work on generating keys and DFU package for firmware update. I am working with SDK17.1.0.

    On Mac OS, I downloaded nrfutil and added file to usr/local/bin folder and unlocked it by chmod +x nrfutil command. Then I ran the nrfutil command to get  the version, it showed version 5.2.0.  So I downloaded the prerequisites- Segger-Jlink.

    Downloaded nrf-udev_1.0.1-all.deb as suggsted, I am getting the following error while installing it.

    sudo dpkg -i nrf-udev_1.0.1-all.deb
    dpkg: warning: '/opt/local/bin/gnutar' not found in PATH or not executable
    dpkg: error: 1 expected program not found in PATH or not executable
    Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

    I added the path and unlocked the gnutar file. But still I get the same error.I am stuck here.

    I have dowloaded macports also.

    If I continue with the the installed nrfutil (ie 5.2.0) to generate keys for DFU package, I get the above mentioned errors which I have listed in my 1st message.

    Do I have to add nrfutil to some specific location on MAC and run from there?

    Or is there a way to uninstall and install again...

    Should I add it to Python3.11 bin folder also?

    Thanks

  • Hi,

    We recommend using nRF Util v7.x. It is now a standalone executable that does not require Python to be installed. The problem in your case seems to be that your mac continues to invoke a previously installed version of nrfutil.

    Please run the following command from the terminal to see if there may be more than one nrfutil executable in your PATH:

    $ which nrfutil

    If there is, you should try to delete it with the pip command. Note that if you have more than one version of python installed on your system, you need to ensure you are using the correct python instance to uninstall it. 

    $ python -m pip uninstall nrfutil

    Also, after making the nrfutil v.7.x executable with 'chmod +x', make sure that you can open it from Finder before you move it to /usr/local/bin. If you get a warning stating that the app is unverified/unidentified, you can follow the steps here to allow you to run it anyway: https://support.apple.com/guide/mac-help/open-a-mac-app-from-an-unidentified-developer-mh40616/mac 

    Best regards,

    Vidar

  • Thankyou very much Vidar,

    I was able to uninstall nrfutil with the above command and download it again and reinstall. I made sure that I open it in finder first before moving to usr/local/bin.

    There was another copy of nrfutil lying in opt/local/sbin...which it was trying to open when I ran nrfutil help and list commands. It wasn't opening. After I browsed and deleted that file, the nrfutil from usr/local/bin ran fine. So i guess I had multiple copies of previous version of nrfutil installed in various system paths.That also got sorted. Thanks.

    After that, I was able to install nrfsdk tools and generate keys, settings file, merging hex files, and create firmware package for DFU.

    Thanks

Reply
  • Thankyou very much Vidar,

    I was able to uninstall nrfutil with the above command and download it again and reinstall. I made sure that I open it in finder first before moving to usr/local/bin.

    There was another copy of nrfutil lying in opt/local/sbin...which it was trying to open when I ran nrfutil help and list commands. It wasn't opening. After I browsed and deleted that file, the nrfutil from usr/local/bin ran fine. So i guess I had multiple copies of previous version of nrfutil installed in various system paths.That also got sorted. Thanks.

    After that, I was able to install nrfsdk tools and generate keys, settings file, merging hex files, and create firmware package for DFU.

    Thanks

Children
Related