I encountered similar issue to this post where my mobile device app can bond with BGM111 after flashing. However, after I closed my app and disabled bluetooth and tried to open my app (and enable bluetooth), I was not able to connect and I received 0x206 and 0x208 error codes.
According to the Bluetooth API guide, 0x206 is due to missing key. However, it didn't prompt me for a passkey. As for 0x208, it means Link supervision timeout. What might cause Link supervision timeout expire?
What would be the suggested approach to resolve them?
if device A has a bonding key with another device, than it will try to use that to increase the security. If the B device lost the keys, than the encryption cannot be established, so the error code 0x206 will be thrown. The device A does not know that the key is no longer valid, so it won't prompt for a passkey (since it thinks it is not needed).
If you have a valid bonding handle, but the encryption was refused with the error code above, than you should delete the bonding with the command "gecko_cmd_sm_delete_bonding". Note, that it will also terminate the connection, so you have to reconnect in order to start again the bonding process.
The error code 0x208 could happen because no response received from one device, most probably because of the bonding issues.
Hope it helps,
the bonding process was designed for that exact reason, that the keys can be stored for a long time, and after the pairing the devices can be connected via an encrypted link without any further actions, so they should be kept as long as possible.
You can delete keys manually from e.g. your phone, when clicking on "forget device". Alternatively it could also happen that the devices cannot establish a secure connection when the BT address of one device is changed for some reason, or if you erase your device's storage for reflashing.
You can check if your device has any stored keys for the connection at the "connection opened" event. The event data contains a "bonding" attribute, and when it is a valid value (so !=0xFF), than the stack has a stored key.
it is hard to say, I am not familiar with the methods how the mobiles are storing bonding information.
Do you have perhaps two development boards? Then you can try out if they can be bonded together, when that works, than the problem is on the mobile side.
Alternatively, you can try it out with another mobile device, or another mobile app. Do you use the BlueGecko app, or a custom one? The BlueGecko a should be able to use bonding information correctly.
If you erase the bonding info, are you able to bond again? In the next connection is the problem still there? (you can try it out without implementing the delete_bonding call, if you erase the board before reflashing it with Simplicity Studio)
there seems to be a problem with the mobile application.
Please check out this guideline about this topic:
After debugging further, I notice that the 0x213 error appears periodically (about every 32s) regardless there was any data transfer within that 32s. I am tempted to conclude that the problem is from the mobile device side, but if I don't implement the bonding process, I don't see the 0x213 error. When I review my code, my implementation follows this post, and I don't have a timer that will break connections every 32s.
I am thinking perhaps after boning, some parameters are changed internally. And thus, are there any parameters I should adjust accordingly to stablize the connection? Or is there any setting required to maintain the connection?