Pairing with PassKey

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

cross mob
user_1528391
Level 4
Level 4
First like received First like given

I'm a starter at PSOC and Bluetooth, please excuse me for maybe trivial question. I was working on ble workshop and i succesfully run lab1-2-3. But there is not any instance about authentication. I have set my ble component as gap peripheral and changed the security level to "authenticated pairing with encryption" but i didn't understand how can i configure the passkey? Is there any simple example about pairing with passkey? I just want to pair with a passkey with my master(gap central device) then let it read 1 byte device id from peripheral device.

0 Likes
1 Solution
Anonymous
Not applicable

This will fix the passkey.

CyBle_GapFixAuthPassKey(1, USER_PASSKEY);

View solution in original post

0 Likes
5 Replies
user_1528391
Level 4
Level 4
First like received First like given

I have found the BLE_Bonding application at "100 projects at 100 days" section. Here is what i didn't understand. Whenever the cysmart sends passkey request, the pioneer kit sends passkey from uart and i can enter it from cysmart. But how can i set constant passkey? I added the code block from passkey displaying, i don't understand that creates the passkey randomly or something?

   

Here is the code block:

   

 case CYBLE_EVT_GAP_PASSKEY_DISPLAY_REQUEST:
            printf("\r\n");
            printf("CYBLE_EVT_GAP_PASSKEY_DISPLAY_REQUEST. Passkey is: %d%d.\r\n",
                HI16(*(uint32 *)eventParam), LO16(*(uint32 *)eventParam));
            printf("Please enter the passkey on your Server device.\r\n");
            break;

0 Likes
user_1528391
Level 4
Level 4
First like received First like given

I found this function at API document:

   

CyBle_GapGetPeerDevSecurityKeyInfo(uint8 bdHandle, uint8 * keysFlag, CYBLE_GAP_SMP_KEY_DIST_T * keyInfo);

   

But i don't know how can i use the *keysFlag and *keyInfo

0 Likes
Anonymous
Not applicable

Random keys are generated for Pairing.  Please have a look at: https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day017_Pri...

   

to understand the usage of CyBle_GapGetPeerDevSecurityKeyInfo

0 Likes

I was looking for a documantation about using constant passkeys but i have learned that we can not use constant passkeys for now. Thank you for you response anyway 🙂

0 Likes
Anonymous
Not applicable

This will fix the passkey.

CyBle_GapFixAuthPassKey(1, USER_PASSKEY);

0 Likes