Page 1 of 1

Bluetooth SNIFF Mode Disconnect Issue

Posted: Tue Jan 05, 2021 4:57 pm
by JL1946
From what I understand, when the ESP32 is connected as an a2dp source to an a2dp sink (bluetooth speaker) the ESP32 is acting as the Master and the Speaker is the Slave.

From the Bluetooth Specification, my understanding is that after sending a music/sound wav file to the speaker, the Master tries to put the Speaker into a low-power mode called SNIFF Mode.

The problem I'm having is that quite often, the ESP32 registers an error such as

E (4070466) BT_APPL: bta_dm_pm_sniff BTM_SetPowerMode() returns ERROR status=7

The ESP32 then immediately disconnects from the speaker. I have added workarounds in my code to reconnect to the speaker and that is working, but I am wondering about this because I don't see it happening with commercial apps (on my cell phone for example).

I have not seen any information on what this error means. Is it a feedback error wherein the Speaker does not respond to the SNIFF Mode command, or does it mean that the ESP32 is trying to put itself into SNIFF Mode and is encountering an error???

My setup is ESP32-WROVER (Version 3) -- Eclipse IDE -- SDK Ver 4.2 release...

If someone can shed some light on this issue it would be much appreciated. TIA

Re: Bluetooth SNIFF Mode Disconnect Issue

Posted: Wed Jan 06, 2021 6:19 pm
by JL1946
I made a change to the project that has apparently cleaned up a lot of problems for me. I disabled the Bluetooth/wifi coexistence in the sdkconfig. From reading the Espressif docs, I realized that using coexistence imposes limits on the RF communication protocol. When I disabled the coexistence mechanism, things turned around for me. I have had a solid link with the speaker since then. The error has gone away and I am no longer getting the above mentioned error-induced disconnects. The other change made was to limit Log messages and printf statements in the A2DP Callback function.

The issue I am having now is that if I send nothing to the speaker while it is bonded to the ESP32, after about 5-6 minutes, it shuts itself off. My understanding was that the ESP32 Bluetooth code is supposed to send a keep-alive frame to the speaker every 20 mSeconds, so either that is not happening or the speaker itself does not recognize the frame and shuts down to conserve battery. It is an inexpensive Sony SRS-XB01.

My research into this issue has yielded nothing. If anyone has some info about this issue, please respond. Thanks...