A Few Android Devices Can't Connect to PSoC 4; NO onConnectionStateChange Called? Seems to be a problem with LL_VERSION_IND and / or LL_FEATURE_REQ packets.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JaPe_1309876
Level 1
Level 1
First like received First like given

Hello,

I have a production App with production hardware based on the PSoC 4 BLE Component Stack v 3.61.  This works fine on iOS and MOST Android Devices.

I have been getting reports from some Android users that it doesn't work for them.  I purchased a device that has issues it is Android Version 6.0.1.

I can confirm that I can't connect to any PSoC 4 BLE devices, with my firmware or examples from the stack.  I am using CySmart to test, CySmart doesn't connect either, it can connect to other BLE devices but not PSoC 4 devices.

I get a "connected" event in PSoC however I never get a onConnectionStateChange event in Android 6.0.1, it just hangs, there doesn't seem to be any error in Logcat.

I am running BLE commands in the Main / UI Thread with a Handler / Looper.

I know 6.0.1 is slightly old however other BLE devices work.  Is there anything I can do?

Thanks,

--Jason

4 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Not sure if you have done this already, but Android 6 requires location permission for BLE scanning. So, check if it has been enabled.

Can you tell me which phone you are using?

Regards,

Dheeraj

0 Likes

Hi Dheeraj,  Thank you for the help!

It is actually an Android "Head Unit" for vehicles, that's why the version is so old...  It also happens on some older tablets, I have a tablet that should be here shortly to test that has the same issue.

It is not a permission problem, location permissions are enabled.  It seems to be related to Android 6.0.1 sending LL packets in the wrong order or not waiting for a response... see the screen captures below of a WireShark sniff session, can someone validate this?

When I connect with an iPhone I get "LL_VERSION_IND" from "Master -> Slave" and then from "Slave -> Master", followed by "LL_FEATURE_REQ / RSP", then the MTU exchange and the connection proceeds as expected.

However when I connect with Android 6.0.1 I get "LL_FEATURE_REQ / RSP" first then it is then followed by multiple "LL_FEATURE_REQ" from "Master -> Slave" WITHOUT a response from the "Slave / PSoC4".   At this point the connection doesn't finish and just hangs...  I get no more events, it seems to be a lock up in the PSoC stack.

--Jason

BAD CONNECTION CAPTURE:

Bad Connection.png

GOOD CONNECTION CAPTURE:

Good Connection.png

0 Likes

Based on the screenshots, looks like Android 6.0 Master is violating the spec. Before slave could send version-ind pdu, master is sending multiple version-ind pdu. According to spec device (both master or slave) can send version-ind pdu once during a connection.

"The link layer shall only queue for transmission a maximum of one LL_VERSION_IND PDU during a connection"

We will try to reproduce it on our end. Can you tell us which phone you are using?

Regards,

Dheeraj

We are having a similar issue, the device connects and immediately disconnects, Apple works fine, but all our Android devices are now failing to connect, after pairing.

Also, I have seen the BLE stack in a stopped state, and we do not have CyBle_Stop(); in our code at all.  It takes a power reset to get it to come back.

We have a pretty basic implementation and the trouble started happening with the android recently.

Android will pair and work, stores bonding data, then we trying to reconnect it connects and then shows disconnect, and no reason given, and stops advertising.

This is on a Nokia Android 9, and a Samsung running Android 5.1.1

We are really stuck here, could there be a flaw in the BLE component?  BLE 3.61

0 Likes