PSoC BLE Bonding problems

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

cross mob
Anonymous
Not applicable

Hi. When I run the 100 Projects in 100 days example "#16 Authentication", http://www.cypress.com/blog/100-projects-100-days/project-016-authentication I have problems bonding and reconnecting on my Samsung S5 Neo (I am using this example code to debug my own application). Here are the steps necessary to reproduce the problem on a CY8CKIT-042-BLE kit:

   

1. Set TopDesign.cysch/BLE_1/GAP Settings/Security/Bonding Requirement to "Bonding".

   

2. In main.c, under case CYBLE_EVT_GAP_DEVICE_DISCONNECTED, before "break", add: "CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST);" so that after disconnection it is possible for the Central to reconnect.

   

3. With either "CySmart" or "nRF Master Control Panel" for Android, try to connect+bond, disconnect, reconnect, disconnect. Here is what happens for me (before each of the following IO Capability tests, I make sure that no pairing information is stored on the phone from a previous test):

   

With nRF Master Control Panel:
------------------------------

   

0(Display):
Bond, disconnect, connect, disconnect works perfectly. Passkey needed only once.

   

1(Display Yes/No):
Bond, disconnect, connect, disconnect works perfectly. Passkey needed only once.

   

2(Keyboard):
Bond, disconnect, connect, disconnect works perfectly. Passkey needed only once.

   

3(No Input No Output):
Bond OK. Disconnect OK. Reconnect: Bonding:yes displayed on Cypress, but phone displays "Bonding" and after a while displays "Not Bonded". At this point, Cypress displays "CYBLE_EVT_GAP_AUTH_FAILED: 18". A closer look in Android Bluetooth settings shows that pairing info is not stored on phone, so the bonding has effectively failed.

   

4(Keyboard & Display):
Bond, disconnect, connect, disconnect works perfectly. Passkey needed only once.

   

With CySmart:
-------------

   

0(Display):
Bond, disconnect, connect, disconnect works perfectly. Passkey needed only once. However, "No services found" appears in CySmart on first connection, but not on subsequent connections.

   

1(Display Yes/No):
Bond, disconnect, connect, disconnect works perfectly. Passkey needed only once. However, "No services found" appears in CySmart on first connection, but not on subsequent connections.

   

2(Keyboard):
"Bonding is in process. Please wait." appears on Android device. Must kill CySmart. Pairing data is stored on phone, however. A subsequent connection sometimes succeeds, but sometimes fails to discover services.

   

3(No Input No Output):
Bond OK. Disconnect OK. Reconnect: Bonding:yes displayed on Cypress, but phone displays "bonding is in process" and after a while displays "Unable to pair. Check whether the device is advertising and supports pairing". At this point, Cypress displays "CYBLE_EVT_GAP_AUTH_FAILED: 18". A closer look in Android Bluetooth settings shows that pairing info is not stored on phone, so the bonding has effectively failed.

   

4(Keyboard & Display):
Bonding is in process. Please wait. Must kill CySmart. Pairing data is stored on phone, however. A subsequent connection sometimes succeeds, but sometimes fails to discover services.

   

With nRF Master Control Panel, authentication works almost perfectly, except for the No Input / No Output case. This leads me to believe that CySmart for Android lacks robustness for several cases, but it also seems that the PSoC BLE stack has trouble with No Input/No Output (which is unfortunately the case which I need for my application). Does anybody have PSoC example code that is reliable for No Input/No Output pairing and reconnection?

   

Thanks...

0 Likes
1 Solution
Anonymous
Not applicable

Hi ,

   

First of all after changing the setting to bonding in BLE component, are you storing the bonding information? This should be done explicitly in the code. It doesn't do on its own.

   

 

   

Also which version of PSOC creator and Cysmart are you using?

   

 

   

Regards,
Vikas.

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

Hi ,

   

First of all after changing the setting to bonding in BLE component, are you storing the bonding information? This should be done explicitly in the code. It doesn't do on its own.

   

 

   

Also which version of PSOC creator and Cysmart are you using?

   

 

   

Regards,
Vikas.

0 Likes
Anonymous
Not applicable

Hi Vikas. Sorry for the late reply.

   

According to the BLE_v1_20 component datasheet, "The BLE stack will update the bonding data in RAM while the devices are connected. If the bonding data is to be retained during shutdown, the application can use CyBle_StoreBondingData() API to write the bonding data from RAM to the dedicated Flash location, as defined by the Component.".

   

From this, it seems to me that storage of the bonding data should only be necessary if I wish to retain the bonding data after PSoC device shutdown, but my problems occur even without device shutdown. Still, I added the necessary lines to store the bonding data, and the desired effect occurs for input methods other than input method 3 (No Input/No Output). For input method 0, for example, bonding data is stored and I can disconnect and reset the PSoC device and still reconnect without entering a passkey. But with input method 3, I observe the same incorrect behavior as in my initial post (unless the bonding data has previously been stored on the PSoC device using input method 0, for example).

   

So it appears that flash storage of the bonding data does not solve the problem with input method 3.

   

I am using PSoC creator 3.2.0.724, Android CySmart 1.1.1.68, and nRF Master Control Panel 3.4.1.

   

Thanks for your help,

   

David

0 Likes
Anonymous
Not applicable

I just upgraded to PSoC Creator 3.3, and I updated my BLE component to 2.30, but the problem persists.

   

David

0 Likes
Anonymous
Not applicable

Hi,

   

Problem solved. Under BLE_1 -> Gap Settings -> Security -> Security Level, I had "Authenticated pairing with encryption". Since authentication is not possible in No Input/No Output mode, this fails. If this is changed to Unauthenticated pairing with encryption", everything works in this mode.

   

Cheers,

   

David

0 Likes