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

Issues with CLI over BLE Example

Hi!

I am trying to test the CLI over BLE example. I want to use it in another application for logging data to a laptop console over BLE. 

However, I am having trouble following the steps in the example documentation. I can compile and run the application just fine, but I'm having trouble starting the ble_serial.py script. Here's the command I'm running:

python ble_serial.py --snr 680834186 --name Nordic_CLI --com COM115 --family NRF52

And here's the output:

Traceback (most recent call last):

  File "ble_serial.py", line 64, in <module>

    ble_driver_init(args.family[0])

  File "ble_serial.py", line 61, in ble_driver_init

    from pc_ble_driver_py import config

ImportError: No module named pc_ble_driver_py

I tried "pip3 uninstall nrfutil" and then "pip3 install nrfutil", as well as "pip3 uninstall pc_ble_driver_py" and then "pip3 install pc_ble_driver_py".

However, this does not fix the issue. Can anyone provide some guidance on what I should try? And how do I connect to the board via its destination address (step 4) on a Mac?

Parents
  • Hi Jared,

    I'm running Python 3.9.0. When I run the command using python3, I get a new error:

    python3 ble_serial.py --snr 680834186 --name Nordic_CLI --com COM115 --family NRF52

    Traceback (most recent call last):

      File "/Users/kylemassa/Downloads/nRF5_SDK_16/examples/ble_peripheral/experimental/ble_app_cli/ble_serial.py", line 38, in <module>

        import Queue

  • Hi,

    I'm running

    python ble_serial.py --snr 682672012 --name Nordic_CLI --com COM0006826720121 --family NRF52

    which produces the output

    "Board already flashed with connectivity firmware.

    Socket created

    Socket bind complete

    Socket now listening"

    So I've completed step 3 and am working on step 4. When I type 

    127.0.0.1:8889

    in a different terminal window without any command, it returns "Command not found". The output produced in my above reply is triggered when I've completed step 3 and I use ssh for step 4.

    Thanks!

  • Hi,

    I still don't think that SSH would be the correct protocol. I'm not sure as we haven't tested the application on Mac OS AFAIK. Doing a quick google search revealed that the telnet protocol would be the appropriate one to get a raw TCP/IP connection. Could you try this one instead?

    Also, if you do have a windows computer with PuTTY available, then I strongly suggest that you use that one for testing the example.

    regards

    Jared 

  • Thanks Jared! So to be clear, I am still trying to get past step 4 of the example instructions.

    In one terminal window, I ran ble_serial.py and got the following output (command included): 

    python ble_serial.py --snr 682672012 --name Nordic_CLI --com COM0006826720121 --family NRF52

    Board already flashed with connectivity firmware.

    Socket created

    Socket bind complete

    Socket now listening

    Connected with 127.0.0.1:57604

    Traceback (most recent call last):

      File "ble_serial.py", line 242, in <module>

        b = BLE_Serial(comport, args.name, conn)

      File "ble_serial.py", line 96, in __init__

        self.adapter.driver.open()

      File "/Users/kylemassa/Library/Python/2.7/lib/python/site-packages/pc_ble_driver_py/ble_driver.py", line 127, in wrapper

        raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code))

    pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: 3

    In another terminal window, I ran telnet as you suggested. Here is the output from that window (command included): 

    telnet 127.0.0.1 8889

    Trying 127.0.0.1...

    Connected to localhost.

    Escape character is '^]'.

    Connection closed by foreign host.

    It looks like the connection is being dropped immediately after it's established. What could be causing this behavior?

  •  Ok, I tried it in PuTTY too. When I click open, it causes ble_serial.py to crash with the error:

    Connected with 127.0.0.1:64025

    Traceback (most recent call last):

      File "ble_serial.py", line 242, in <module>

        b = BLE_Serial(comport, args.name, conn)

      File "ble_serial.py", line 96, in __init__

        self.adapter.driver.open()

      File "/Users/kylemassa/Library/Python/2.7/lib/python/site-packages/pc_ble_driver_py/ble_driver.py", line 127, in wrapper

        raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code))

    pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: 3

  • Hi,

    Is the other board still advertising when you try to connect via PuTTY? Note that it will go to sleep after about 3 minutes of advertising. The flow of execution should be as follows:

    1. Program board 1 with ble_app_cli application and the softdevice. Make sure that the led is blinking indicating that it's advertising.
    2. Program board 2 with the python script.
    3. Use PuTTY to instruct board 2 to connect with board 1 by connecting to 127.0.0.1 with port 8889
    4. The led on Board 1 should then indicate that they are connected and a terminal should be created in the PuTTY.

    regards

    Jared 

Reply
  • Hi,

    Is the other board still advertising when you try to connect via PuTTY? Note that it will go to sleep after about 3 minutes of advertising. The flow of execution should be as follows:

    1. Program board 1 with ble_app_cli application and the softdevice. Make sure that the led is blinking indicating that it's advertising.
    2. Program board 2 with the python script.
    3. Use PuTTY to instruct board 2 to connect with board 1 by connecting to 127.0.0.1 with port 8889
    4. The led on Board 1 should then indicate that they are connected and a terminal should be created in the PuTTY.

    regards

    Jared 

Children
Related