[BLE] Nothing happens after Key retrieval success

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

cross mob
vtunr
Level 4
Level 4
10 likes received 5 sign-ins First like received

Hi,

I have a problem using the BT wifi introducer demo.

If i pair a device to the board, everything is working fine. If i reboot the board, i have the event :

BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT

with the following debug :

[WiFi Introducer] Paired Device Link Keys Request Event

Key retrieval success

But after, i can't communicate to the board unless i delete the pairing on my phone. I'm pretty sure this is not the expected behavior when a device is paired.

What should i do to solve that ? I'm using SDK 3.7.0-3.

Regards,

vtunr

0 Likes
1 Solution
vtunr
Level 4
Level 4
10 likes received 5 sign-ins First like received

So if anyone have the problem than me, i fixed it.

You change what's store in the DCT by the full keys and not only a few part of it :

typedef struct{      
     wiced_bt_device_link_keys_t              bond_info[MAX_BOND_INFO]; /* Bond information                      */  
     uint32_t                                 current_index;            /* Index of the bond info array to store */
} bt_wifi_introducer_bond_info_dct_t;

Then modify all the function to store/read the bond info to get the full key and load it

And finally :

     case BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT:     
     {         
          wifi_introducer_read_link_keys(&p_event_data->paired_device_link_keys_request);         
          break;    
     }

And that should be fully working.

View solution in original post

2 Replies
vtunr
Level 4
Level 4
10 likes received 5 sign-ins First like received

So i'm pretty sure that there is no key retrieval since it just initialize the key_data :

    case BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT:
    {        
         WPRINT_BT_APP_INFO( ("[WiFi Introducer] Paired Device Link Keys Request Event\n") );
         memset( &p_event_data->paired_device_link_keys_request.key_data, 0x00, sizeof( p_event_data->paired_device_link_keys_request.key_data ) );         
         WPRINT_BT_APP_INFO(( "Key retrieval success\n" ));         
         break;    
     }

So i added the key retrieval from the DCT (needed to change the function to take a pointer as arg) :

    case BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT: 
    {         
          wifi_introducer_read_link_keys(&p_event_data->paired_device_link_keys_request);        
          WPRINT_BT_APP_INFO( ("[WiFi Introducer] Paired Device Link Keys Request Event\n") );         
          //memcpy( &p_event_data->paired_device_link_keys_request.key_data, 0x00, sizeof( out_device.device_link.key_data ) );       
          WPRINT_BT_APP_INFO(( "Key retrieval success\n" ));         
          break;    
     }

I checked that the key retrieved is the same as the one saved, which it is now that the wifi_introducer_read_link_keys function use a pointer to the key, but then, my phone still can't communicate with the BT chip

I works after the pairing but if i reboot the chip or restart the bt stack, i end up in this situation. Any help will be appreciated.

vtunr

vtunr
Level 4
Level 4
10 likes received 5 sign-ins First like received

So if anyone have the problem than me, i fixed it.

You change what's store in the DCT by the full keys and not only a few part of it :

typedef struct{      
     wiced_bt_device_link_keys_t              bond_info[MAX_BOND_INFO]; /* Bond information                      */  
     uint32_t                                 current_index;            /* Index of the bond info array to store */
} bt_wifi_introducer_bond_info_dct_t;

Then modify all the function to store/read the bond info to get the full key and load it

And finally :

     case BTM_PAIRED_DEVICE_LINK_KEYS_REQUEST_EVT:     
     {         
          wifi_introducer_read_link_keys(&p_event_data->paired_device_link_keys_request);         
          break;    
     }

And that should be fully working.