- Development Kit: [none, custom product using wrover module.]
- Module or chip used: [ESP32-WROVER 16M]
- IDF version: v3.3.1
- Build System: [Legacy GNU Make]
- Compiler version: xtensa-esp32-elf-gcc.exe (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a5) 5.2.0
- Operating System: [Windows]
- (Windows only) environment type: [MSYS2 mingw32].
- Power Supply: [on-board 3.3V]
Using Bluedroid BLE stack.
Custom GATTS profile based on code from here: https://github.com/eagi223/esp-idf_Blue ... ti-Service
Custom Android/iOS App built with Cordova and uses the Evothings BLE plugin from here: https://github.com/evothings/cordova-ble
Problem Description
Several of our customers are reporting that they are disconnected from our ESP32-based device after about 5s of inactivity. They are able to discover and connect to our device using our App and are able to send commands to our device immediately after connection. But if they don't send any commands for 5s then the connection is somehow broken.
Our App does not report a disconnect (since no disconnect or error callback is triggered from the BLE plugin).
The ESP32 log doesn't show a disconnect until about 30s after the connection stopped working. Then it just shows the messages below. But those are the same messages that would be shown on a normal disconnect, so I don't see any useful clues there.
Code: Select all
I (662439) GATT Server: ESP_GATTS_DISCONNECT_EVT, reason = 19
I (662439) ble gap: advertising start successfully
Not working: (Bluetooth drops after 5 seconds)
iPhone XR, iOS 13.4.1
Samsung Note 10+, Android 10.?
Samsung S20 Ultra, Android 10.?
Working OK:
iPhone XR, iOS 13.3.1
iPhone SE, iOS 12.4.6
moto x4, Android 7.1.1
Samsung Galaxy S8, Android 9.
Samsung Galaxy S7, Android 8.0.0
Samsung Galaxy Tab A, Android 7.1.1
(We have also tested many other models, too many to list. Also most of our customers are not complaining --yet.)
Steps to reproduce
I was able to borrow a colleagues iPhone XR with iOS 13.4.1 which exhibits the bug. I inspected the app running in Xcode but I found no obvious errors. After about 5s of inactivity, our app believes that it is still connected and communicating to ESP32 even though nothing is being received at the ESP32. There's no disconnect or error callback triggered from the BLE plugin.
I don't have access to an Android 10 device to test with yet.
Further Troubleshooting
I know the Evothings Cordova BLE library that I'm using is not being actively developed (since 2016) and I'm considering switching to https://github.com/randdusing/cordova-p ... luetoothle But that will be a significant effort.
I will try turning on verbose logging in the ESP32 bluetooth library to see if there are any useful messages.
I will try running nRF app to connect to our ESP32 device on the affected phones to see if the connection is stable.
Any thoughts or suggestions are appreciated.