BLE peripheral nimble unable to terminate connection

AngelVer
Posts: 4
Joined: Thu Mar 12, 2020 10:54 am

BLE peripheral nimble unable to terminate connection

Postby AngelVer » Thu Mar 10, 2022 4:53 pm

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?

therealergo
Posts: 8
Joined: Wed Jun 30, 2021 6:16 pm

Re: BLE peripheral nimble unable to terminate connection

Postby therealergo » Fri Aug 26, 2022 12:15 pm

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

Who is online

Users browsing this forum: No registered users and 84 guests