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

Why do i get BLE_ERROR_UNSPECIFIED when connecting to a device while service discovery is running for another device?

Hi,

I am trying to connect to a device while service discovery for another device is running, this is needed to go through connecting multiple devices as fast as possible.

my structure:

multiple peripherals advertising simultaniously.

Central is scanning until it finds a device it wants to connect to, then stops scanning and connects.

at the end of the connection event, scanning is re-enabled and the service discovery starts.

when another device of interest appears, i want to connect to it, even if the service discovery of the first device is still running.

My Problem now is, that when i do ble.connect(...) i get an "BLE_ERROR_UNSPECIFIED" response and the device doesnt get connected.

why does this happen and how can i prevent this? my goal is to connect to devices as fast as possible.

my log:

RTT LOADED|  Hello, this is wt-ftbc-1809001  |
ftbcCmd=ftReady[SerialEvent] name: ftbcCmd | value: ftReady
FT100 signals readiness
 start scanning
BLE_SUCCESS
BLE_SUCCESS
new device ad received
string format: hex
wt-bbox-181028's mac address: 93E21FE9B8E0
device: wt-bbox-181028
looking for: wt-bbox-
 stop scanning
BLE_SUCCESS
macAuth[93E21FE9B8E0]=ok[SerialEvent] name: macAuth[93E21FE9B8E0] | value: ok
store MAC address
vector stored
look for best rssi
push mac to desiredPeerAddr
93 - E2 - 1F - E9 - B8 - E0 - trying to connect to 93E21FE9B8E0BLE_SUCCESS  <------------------ this is the first device I want to connect to
maxValue: -56 from device: 0
BLE_SUCCESS
thisBLE_SUCCESS
connection Callback
connection handle: 0
string format: hex
Ft100_BLE's role in this connection: Central
SUCCESS: wt-bbox-181028 connected with mac Address: 93E21FE9B8E0          <------------------ I am connected to the first device
 start scanning                                                         <------------------ scanning gets re-enabled
BLE_SUCCESS
TIMESTAMP BEGIN
Generic Access Service found:
Service UUID: [1800] attrs[1 9]
TIMESTAMP END
new device ad received
string format: hex
wt-bbox-181028's mac address: 591074700DE1                            <------------------ scanner found my second device
device: wt-bbox-181028
looking for: wt-bbox-
 stop scanning
BLE_SUCCESS
TIMESTAMP BEGIN
Generic Attribute Service found:
Service UUID: [1801] attrs[10 13]
TIMESTAMP END
TIMESTAMP BEGIN
Device Information Service found:
Service UUID: [180A] attrs[14 26]
TIMESTAMP END
macAuth[591074700DE1]=ok[SerialEvent] name: macAuth[591074700DE1] | value: ok          <------------------ I allow this mac to connect
store MAC address
vector stored
look for best rssi
push mac to desiredPeerAddr
59 - 10 - 74 - 70 - 0D - E1 - trying to connect to 591074700DE1BLE_ERROR_UNSPECIFIED <------------------ THIS IS THE FAILING PART!
maxValue: -48 from device: 0
BLE_SUCCESS
thisBLE_SUCCESS
DIS SN Char
CHAR UUID: [2A25]
DIS HW Char
CHAR UUID: [2A27]
DIS FW Char
CHAR UUID: [2A26]
DIS SW Char
CHAR UUID: [2A28]
TIMESTAMP BEGIN
PLOWDATA Service found:
Service UUID: [A001] attrs[27 30]
TIMESTAMP END
PLOWDATA Char
CHAR UUID: [A002]
TIMESTAMP BEGIN
Service UUID: [C001] attrs[31 65535]
TIMESTAMP END
MAINTENANCE Char
CHAR UUID: [C002]
terminated Service Discovery for handle 0
hrm Char found with notifications enabled
start looking for Descriptors now
descriptor found with:
connection_handle[0] UUID[2902] attribute_Handle[30] gattClient [536890060]
descriptorDiscovery terminated without errors
sending notification request now..
cccd state [1] sent successfully!
_________________________________________
rbl updates received: connHandle: 0, attrHandle: 29, Type: 1, length: 4plow updates received
identifier: [101]
_________________________________________
-------------
disconnected from connection nr. 0
disconnect reason: DISCONNECT_REASON_UNDEFINED
-------------

Ps. i noticed, that if a peripheral looses power as soon as it wanted to connect, the central wont do anything(I assumed the SupervisionTimeout would kick in) and if i want to restart scanning i get an "PARAM_OUT_OF_RANGE" Error.

thanks in advance,

Jonas

Parents Reply Children
Related