Part Number: CC2541
Other Parts Discussed in Thread: BLE-STACK
Hi Team,
We are using the Laird TiWi-UB1 module, which is based on the CC2541 TI chip. It is configured to support both Central and Peripheral roles.
The pairing process uses a PIN that each side must enter. Each side uses the IO capability of GAPBOND_IO_CAP_KEYBOARD_ONLY, so that authenticated pairing can be performed (with both sides entering in their key). I believe this results in Security Mode 1, Level 3 (authenticated and encrypted).
When a connection occurs, both sides try to start the pairing process. The peripheral will send the SlaveSecurityRequest, and the central will try to start pairing (each side sends their respective message on their own timing, which doesn’t seem to be a problem since the central will ignore the SlaveSecurityRequest if it’s already starting the pairing process).
Then, normally, pairing is initiated, and they send their PINs, exchange keys and link is secured and they continue on in the application (we receive the GAPBOND_PAIRING_STATE_STARTED and GAPBOND_PAIRING_STATE_COMPLETE event).
We did implement 2 timeouts during the connection. One 30-second timer is started upon connection, and is stopped when pairing is started. The 2nd 30-second timer is started when pairing starts (GAPBOND_PAIRING_STATE_STARTED event). If either of these time outs expire, then the firmware will disconnect.
In the error cases we’ve seen, the pairing process doesn’t seem to complete. I’ve used a TI dongle (with BTool) to simulate a central device. I’ve connected to the end device and I don’t see the expected SlaveSecurityRequest come from the end device. When I try to initiate pairing with GAP_Authenticate, it seems to be successfully sent but after 30 seconds I receive GAP_AuthenticationComplete with bleTimeout status (and a disconnect, which is likely from the end device timing out and disconnecting). I did sniff the BLE traffic of these devices and do see the Pairing Request packet is sent over the air but no other packets are sent (other than the EMPTY ones which probably for keeping the connection up).
I did notice that even in the error cases, that the end device seems to be getting the GAPBOND_PAIRING_STATE_STARTED event, because after a connection with BTool, if I wait 20 seconds, then initiate pairing with GAP_Authenticate, the link doesn’t go down until an additional 30 seconds elapses. That indicates that the 2nd 30-second time was started after the GAPBOND_PAIRING_STATE_STARTED was received. But the pairing process doesn’t seem to continue after that.
One last troubleshooting item I did was just record the status results of the API functions GAP_SendSlaveSecurityRequest
And GAP_Authenticate. The unknown error status we were seeing was from the GAP_SendSlaveSecurityRequest function, where it was returning 0x04. This doesn’t seem to be one of the documented return statuses:
* @return SUCCESS, <BR>
* bleIncorrectMode: Not correct profile role,<BR>
* INVALIDPARAMETER, <BR>
* bleNotConnected,<BR>
* FAILURE: not workable.<BR>
I was wondering if it was MSG_BUFFER_NOT_AVAIL, but wasn’t sure. Is that a possible return value from this command? If this is a valid return value, does that mean that there’s a memory issue?
Just FYI, the snippet of code for this is just:
bStatus_t stat = GAP_SendSlaveSecurityRequest( connHandle, authReq );
LOG_WRN(16, "SlaveSecurityReq stat %d", stat); //this command also saves the status to NV memory so that we can check it later.
The GAP_Authenticate did not seem to return any failures though, the return values were always 0x00.
Regards,
Garret