2017-11-28 02:47 AM
Hi
I have a BlueNRG-MS peripheral device, that requires pairing for encrypted data transfer. Overall it works, but when cancelling the paring procedure from the central (IOS) then the following reconnect attempt fails to start the paring procedure.
If I let the pairing prompt on the IOS dev timeout, a get EVT_BLUE_GAP_PAIRING_CMPLT with result = 1 ( timeout)
And if i actively cancel the pairing on the IOS device, then i get
a get
EVT_BLUE_GAP_PAIRING_CMPLT with
result = 2 ( Failed).
In both cases the peripheral terminates the connection.
The behavior above is expected, but the issue is when trying to do a reconnect and restart the pairing procedure.
In the timeout situation, the pairing procedure can successfully be restarted at the next connection attempt, but for the 'active cancel' situation, the aci_gap_slave_security_request returns 12
( ERR_COMMAND_DISALLOWED), and the pairng procedure is not started ( EVT_BLUE_GAP_SLAVE_SECURITY_INITIATED not received). However if i wait for a certain time before reconnecting i does also work in the latter case.
To me it looks like some internal state isn't cleared on the 'cancel' event but only on the timeout.
Any suggestions will be
appreciated.I am using stack verison 7.2c (FW 07.23)
Best regards
Anders
#bluenrg-ms #bluenrg-pairing2017-11-29 08:19 AM
Hi Anders,
you cantryto delete the security database by calling aci_gap_clear_security_db() on your peripheral device. This should do trick byprogrammatically clearingthe internal state of your BlueNRG-MS.
For more information, please take a look at this
https://community.st.com/0D50X00009XkeEoSAJ
.Best regards,
Antonio
2017-11-30 05:47 AM
Hi Antonio
Thank you for the answer.
However I don't think it will fit my application, since i cannot allow to clear the security database run-time because the device can have multiple bonding's. Are there other ways to clear the internal state of the security manager ? As mentioned above, it seems to work if I wait a certain time before trying to pair again.
Best regards
Anders
2017-11-30 09:27 AM
Hi Anders,
you could try calling hci_reset() to reset your device and bring it to the initial state, without clearing the security database.
Best regards,
Antonio
2017-12-01 05:36 AM
Hi Antonio
I changed my code to reset the stack in the SM_PAIRING_FAILED situation.
This seems to fix the issue however I don't find this the most elegant solution, since i need to setup the characteristics and advertisement data again.
It might be a good idea to feed this info back to the development team in order to get this fixed for future stack releases.
Best regards
Anders