PSoC MCU 6 BLE - Problem with procedure pairing/bonding

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

cross mob
l_diserio
Level 2
Level 2
First like received 5 replies posted 10 sign-ins

Hello,

I'm using CY8cPROTO-063-BLE PSoC 6 BLE PROTOTYPING KIT with CYBLE-416065-0243-SMT which sends and receives some values over BLE from an APP Cysmart.

The device is configured as follows:

GAP role: Peripheral
Type of advertising:
Filter Policy: Scan Request: Any | Connect Request Any
Map of advertising channels: All channels
Fast advertising interval
Minimum (ms) 20
Maximum (ms): 30
Check Timeout (s): 30

Security Mode: Mode 1
Security level: Authenticated pairing with encryption
Encryption key size (bytes): 1

The device connects correctly with the app and the pairing procedure works correctly. At the end of the connection the bonding is saved correctly.

But if the device subsequently establishes a another connection always with the same smartphone, with the CySmart app, the smartphone's operating system requests the pairing password again even if the bonding procedure was previously successful.

How I can risolve this problem ?

Thanks in advance for any replies.

Lucia

0 Likes
1 Solution
PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @l_diserio 

Please can you go through this below link for fixed passkey issue.

https://community.infineon.com/t5/PSoC-6/PSoC6-BLE-setting-a-fixed-pass-key/td-p/224958

 

Thanks & Regards

Pratiksha V

View solution in original post

0 Likes
5 Replies
PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @l_diserio 

I hope before you store the bonding data, you need to check a variable "cy_ble_pendingFlashWrite". Only when this variable is non-zero, you should call "Cy_BLE_StoreBondingData()" API. You cannot store bonding data if this variable is 0. Hence in your main code, after you call the Cy_BLE_ProcessEvents, you can check if the variable is non-zero or not. If it is non-zero, you can call the "Cy_BLE_StoreBondingData()" API.

if this doesn't work please can you share your code so that we can check at our end.

 

Thanks & Regards

Pratiksha V

0 Likes
lock attach
Attachments are accessible only for community members.

Hi @PratikshaV .

thanks for your reply.

check  "cy_ble_pendingFlashWrite", after Cy_BLE_ProcessEvents, and only when this variable is non-zero, I call "Cy_BLE_StoreBondingData()" API.

But this doesn't work. I share my code .

How I can risolve this problem ?

Thanks in advance for any replies.

Lucia

0 Likes
lock attach
Attachments are accessible only for community members.
PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @l_diserio 

I tried to build your shared code but unfortunately I was not able to build it successfully please can you check the attached code example.

 

Thanks & Regards

Pratiksha V

0 Likes
lock attach
Attachments are accessible only for community members.

Hi @PratikshaV 

Your code works! But I need to set a fixed passkey. I have add the following code in the case CY_BLE_EVT_GATT_CONNECT_IND

case CY_BLE_EVT_GATT_CONNECT_IND:
appConnHandle = *(cy_stc_ble_conn_handle_t *)eventParam;
DBG_PRINTF("CY_BLE_EVT_GATT_CONNECT_IND: %x, %x \r\n",
(*(cy_stc_ble_conn_handle_t *)eventParam).attId,
(*(cy_stc_ble_conn_handle_t *)eventParam).bdHandle);


pk.fixedPassKey = 123456;

pk.isFixed = CY_BLE_GAP_PASSKEY_FIXED;

pk.bdHandle = appConnHandle.bdHandle;


apiResult = Cy_BLE_GAP_FixAuthPassKey(&pk);
if(apiResult != CY_BLE_SUCCESS)
{
DBG_PRINTF("Cy_BLE_GAP_FixAuthPassKey API Error: 0x%x \r\n", apiResult);
}


but the funtion Cy_BLE_GAP_FixAuthPassKey return an error, in particular :

Cy_BLE_GAP_FixAuthPassKey API Error: 0x16ffff

I share my code .

How I can risolve this problem ?

Thanks in advance for any replies.

Lucia

 

0 Likes
PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @l_diserio 

Please can you go through this below link for fixed passkey issue.

https://community.infineon.com/t5/PSoC-6/PSoC6-BLE-setting-a-fixed-pass-key/td-p/224958

 

Thanks & Regards

Pratiksha V

0 Likes