Page 1 of 1

BLE peripheral nimble unable to terminate connection

Posted: Thu Mar 10, 2022 4:53 pm
by AngelVer
Hi,

We are working in an IOT device with a ESP32_WROOM using the idf4.3.2 SDK. The ESP32 works as ble peripheral with nimble.

ESP32 needs, as peripheral to be able to expel/terminate/close a bluetooth connection.

I tried with

Code: Select all

/**
 * Terminates an established connection.
 *
 * @param conn_handle           The handle corresponding to the connection to
 *                                  terminate.
 * @param hci_reason            The HCI error code to indicate as the reason
 *                                  for termination.
 *
 * @return                      0 on success;
 *                              BLE_HS_ENOTCONN if there is no connection with
 *                                  the specified handle;
 *                              Other nonzero on failure.
 */
int ble_gap_terminate(uint16_t conn_handle, uint8_t hci_reason);
but does not work. It returns error 0x212 that it comes from HCI errors as BLE_HS_EROLE error, whatever this means (I guess that this function only works for central role).

Which is the best way to force disconnect of a ble connection as peripheral?

Re: BLE peripheral nimble unable to terminate connection

Posted: Fri Aug 26, 2022 12:15 pm
by therealergo
For anyone stumbling across this thread from a search (it's the first result for a lot of combinations of "0x212" & "BLE Nimble terminate connection" & "esp32"), the OP has found a solution here: https://github.com/espressif/esp-idf/issues/8555