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?

  •  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 

  • Ok, thanks Jared! I've actually been running the Python script on my laptop via the terminal, so maybe that's been the source of my problems. I did some quick searching and found Zerynth and MicroPython as options for programming the additional board with ble_serial.py. Do you happen to have any recommendations between the two of them (or others)? I couldn't find anything super recent on Zerynth on DevZone. 

    Thanks!

  • Sorry for the confusion, but to be clear:

    The python scrip should be run on the computer. But the python scrip itself will flash the second board with the fw by using pc-ble-driver.

Related