BLE SPP mode sending unexpected AT events

espc6user
Posts: 7
Joined: Mon Oct 21, 2024 9:33 am

BLE SPP mode sending unexpected AT events

Postby espc6user » Fri Nov 01, 2024 11:29 am

Hi everyone,

I'm experiencing a strange behavior whilst in BLE SPP mode.
My use case is the following:
1. Setup ESP-C6 as BLE server
2. Pair with client
3. Trigger the SPP trasnmission (AT+BLESPP)
4. Send/recv data over BLE
5. Client (Linux python script using bluepy stack) stops streaming and triggers disconnect

What kind of response should I expect when the client is disconnecting from the BLE server?

I would expect the following flow to be sent from ESP as AT messages:
1. +QUITT - SPP data mode turned off
2. +BLEDISCONN

I receive the following information in a single message:
+WRITE: <data>
+BLEDISCONN

The next message that I receive the end SPP data mode event:
+QUITT


My questions are:
1. Should I receive AT events whilst in BLE SPP data mode? Are we suppose to parse each message to avoid such a behavior?
2. Shouldn't +QUITT be sent before +BLEDISCONN has been generated?

Thanks

aliarifat794
Posts: 201
Joined: Sun Jun 23, 2024 6:18 pm

Re: BLE SPP mode sending unexpected AT events

Postby aliarifat794 » Fri Nov 01, 2024 1:19 pm

On receiving +BLEDISCONN, check for +QUITT if it hasn’t already been received. This way, you can handle state cleanup in the correct sequence.

espc6user
Posts: 7
Joined: Mon Oct 21, 2024 9:33 am

Re: BLE SPP mode sending unexpected AT events

Postby espc6user » Mon Nov 11, 2024 2:47 pm

Unfortunately that notification hasn't been transmitted. I only got it if I performed the disconnection from the other endpoint.

Sun
Espressif staff
Espressif staff
Posts: 336
Joined: Thu Dec 30, 2021 9:52 am

Re: BLE SPP mode sending unexpected AT events

Postby Sun » Mon Mar 24, 2025 11:27 am

In SPP mode, the output of the +BLEDISCONN log is controlled by the AT+SYSMSG command. You can refer to the usage instructions for that command for more information.
Generating +BLEDISCONN does not automatically exit SPP mode, you should always execute +++ to exit SPP mode if possible.

espc6user
Posts: 7
Joined: Mon Oct 21, 2024 9:33 am

Re: BLE SPP mode sending unexpected AT events

Postby espc6user » Wed Nov 12, 2025 8:50 am

In SPP mode, the output of the +BLEDISCONN log is controlled by the AT+SYSMSG command. You can refer to the usage instructions for that command for more information.
Generating +BLEDISCONN does not automatically exit SPP mode, you should always execute +++ to exit SPP mode if possible.
Thank you for the kind reply!

So, I my understanding is right, i should received only the +BLEDISCONN, considering that the AT+SYSMSG command has set the parameter for the generation of that event.
Hence the correct sequence after receiving +BLEDISCONN would be manual exiting via +++ to exit SPP modem, if needed.

The confusion and question appeared due to the AT+SYSMSG parameter bellow.

1: Print +QUITT when quitting Wi-Fi Passthrough Mode, Bluetooth LE SPP and Bluetooth SPP.

Basically that mean that the +QUITT is a feedback once the BLE SPP mode has been successfully quit as part of the +++ command invoked by the host which generates the commands?

Who is online

Users browsing this forum: No registered users and 1 guest