Unsuccessful BLE connects make BLE stack instable


Hello all,

I have an ESP32 which must be connected to 4 peripherals permanently (at least most of the time). Because these peripherals can loose connection from time to time, it must be absolutely sure, that they reconnect reliably again, as soon as they are ready again.
To test this behavior, my peripherals disconnect BLE every 3 minutes (after time of connection) and so initiate a new connection from the ESP32.
The ESP32 knows the addresses of the 4 peripherals and tries to establish a connection each time, if one or more of them is/are not connected anymore.
It obviously happens, that such a reconnect fails and so it must be tried again. After such unsuccessful tries, the ESP32 starts to not connect to available peripherals anymore, which do advertise and are connectable from other central devices (cell phone).
Has anybody seen such behaviour or knows how to prevent from this failures?

Kind regards


Not me
Do you have a BLE sniffer to trace what is going on ?
I educatedly guess the ESP32 is the client here, what is your code, what are you doing ?
What happens when the peripherals disconnect ? Do you get an error code somewhere ?
When you can’t connect, do you check for function call response values ? Any clues ?
Do you see anything in the log ? Did you raise the debug level ?
Since Mongoose-OS is mostly a wrapper here, it is probable that you’ll have to work your way with Espressif’s IDF.


Hi Scaprile,
Sorry about my delay, I have a lot of jobs right now!
Most likely, it is my own fault: During a (unsuccessful) connect, I did not wait long enough to get the disconnect event. So I tried to start a new connect while the old was still running. And MOS does really not like this.
Thanks for your help!
Kind regards


Hi Rolf,

This is Edmund. Sorry for bothering you as it seems you are the only one I can find that able to implement GATT client on Mongoose. I’m new to Mongoose and trying to do the same thing but no success after weeks of work.

Up to now I can connect to the GATT server, discover the uuids, and write to the GATT server (e.g. I can set the clock in a BLE sensor). But the connection was broken every time I tried to subscribe to anything.

Would you mind giving me some hint how you can connect to the server? Are you using Mongoose API or using ESP IDF?

Thanks for your kind assistance.

best regards,