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

The nRF Connect SDK for desktop (python) is very slow to discover characteristics at time and very flaky in whether it hangs up midway or not. CAn anyone help me out with my softdevice logic?

Hi,

As I mentioned in the title, I am using the `pc-ble-driver-py` python package which is basically bindings to the SoftDevice running on the nRF52840 dongle.

Here is my complete code:

https://gist.github.com/Yatekii/9dcedf0224a05ab846b2786c2c275aaf

The issue is here on line 27:

https://gist.github.com/Yatekii/9dcedf0224a05ab846b2786c2c275aaf#file-run-py-L27

This .connect() method takes > 3 seconds to discover all services. The connecttion is established within milliseconds, but the discovery goes on way too long. This to 3 seconds too long! When I use the nRF Connect Desktop app written in Node.js it is < 1s and the same if I use bluez.

Since this is for our production testing, I need this to be way below 1 second! Imagine doing this for 100k devices. That's a lot of time =)

What's more is that it sometimes never connects at all without further output. Then the process just hangs and I have to kill it. When that happens it looks like this:

2.1457672119140625e-06: Start
Received advertisment report, address: C0:58:FA:AA:28:8C, device_name: zigfred
0.11480927467346191: Found zigfred
0.0011899471282958984: Stopped scan
Heading to discovery
New connection: 0
{'status': <BLEGattStatusCode.success: 0>, 'services': [<pc_ble_driver_py.ble_driver.BLEService object at 0x7f15aceadd60>]}
{'status': <BLEGattStatusCode.attribute_not_found: 266>, 'services': []}
0.35233449935913086: Connected

It hangs at line 221 forever I believe.

So I feel like somehow the API lock deadlocks. I had this quite a few times. It's not very robust in that regard :(

Can anyone help me out here please?

Thanks

Noah

Related