SWRA750 September 2022
This example will create a Bluetooth Low Energy connection between two Wilink8 boards, but only if the device's BD address is on the 'White List'- meaning it will not connect with devices that are not on the White List. It is optional to put the Slave to sleep and have it wake up to a connection request from a BD address on it's White List.
The hardware used in this example is two Wilink8 boards (one as the "slave" and the other as the "master") and a PC running two instances of the HCITester tool (one for each board).
Step 1:
Run the INIT script on both the Slave board and the Master board.
Step 2:
Write a known BD address on the Slave, so that the master knows which device to connect to.
Send_HCI_VS_Write_BD_ADDR 0xFC06,"0708090A0B0D"
Wait_HCI_Command_Complete_VS_Write_BD_ADDR_Event 5000, any, HCI_VS_Write_BD_ADDR, 0x00
Step 3:
On the Slave: Clear the device white list (to remove previous data) and then add the Master's BD address to the White List.
## CLEAR DEVICE WHITE LIST
Send_HCI_LE_Clear_White_List
Wait_HCI_Command_Complete_LE_Clear_White_List_Event 5000, any, HCI_LE_Clear_White_List, 0x00
## ADD DEVICE ADDRESS : PUBLIC TO WHITE LIST
Send_HCI_LE_Add_Device_To_White_List 0x00, "010203040506"
Wait_HCI_Command_Complete_LE_Add_Device_To_White_List_Event 5000, any, HCI_LE_Add_Device_To_White_List, 0x00
Step 4:
On the Slave: Configure the advertising parameters to match the BD address of the Master, the channel to use and set it to only accept scans from the White List.
Send_HCI_LE_Write_Advertising_Parameters 0x120, 0x150, 0x00, 0x00, 0x00, "010203040506", 7, 0x03
Wait_HCI_Command_Complete_LE_Write_Advertising_Parameters_Event 5000, any, HCI_LE_Write_Advertising_Parameters, 0x00
Step 5:
Enable advertising on the Slave.
Send_HCI_LE_Write_Advertise_Enable 0x01
Wait_HCI_Command_Complete_LE_Write_Advertise_Enable_Event 5000, any, HCI_LE_Write_Advertise_Enable, 0, Any
Step 6:
Write a known BD address to the Master, matching that of which was used in Step 4.
Send_HCI_VS_Write_BD_ADDR 0xFC06,"010203040506"
Wait_HCI_Command_Complete_VS_Write_BD_ADDR_Event 5000, any, HCI_VS_Write_BD_ADDR, 0x00
Step 7:
Clear the device White List and add the Slave's BD address to it:
Send_HCI_LE_Clear_White_List
Wait_HCI_Command_Complete_LE_Clear_White_List_Event 5000, any, HCI_LE_Clear_White_List, 0x00
Send_HCI_LE_Add_Device_To_White_List 0x00, "0708090A0B0D"
Wait_HCI_Command_Complete_LE_Add_Device_To_White_List_Event 5000, any, HCI_LE_Add_Device_To_White_List, 0x00
Step 8:
Configure the Scan parameters to allow advertising from the White List:
Send_HCI_LE_Write_Scan_Parameters 0x00, 0x01000, 0x1000, 0x00, 0x01
Wait_HCI_Command_Complete_LE_Write_Scan_Parameters_Event 5000, any, HCI_LE_Write_Scan_Parameters,
Step 9:
Create a connection using a White List and the Slave'd BD address:
Send_HCI_LE_Create_Connection 0x0190, 0x0190, 0x01, 0x00, "0708090A0B0C", 0x00, 800, 800, 0, 0x0c80, 0x0000, 0x0000