cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

GiMa_1521296
New Contributor

I want connect my BLE peripheral device with an Android app using pairing/bonding features.

   

As start point I used Day_015_Bonding example from Cypress 100_Projects_in_100_Days examples.

   

As Android App I used CySmart App running on my Asus NEXUS Tablet with Android 5.1 installed.
The connection is never done.

   

My tablet rejects the connection and It doesn't show me any PassKey Form to enable the connection and complete the pairing/bondin procedure.

   

I tried to use a different Android APP like nRF Master Control Panel and the connection doesn't work with this app too.

In the serial log console, connected with my CYBLE 0220001 device, no passkey is showed.
The paring/bonding procedure doesn't work.

   

This is the serial console output:

   

BLE_Bonding Device ON
Starting to advertise
Advertisement is enabled
Device  Connected
Starting Discovery
Discovery complete.
CYBLE_EVT_GAP_AUTH_FAILED: 18
Device Disconnected
Restarting Advertisement..
Advertisement is enabled

   

If I use CySmart Software V.1.1 running on my Windows 7 PC with cypress BLE dongle,
I can discover my BLE peripheral,
When i press connect button, CySmart software requires the PassKey.
My BLE peripheral generates the PassKey ( I can read Its on serial console ).
And the pairing/bonding connection works well.

   

Please help me, 
I need to connect my peripheral with an android app in secure mode using a paring PassKey.
 

0 Likes
1 Solution
Anonymous
Not applicable

Hi Giorgio! I have also looked through the bonding example project in the 100 project/day and been wondering if the code for handling the CYBLE_EVT_GAP_AUTH_REQ event is wrong. The API documentation says that CyBle_GappAuthReqReply should be called, but that example does not call it. (I have not tried to run the example on a device).

   

 

   

I see your code calls CyBle_GappAuthReqReply. You use the global variable cyBle_authInfo as argument. Could this variable's member authErr :: CYBLE_GAP_AUTH_FAILED_REASON_T be different from CYBLE_GAP_AUTH_ERROR_NONE ? Maybe CyBle_GappAuthReqReply should be called by a local variable created just for the call, or the one from casting the void* given to the event handler function. I don't know. It would be nice to clarify this 🙂

View solution in original post

0 Likes
6 Replies
Anonymous
Not applicable

Change the settings to Unauthenticated pairing with encryption

0 Likes
GiMa_1521296
New Contributor

Unauthenticated pairing with encryption doesn't work for me.

   

After long work, I found the way to connect my Tablet to my BLE periferal device with paring but now the 
the tablet shows the passKey for paring and the BLE sends the required passKey to Tablet with CyBle_GapAuthPassKeyReply API.

   

I changed the GAP Security I/O capabilities to  Keyboard and Display.

   

In the attachment file ZIP you can find a modified version of Day_015_Bonding example where I changed the code and the BLE configuration to reach this goal.

   

With this version I am able to pairing my BLE device in this way:
From Settings-> Bluetooth tablet menu I can choose my BLE device and when I select the device, the tablet shows the passKey .
Now enter the passKey in to the serial console and the pairing/bonding process will go on.

   

The  StackEvent on my BLE device receive this event series:

   

Advertisement is enabled
CYBLE_EVT_GATT_CONNECT_IND
CYBLE_EVT_GAP_DEVICE_CONNECTED
CYBLE_EVT_GAP_AUTH_REQ
CYBLE_EVT_GAP_AUTH_REQ: security=0x2, bonding=0x1, ekeySize=0x10, err=0x0
CYBLE_EVT_GAP_PASSKEY_ENTRY_REQUEST

   

CYBLE_EVT_GAP_ENCRYPT_CHANGE
CYBLE_EVT_GAP_KEYINFO_EXCHNGE_CMPLT
CYBLE_EVT_GAP_AUTH_COMPLETE

   

 

   

This operation Mode is not what I want.

   

I want show the passKey on my BLE peripheral device and enter the passKey in my tablet.

   

How can I reach this goal?

   

I think the first step is to set the GAP Security I/O capabilities to Display, but what else?

0 Likes
Anonymous
Not applicable

Hi Giorgio! I have also looked through the bonding example project in the 100 project/day and been wondering if the code for handling the CYBLE_EVT_GAP_AUTH_REQ event is wrong. The API documentation says that CyBle_GappAuthReqReply should be called, but that example does not call it. (I have not tried to run the example on a device).

   

 

   

I see your code calls CyBle_GappAuthReqReply. You use the global variable cyBle_authInfo as argument. Could this variable's member authErr :: CYBLE_GAP_AUTH_FAILED_REASON_T be different from CYBLE_GAP_AUTH_ERROR_NONE ? Maybe CyBle_GappAuthReqReply should be called by a local variable created just for the call, or the one from casting the void* given to the event handler function. I don't know. It would be nice to clarify this 🙂

View solution in original post

0 Likes
Anonymous
Not applicable

Recently, I was surprized that the Cypress generated function CyBle_EventHandler() is the actual event handler, and this just calls our custom handler, set by CyBle_Start( &my_handler ), at end. And I see in the source code that the CyBle_EventHandler calls CyBle_GappAuthReqReply(), I thought our custom event handler overrided the Cypress one. I have not seen any documentation that CyBle_EventHandler is always called, and I've been developing on PSoC4BLE for months. I have to contact support about that!

0 Likes
urchc_1533771
New Contributor II

Any news about issue ?

0 Likes
urchc_1533771
New Contributor II

Is There Anybody Out There? 

0 Likes