BLE scan report CYBLE_EVT_HCI_STATUS 12

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

cross mob
Anonymous
Not applicable

There is a error when I have two Central start at the same time try to scan and connect to two Peripheral.

   

 

   

#1. Two Central device start scan

   

#2. When receive CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT,

   

  if the target mac address arrived then CyBle_GapcStopScan().

   

#3. After receive CYBLE_EVT_GAPC_SCAN_START_STOP try to connect.

   

   But if there are two Central, I always get state=scanning, then report HCI_STATUS 12.

   

Any idea?

   

///////////////////////////////////////

   

Stop Scanning, waiting for Scanning event 
CYBLE_EVT_GAPC_SCAN_START_STOP 
state: scanning
CYBLE_EVT_HCI_STATUS 12 

0 Likes
2 Replies
Anonymous
Not applicable

You should get  CYBLE_EVT_GAPC_SCAN_START_STOP with the event data of '0x01'  indicating success, before initiating a connection. This could be the reason for HCI error.

0 Likes
Anonymous
Not applicable

Thanks for the reply.

   

With more investigation in this topic, here is more findings.

   

#1. When CYBLE_EVT_GAPC_SCAN_START_STOP received the event data is "0x01", then I try to init the connection

   

  In most situation it will report this HCI error.

   

#2. This is because the ble state still in CyBle_GetState() == CYBLE_STATE_SCANNING

   

  If the duplicate filtering is not selected, these scan result event still coming.

   

#3. So for temp solution, put the connect in the main loop, until the state not in CYBLE_STATE_SCANNING.

   

 

   

So what is the standard procedure for connect a new device?

   

#1. startscan CyBle_GapcStartScan

   

#2. processing the scan result CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT

   

#3. once find the target device, stop scan  CyBle_GapcStopScan

   

#4. connect when receive the CYBLE_EVT_GAPC_SCAN_START_STOP and event data=0x01?

0 Likes