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

Incompatible Python wrapper for nRF52840 dongle firmware flashed by Bluetooth Low Energy Software (2.3.1)

Hi everyone!

I have a nRF52840 dongle and I am trying to run python examples from pc-ble-driver-py. The dongle is connected to a PC running Ubuntu 18.04. The dongle is flashed by the Bluetooth Low Energy Software (2.3.1) with the following firmware:

Connectivity firmware version: ble-connectivity 4.1.1+May-07-2019-15-12-18. SoftDevice API version: 3. Baud rate: 1000000.

Following the instructions from nordic gitgub, python wrapper is only compiled for API version 2 and version 5, while the firmware is for API version 3. When I try to run c examples from pc-ble-driver it only works with version 3 of the following :

heart_rate_collector_sd_api_v2
heart_rate_collector_sd_api_v3
heart_rate_collector_sd_api_v5
heart_rate_collector_sd_api_v6
heart_rate_monitor_sd_api_v2
heart_rate_monitor_sd_api_v3
heart_rate_monitor_sd_api_v5
heart_rate_monitor_sd_api_v6

Running python (3.7) program heart_rate_collector.py will  result in the failure shown below. My question is how I can run python applications to communicate with nRF52840 dongle (PCA10059)? Do I need any specific firmware flashed on the dongle?

python3.7 heart_rate_collector.py NRF52 /dev/ttyACM1

Serial port used: /dev/ttyACM1
Successfully opened /dev/ttyACM1. Baud rate: 1000000. Flow control: none. Parity: none.
evt> severity(20) message(Successfully opened /dev/ttyACM1. Baud rate: 1000000. Flow control: none. Parity: none.)
RpcAppStatus.resetPerformed: Target Reset performed
evt> status code(RpcAppStatus.resetPerformed) message(Target Reset performed)
RpcAppStatus.connectionActive: Connection active
evt> status code(RpcAppStatus.connectionActive) message(Connection active)
RpcAppStatus.ioResourcesUnavailable: serial port read failed on port /dev/ttyACM1. Error: End of file [2]
evt> status code(RpcAppStatus.ioResourcesUnavailable) message(serial port read failed on port /dev/ttyACM1. Error: End of file [2])
Failed to receive response for command
Traceback (most recent call last):
evt> severity(30) message(Failed to receive response for command)
  File "heart_rate_collector.py", line 216, in <module>
    main(serial_port)
RpcAppStatus.pktSendError: Error sending packet to target. Code: 0x8016
  File "heart_rate_collector.py", line 174, in main
evt> status code(RpcAppStatus.pktSendError) message(Error sending packet to target. Code: 0x8016)
    collector.open()
  File "heart_rate_collector.py", line 101, in open
    self.adapter.driver.ble_cfg_set(BLEConfig.conn_gatt, gatt_cfg)
  File "/home/hamed/devel/mylab/pc-ble-driver-py/_skbuild/linux-x86_64-3.7/setuptools/lib/pc_ble_driver_py/ble_driver.py", line 107, in wrapper
    error_code=err_code,
pc_ble_driver_py.exceptions.NordicSemiException: Failed to ble_cfg_set. Error code: NRF_ERROR_SD_RPC_SEND

Related