cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox Bluetooth SDK

New Contributor

Hi,

I am getting familiar with cypress pairing/bonding implementation. As case study I am observing hrs/hrc example. I already understand how the keys are stored. I know that if devices are bonded then after reconnection bt stack will try to restore keys from flash with BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT event. But on the first connection I noticed something strange. Before even log about connection being up ("hrc_connection_up") is printed I can see that BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT  event is received twice. I don't understand why bt stack is trying to retrive keys even before encryption is started? Is it specific to this example or is it standard behaviour with cypress chips? Please the logs:

hrc_interrupt_handler, app timer :13

Button pressed

hrc_interrupt_handler, app timer :13

Button released  with in 2 seconds. hrc_management_cback:22

Scan State Change: 1

wiced_bt_ble_scan: 8100

Found Device : 5a 04 55 0a 32 42

Scan completed:

hrc_management_cback:22

Scan State Change: 0

scan off status 0

hrc_management_cback:19

Key retrieval failure

hrc_management_cback:19

Key retrieval failure

wiced_bt_gatt_le_connect status 1

14

hrc_connection_up

I will be thankful for any help in understanding this.

Michał

0 Likes
Reply
1 Solution
Moderator
Moderator

Hi MiBi_4539931 ,

I am sorry , forgot to update you.


I did the tests. So the stack is handling such a way that :

In case of LE Central role, BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT will get trigger for the first connection itself, but however there won't be any stored keys though.

In LE Peripheral role, BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT will get trigger on the second connection only.

Regards,

Anjana

View solution in original post

0 Likes
Reply
4 Replies
Moderator
Moderator

Hi MiBi_4539931 ,

Yes you are correct that BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT   will trigger if it reconnects to a pre bonded device.

It should not trigger on very first connection.

Let me test the demo sample code.

Regards,

Anjana

New Contributor

Hi Anjana,

Any update?

Regards

0 Likes
Reply
New Contributor

Hi AnjanaM_61​. Have you chance to test that ?

Michał

0 Likes
Reply
Moderator
Moderator

Hi MiBi_4539931 ,

I am sorry , forgot to update you.


I did the tests. So the stack is handling such a way that :

In case of LE Central role, BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT will get trigger for the first connection itself, but however there won't be any stored keys though.

In LE Peripheral role, BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT will get trigger on the second connection only.

Regards,

Anjana

View solution in original post

0 Likes
Reply