2020-06-18 05:09 AM
Hi,
I have a project where we use the STM32WB55 with the ST25R3911B as NFC module for OOB pairing.
I couldn't find any example for OOB pairing flow.
My start point is the p2p_server example and I can see there are:
which I assume are relevant for my cause.
After reading AN5289 I also can tell there are:
But I can't figure how to connect the dots. is there any example for OOB?
when I am invoking get oob data as below I always get OOB_Data array of '0', why?
uint8_t Address_Type = 0;
uint8_t Address[6];
// initial value is just for seeing it gets override
uint8_t OOB_Data[16] = { 0x01, 0x02, 0x03 };
uint8_t OOB_Data_Len;
uint8_t getOobDataRes = aci_gap_get_oob_data(0x01, &Address_Type, Address, &OOB_Data_Len, OOB_Data);
If there is no example I would appreciate if you can answer my questions ( a reference to the relevant functions would be awsome! :(
Thanks
Solved! Go to Solution.
2020-07-09 08:30 AM
1) In fact the HCI_COMMAND_COMPLETE_EVT_CODE is already managed on the CMO+ core. So you wont see it at M4 core level.
2)The bonding list is managed internally by the CM0+ core in SRAM but is regularly saved in Flash memory when there no RF activity, especially after disconnection.
So this list should be available after reset. one possible cause is the reset of the device before any disconnection. The CM0+ would not have time to save the bonded devices list.
3) The white list is manage by the user using ACI function like HCI_LE_READ_WHITE_LIST_SIZE , HCI_LE_CLEAR_WHITE_LIST, HCI_LE_ADD_DEVICE_TO_WHITE_LIST, HCI_LE_REMOVE_DEVICE_FROM_WHITE_LIST.
Have a look at the AN5270 that describes those functions.
2022-02-28 05:32 PM
Hello @Remi QUINTIN (Employee)
I have tried implementing the OOB from a firmware example I found on the forum, and from the little nuggets of information that I got from the above posts, I put together the pieces, but I haven't been able to trigger OOB Byte in the firmware version binary 1.13.0. I am using an android Android app and device is STM32Wb series microcontroller. Irrespective of permutations and combinations that I have tried, connection always falls back to numeric pairing.. :(
My Goal is to have Preset OOB Key on Device(STM32WB) and Phone(currently android) to establish a secure connection.
uint8_t ALL_EVENTS[8]={0x9F,0x01,0x00,0x00,0x00,0x00,0x00,0x00};
hci_le_set_event_mask(ALL_EVENTS);
int status = hci_le_read_local_p256_public_key();
APP_DBG_MSG("\r\n\r EVENT MASK To Generate a LOCAL 256 Key %d \n",status );
Added "HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_SUBEVT_CODE" event in
switch (meta_evt->subevent)
{
.// few more cases not shown for clarity
case HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_SUBEVT_CODE:
{
APP_DBG_MSG("\n\r OOB Key Gen Event!");
runOOB();
}
}
static void runOOB(void)
{
uint8_t at = 0x00;
uint8_t add[6] = {0x00,0x00,0x00,0x00,0x00,0x00};
uint8_t len = 0x10;
uint8_t random[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
uint8_t confirm[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int status = aci_gap_set_oob_data(0x00,0x00,0x00, 0, 0, 0);
APP_DBG_MSG("\n\r OOB INITIALIZATION STATUS : %d", status);
int statusRand = aci_gap_get_oob_data(0x01, &at,add,&len, random);
int statusConfirm = aci_gap_get_oob_data(0x02, &at,add,&len, confirm);
APP_DBG_MSG("\n\r OOB Key - Random Data: [");
for(int i =0; i <16; i++)
APP_DBG_MSG("%02X:", random[i]);
APP_DBG_MSG("]");
APP_DBG_MSG("] \n\r OOB Key Hash : ");
for(int i =0; i <16; i++)
APP_DBG_MSG("%02X:", confirm[i]);
}
Can you please provide some guidance, on what I might be doing wrong?
Thanks
2022-04-04 12:32 AM
Hello,
Did you receive HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_SUBEVT_CODE event ?
Your implementation seems to be right, once you have OOB data, you need to transmit theses data to the smartphone via NFC. You must write random and confirm data on NFC shield. Can you give us more information about your setup ? Which NFC library you used ?
Best Regards
2022-04-04 07:58 AM
Hello,
Yes, I do receive the HCI_LE_READ_LOCAL_P256_PUBLIC_KEY_COMPLETE_SUBEVT_CODE , and able to generate the key and print on terminal, but on the android side, advertising packet doesn't contain the flag for OOB pairing, but rather only Pin based pairing.
2022-04-05 08:50 AM
Hello,
Once you have OOB data, you need to write random and confirm data on NFC shield (like X-NUCLEO-NFC04A1 board). OOB pairing demonstration firmware is available here:
https://www.st.com/en/embedded-software/stsw-st25dv004.html#overview
And android application for this demonstration is available here:
https://www.st.com/en/embedded-software/stsw-st25005.html
Best Regards