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

Bluetooth NUS shell transport: Error on execution of 'bt_nus_shell.py' test script

Hi,

I followed the instructions to test Bluetooth NUS shell transport sample from nRF Connect SDK v1.5.0-rc1.

After installation of the dependent script packages using 'pip' (in nRF Connect SDK v1.5.0-rc1 BASH), the execution of
test script 'bt_nus_shell.py' throws following error:

-----------------------------------------------------------------
Sanjiv Navghare@DESKTOP-3BD5AV1 MINGW64 /c/Sanju/swpath/ncs/v1.5.0-rc1/nrf/scripts/shell ((v1.5.0-rc1))
$ python bt_nus_shell.py --name BT_NUS_shell --com COM5 --family NRF52833 --snr 685782019
Traceback (most recent call last):
File "bt_nus_shell.py", line 17, in <module>
from nordicsemi.dfu.dfu_transport_ble import DFUAdapter
File "C:\Users\Sanju\AppData\Roaming\Python\Python38\site-packages\nordicsemi\dfu\dfu_transport_ble.py", line 43, in <module>
import Queue
ModuleNotFoundError: No module named 'Queue'
-----------------------------------------------------------------

So clearly the 'dfu_transport_ble.py' doesn't seem to be compatible with Python v3.


FYI, the nRF Connect SDK v1.5.0-rc1 BASH uses 'Python v3.8.2' and 'pip3 v21.0.1' and following are the versions of the installed dependent packages/scripts:
- pc-ble-driver-py-0.15.0
- nrfutil-5.0.0

Before going for test, the aforementioned script dependencies were installed with nRF Connect (v1.5.0-rc1) BASH as follows:
$ pip install --user -r scripts/shell/requirements.txt

The 'requirements.txt' did have restriction for 'nrfutil' version (i.e. nrfutil>=6.0.0) but as its installation resulted in the following error, and as described in "fixing-conflicting-dependencies" (pip.pypa.io), had to remove the version specifier for 'nrfutil', in 'requirements.txt' file, to let pip automatically find and install a version of 'nrfutil': 

--------------------------------------------------------------------------------------------------------------
ERROR: Cannot install -r scripts/shell/requirements.txt (line 2) because these package versions have conflicting dependencies.

The conflict is caused by:
nrfutil 6.1.0 depends on antlib>=1.1b0
nrfutil 6.0.1 depends on antlib>=1.1b0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit pip.pypa.io/.../
--------------------------------------------------------------------------------------------------------------

Please advice how to go about testing Bluetooth NUS Shell Transport with nRF Connect (v1.5.0-rc1) BASH (on Windows 10 system.)

Regards,

Sanju

Parents
  • The issue had been resolved!
    Here's the sequence of steps that finally ended up in resolution of the issue:


    Though the antlib installation failed even with the usage of --no-chache-dir, it succeeded when installed with reference to the URL of the antlib project's wheel:

    $ pip install --user https://files.pythonhosted.org/packages/b1/99/641f7f134b136fe33933012decf6694500f92adc118bb4bf83be04b36b48/antlib-1.1b0.post0-py2.py3-none-any.whl

    This enabled further installation of nrfutil v6.1.0 and pc-ble-driver-py v0.15.0.
    I tested BT NUS Shell with nRF52833-DK as a perperipheral device but the script then threw following error (seems the script doesn't support nRF52833):

    $ python bt_nus_shell.py --name BT_NUS_shell --com COM5 --family NRF52833 --snr 000685782019
    Traceback (most recent call last):
      File "C:\Users\Sanjiv\AppData\Roaming\Python\Python38\site-packages\pc_ble_driver_py\ble_driver.py", line 2907, in call_cmd
        return subprocess.check_output(argstr, stderr=subprocess.STDOUT, shell=True)
      File "subprocess.py", line 411, in check_output
      File "subprocess.py", line 512, in run
    subprocess.CalledProcessError: Command 'nrfjprog --snr 685782019 --memrd 327680 --w 8 --n 24 --family nrf52' returned non-zero exit status 40.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "bt_nus_shell.py", line 222, in <module>
        flash_connectivity(args.com[0], args.snr[0])
      File "bt_nus_shell.py", line 173, in flash_connectivity
        if flasher.fw_check():
      File "C:\Users\Sanjiv\AppData\Roaming\Python\Python38\site-packages\pc_ble_driver_py\ble_driver.py", line 2860, in fw_check
        fw_struct = Flasher.parse_fw_struct(self.read_fw_struct())
      File "C:\Users\Sanjiv\AppData\Roaming\Python\Python38\site-packages\pc_ble_driver_py\ble_driver.py", line 2883, in read_fw_struct
        data = self.call_cmd(args)
      File "C:\SANJIV\swpath\ncs\v1.5.0-rc1\toolchain\opt\bin\Lib\site-packages\wrapt\wrappers.py", line 605, in __call__
        return self._self_wrapper(self.__wrapped__, self._self_instance,
      File "C:\SANJIV\swpath\ncs\v1.5.0-rc1\toolchain\opt\bin\Lib\site-packages\wrapt\decorators.py", line 445, in _synchronized
        return wrapped(*args, **kwargs)
      File "C:\Users\Sanjiv\AppData\Roaming\Python\Python38\site-packages\pc_ble_driver_py\ble_driver.py", line 2912, in call_cmd
        raise RuntimeError(f"{e.__str__()}\n{e.output}")
    RuntimeError: Command 'nrfjprog --snr 685782019 --memrd 327680 --w 8 --n 24 --family nrf52' returned non-zero exit status 40.
    b'ERROR: There is no debugger connected to the PC with the given serial number.\r\n'

    As the script execution failed, I tried to manually program the nRF52833-DK using nrfjprog as follows:
    $ nrfjprog --snr 685782019 --program connectivity_4.1.2_1m_with_s132_5.1.0.hex --family nrf52

    After manual flashing of the device, I retried testing BT NUS Shell with nRF52833-DK peripheral as follows:

    $ python bt_nus_shell.py --name BT_NUS_shell --com COM5 --family NRF52833 --snr 000685782019
    Board already flashed with connectivity firmware.
    Socket created
    Socket bind complete
    Socket now listening
    

    I could then successfully test BT NUS Shell

  • Hi Sanjiv, 
    I'm glad that it worked for you now. And thanks for sharing the solution. 

Reply Children
No Data
Related