Establishing BLE Connection - Unexpected Disconnects


#1

With Duo as a BLE Central I can make connections, but it often takes several attempts for the connection to be successful. Here is what happens:

  1. BLE Connection initiated: ble.connect()
  2. Connection Success on callback: onConnectedCallback()
  3. Within ~200ms the Disconnect callback fires: onDisconnectedCallback()

The odd thing is that I get a connection handle in the connection callback, but my peripheral never sees any connection whatsoever. Any ideas what might be happening here? I have tried several other BLE central devices and none of them have any connection issues to my peripheral device. The signal is strong and the devices are in close proximity.

The other point is that once the Duo does eventually establish a connection it is solid and never drops. The connectivity issue is just when trying to establish the initial connection.

Last note is that I am scanning before, during and after the connection attempt. Should I disable scanning when trying to connect?


#2

Why not have it a try? :wink:


#3

Sorry, should have been clearer. I did, but I got inconsistent results so I thought perhaps there was some experience. The sample apps appear to stop scanning on connect. I’ll just stick with that for now and see if I can’t narrow the cause.

I wonder if a particular scan interval / advertising interval might contribute to this too. The peripheral has a rather slow adv rate. Once every few seconds.


#4

Please try increasing the advertising interval. I think this might be the problem.


#5

I am thinking the same, but I don’t have control over peripheral source. I played around with the timing of the connection as it relates to scanning and some other tasks which really improved things. Not perfect but much better.

On to other issues… Now I am busy trying to find out why setting CCC descriptors used to work and now they don’t. I can set them to none but notify and indicate do not trigger a CCCD call back. More on this later I’m sure.