4 Replies Latest reply on Apr 24, 2020 7:10 AM by AnjanaM_61

    Unexpected events from bt stack




      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:
      Scan State Change: 0
      scan off status 0
      Key retrieval failure
      Key retrieval failure
      wiced_bt_gatt_le_connect status 1


      I will be thankful for any help in understanding this.