Is it possible to implement pin-based pairing with BLE?

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

cross mob
Anonymous
Not applicable

Hi.

I am using WICED 1.0 SDK and BLE BCM20732 tag. I am developing an internal demo to verify if this technology, which is new to us, can be used. I read the BLE specifications quickly, and noticed there is SMP module inside, but I wonder how I can implement pin-based pairing using BCM kit.

Is it possible to do it? If so, how?

1 Solution

PIN code pairing is applicable to BT classic. BLE uses passkey (there is a subtle difference), so I guess you really mean passkey. See hello_sensor sample app, hello_sensor.c in SDK 2.1, everything that gets compiled in when PASSKEY_PAIRING is defined. From what I recall, you should be able to use the same sequence of calls (and API) with 20732(S) and SDK 1.1.

View solution in original post

6 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

For development on the 20732S, please install SDK 1.1 instead of version 1.0 as it contains patches, bug fixes and new features that are not present in 1.0.

Note that the PIN method you describe would be similar to what's used in Classic Bluetooth.  Since most BLE devices are not expected to have a screen/display, BLE implements something called 'Just Works', which is described here: Re: What is difference between being connected versus paired?

0 Likes
Anonymous
Not applicable

Actually, I read from BLE specs that pin-based paring is possible also for device with limited output/input capabilities. Indeed, I know some commercial BLE tags implement it. Is it a limitation introduced by BCM?

0 Likes

PIN code pairing is applicable to BT classic. BLE uses passkey (there is a subtle difference), so I guess you really mean passkey. See hello_sensor sample app, hello_sensor.c in SDK 2.1, everything that gets compiled in when PASSKEY_PAIRING is defined. From what I recall, you should be able to use the same sequence of calls (and API) with 20732(S) and SDK 1.1.

Anonymous
Not applicable

Thank you very much. Code from SDK 2.x works, but I had to replace function lesmp_setSMPassKey with lesmp_setPassKey, otherwise undefined reference error occurs.

My next question is: how can I customize the passkey? I see its value is 123456 from comment in sample code, but I do not understand how it is mapped to array values 0x40, 0xE2, 0x01.

0 Likes

123456 is 0x1E240. Since this is a little-endian system, the bytes in the passkey array is LS byte first.

Anonymous
Not applicable

The passkey is actually an integer, stored in little endian order and passed as an array.

1. passkey= 123456 -> 0x0001e240

2. 0x00 0x01 0xe2 0x40 To "LE String"  0x40 0xe2 0x01 0x00



if(passkey)

{

lesmp_setSMPassKey(passkey, 6);

lesmp_setJustWorksNotPermitted();

}


//Johan

0 Likes