-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
Hi everyone,
I’m using a u-blox NINA-W106 (ESP32) module in Controller-only HCI mode over UART (H4), connected to a Raspberry Pi running BlueZ.
The use case involves Bluetooth Classic (BR/EDR) only, specifically SPP/RFCOMM communication with an Android application.
The ESP32 firmware is based on the controller_hci_uart_demo example, with the following adjustments:
CTS/RTS flow control enabled
Fixed baudrate (921600)
No sleep or power management enabled
Fixed BD_ADDR read from eFuse (not modified)
The HCI-UART transport is stable — there are no more “device down” or transport errors.
However, we are still facing a persistent reconnection and pairing issue.
🔹 Scenario and symptoms
The initial pairing between the Android tablet and the Raspberry Pi (via NINA) works correctly.
The SPP connection and data transfer operate flawlessly.
When the Android application is closed and reopened, it attempts to reconnect automatically.
At this point, btmon shows:
Link Key Request → followed by Link Key Request Negative Reply (host has no key);
Android initiates re-pairing;
Host responds with IO Capability Request Negative Reply (Pairing Not Allowed 0x18);
Result: Simple Pairing Complete – Authentication Failure (0x05).
Android then automatically removes the device from its paired devices list.
Important: the ESP32 was not reset during this test — only the Android app was closed and reopened.
Even so, the host (BlueZ) seems to lose the link key, causing reconnection failure.
🔹 What has been verified
Correct baudrate and hardware flow control (921600 + CTS/RTS).
No use of esp_bt_controller_disable() or controller resets between sessions.
BD_ADDR is fixed (read from eFuse).
hci0 interface remains UP and active throughout the test.
The problem does not occur when using CSR/WT11-based dongles (same host, same Android app).
🔹 Possible cause (based on ESP-IDF issue #12650)
“Multiple users in ESP32 community (btstack issue #44, ESP-IDF issue #1275, Google Groups thread) report that link keys are not stored/persisted in ESP32 context, which aligns with our scenario of Controller-only HCI mode.”
From what we’ve analyzed, it seems that the Controller-only HCI mode on ESP32 does not retain or persist BR/EDR link keys after pairing, nor keeps them valid between sessions.
This causes the host to request a missing link key, leading to the “Authentication Failure (0x05)” upon reconnection.
We would like to confirm with the Espressif team:
Is there currently any official support for BR/EDR link key persistence in HCI Controller-only mode?
If not, is there any API or vendor command that allows intercepting or restoring link keys from the controller side?
Are there plans for a future fix (for example, automatic NVS storage of link keys)?
Is there a supported method to intercept Link Key Notification / Link Key Request HCI events from the controller in ESP-IDF?
🔹 Project context
The NINA-W106 module is used as part of a custom Bluetooth dongle in an industrial production environment (integration with Linux-based self-service terminals).
Modifications to the Raspberry Pi or BlueZ host software are not possible, so the solution must be implemented entirely on the ESP32 firmware side.
Any guidance or clarification on BR/EDR link key persistence in controller-only HCI mode would be greatly appreciated.
Thank you very much,