spp_counter on ESP32 closes rfcomm channel exactly after 20 seconds timeout

26 views
Skip to first unread message

Dmitry Akulov

unread,
Jan 22, 2026, 8:03:18 AMJan 22
to btstack-dev
Hi everyone

I've been recently trying to add SPP support to my ESP32 project based on Bluepad32

So what I've done includes just adding the code from spp_counter example to the Arduino sketch. And this works, so my PC (Windows) is able to connect to the ESP32 and I'm able to send/receive text messages via the COM port.

But I've encountered a very strange behaviour of the btstack internals: every RFCOMM connection is terminated by the ESP32 exactly 20-second after opening, even if I keep sending and receiveng data packets.

I've also tested this under Linux and got the same results - so I think this timeout is somewhere in ESP32 or in btstack.

What I've found in btstack manual just tells that there're some timeouts, but it's unclear if they can be changed and what API calls need to be used. Or this is even unrelated to RFCOMM channels ?

  Single threaded design BTstack does not use or require multi-threading. It uses a single run loop to handle data sources and timers. Data sources represent communication interfaces like an UART or an USB driver. Timers are used by BTstack to implement various Bluetooth-related timeouts. For example, to disconnect a Bluetooth baseband channel without an active L2CAP channel after 20 seconds.  

Any help on solving this issue with the SPP would be appreciated.

Regards,
Dmitry

Matthias Ringwald

unread,
Jan 22, 2026, 8:45:11 AMJan 22
to btsta...@googlegroups.com
Hi Dmitry

Most timeouts are 30 seconds. The "HCI Disconnect on Idle" might be 20 seconds, but if you have an RFCOMM connection, the HCI connection isn't idle.

Please enable HCI logging (see main.c), collect the console output from start until it disconnects, use tool/creaet_packet_log.py on the text and post the *.pklg file to see what's going on.

Cheers
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/a4f4aecc-f461-4e7e-ad4d-fdb81f705f10n%40googlegroups.com.

Dmitry Akulov

unread,
Jan 26, 2026, 7:34:03 AMJan 26
to btstack-dev

Dmitry Akulov

unread,
Feb 14, 2026, 5:36:45 PM (6 days ago) Feb 14
to btstack-dev
Hi Matthias !
Did you have a chance to look at this issue ?
Do I need to collect some extra logs ?

Matthias Ringwald

unread,
Feb 15, 2026, 6:45:15 AM (5 days ago) Feb 15
to btsta...@googlegroups.com
Hi Dmitry

Thanks for reminding me. In your log, the disconnect is triggered on the BTstack side, which means by the stack itself or your code.

The HCI Disconnect on Idle should not happen and also logs L2CAP_EVENT_TIMEOUT_CHECK, which is not in the log.

I have no experience with using Arduino for the ESP32.

Could you verify that spp_counter works without problems when using port/esp32 directly with ESP-IDF?

Other than that, please add a log_info to gap_disconnect(..) to log if it gets called, which I expec. Now, please find out who calls gap_disconnect.
You can also run BTstack on a desktop system (mac,linux,windows) with an USB Dongle. You might even flash an ESP32 with an HCI firmware, but that's extra work.

Cheers
Matthias

> On 14 Feb 2026, at 23:36, Dmitry Akulov <pink0d...@gmail.com> wrote:
>
> Hi Matthias !
> To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/00f03b13-7a20-4390-a974-81bf13e86f2dn%40googlegroups.com.


Pin Kod

unread,
Feb 15, 2026, 1:06:34 PM (5 days ago) Feb 15
to btsta...@googlegroups.com
Thanks, will try to make that test with ESP-IDF

You received this message because you are subscribed to a topic in the Google Groups "btstack-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/btstack-dev/5MPbQEsxYTc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to btstack-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/btstack-dev/D1A85831-7814-4015-8947-5F623004B58C%40gmail.com.
Reply all
Reply to author
Forward
0 new messages