Skip to main content
LSpad.1
Associate III
December 30, 2020
Solved

STM32WB pairing error with mixed bonded/nonbonded devices

Hi,

I am running a system with some STM32WB, one client and some server.

Right now i am connecting, pairing and bonding the devices.

If i start from a condition where i have all the server not bonded (aci_gap_get_bonded_devices return nothing) and I start the firmware, the client connects, pairs and bonds all the server and all works.

If i start from a condition where i have all the server already bonded and I start the firmware, the client connects and rebonds all the server and all works.

Instead if i start from a condition where I have some server bonded and others not I have some problems. In particular:

  • If I connects (and pair and bond) before all the not bonded devices and after the bonded devices the system still works.
  • If I connects (and rebond) only one server that was already bonded, all the not bonded server cannot be paired anymore.

In particular:

  • I start the firmware, mac address list of the servers is received.
  • the first server is bonded, so i connect it, send a pairing request via aci_gap_send_pairing_req, that rebond the server.
  • the second server is not bonded.
  • I connect it and i ask for pairing with this call: aci_gap_send_pairing_req(server->connectionHandle, 0x02).
  • After called, returns 0, and i receive a EVT_BLUE_GAP_PAIRING_CMPLT event with status 2 (failed) and reason 8 (UNSPECIFIED_REASON) (error codes from AN5270 page141).
  • If i retry to call the aci_gap_send_pairing_req function i receive the error 0x59 (BLE_STATUS_DEV_IN_BLACKLIST) (error code from ble_defs.h).

I have tryed to call the aci_gap_send_pairing_req with the force rebond parameter equal to 0x00. I have tryed to update the stack to the one published in 1.10 packages but no changes. Do you have any idea witch can be the problem?

Thank you in advance

This topic has been closed for replies.
LSpad.1
LSpad.1Best answer
Associate III
June 10, 2022

I solve starting pairing and rebond from the server and not from the client. Apparently it is the correct way to use BLE, the pairing and bonding are not started from the one that start the connection but from the one that advertise.

6 replies

rsilva
Associate
May 26, 2022

Are there any updates to this? Were you able to solve this?

rcoel.1
Visitor II
May 26, 2022

I have the same problem. Can someone help?

LSpad.1
LSpad.1AuthorBest answer
Associate III
June 10, 2022

I solve starting pairing and rebond from the server and not from the client. Apparently it is the correct way to use BLE, the pairing and bonding are not started from the one that start the connection but from the one that advertise.

rsilva
Associate
June 13, 2022

Thank you for you answer @Community member​ so, the server starts the connection, but the client starts the pairing/bonding process?

LSpad.1
LSpad.1Author
Associate III
June 13, 2022

The opposite. The server is the advertiser and the one that starts pairing/rebond process. The client finds the advertiser (or not if the server uses directed advertising) and starts the connection.

rsilva
Associate
June 13, 2022

Thank you for the clarification.