esp-nimble
esp-nimble copied to clipboard
Bonding problem with ESP32-C3
With IDF v4.3.1 bonding doesn't work on the ESP32-C3 while it does work with the same code running on the ESP32. I've determined the that it isn't working because on the ESP32 the BLE_SM_OP_IDENTITY_INFO and BLE_SM_OP_IDENTITY_ADDR_INFO events are received by the host task while it is in state BLE_SM_PROC_STATE_KEY_EXCH while on the ESP32-C3 these events arrive while in the state BLE_SM_PROC_STATE_ENC_START. Changing the state prerequisite argument in the calls to ble_sm_proc_find to BLE_SM_PROC_STATE_NONE in the calls from ble_sm_id_info_rx and ble_sm_id_addr_info_rx enables bonding to succeed on ESP32-C3 as it does on the ESP32.
The app I'm working on uses simple no-passkey pairing and the device is acting as a peripheral.