How BG96 in PPP mode can use simple AT comands


I’m using PPP mode to integrate with the esp-idf (Espressif - ESP32) network TCP/IP stack. With the example they provide works perfectly a simple configuration using AT commands + socket connection throw PPP mode.

In my project I want to use some socket connections with SMS and GPS.

PPP provides an integration with the other network libraries so it helps so much but I don’t find any information about how to switch between data mode and command mode without loosing the active connections. Point 4.1.1 of the PPP Application Note indicates that I can use DTR signal or “+++” pattern to achieve my goal but looks like the connections finishes.

Have I got any option to use both methods without loosing active sockets?

Thanks for the help.

In most applications there’ll be two serial ports you can use, a data port for PPP and an AT command port as well. Then you can use your AT commands without affecting the active PPP connection (on the data port).

If you’re restricted to use of the PPP port, then use the “+++” mechanism (needs a small silent “guard time” either side of the “+++”).

That switches the PPP port into command mode. The data connection stays up.

To switch the port back to data mode, use the AT command ATO (that’s the letter “O” for “online”).

In my case I only have one serial port so the solution you provide should fix it but using your strategy sometimes fails. In this cases, the reason I think is because ESP32 sends some data to the modem loosing the time specification (in BG96 1 second before and after without data).
I’m working on that to solve it but, in this time window, is BG96 able to send data to the microcontroler without loosing this time specification?
This is it, is the 2 seconds time windows only to send data to the modem, not to receive?

In other documents and fw comunication stacks I see command “ATO0” instead of “ATO”. Have “ATO” the same behavior as “ATD99**1#” or “ATO0”?


– Modified –

I just realize that UART3 is also attached to the micro. What I have to do to enable AT command interaction over this port? In Hardware Design Document is said that UART3 it’s only for GNSS or NMEA.


Looks like there’s no AT command port available there.

The “+++” <==> “ATO” mechanism has been standard on virtually all modems from long before cellular modems existed. I’ve used it then and now. It’s always worked on cellular modems I’ve tried it on.

I’m now traveling, and have limited access to my usual info sources.

Thanks @snowgum for your answers.

Manuals said that 300ms is the maximum response time to change between modes, that implied that at most 2,3 seconds are needed to change from data to command mode. ¿Do I have any other option to accelerate this change?
As I wrote before, I’m testing this feature with a BG96 but, asking for a concrete modem to the HW guys they answer me that to fix client specification EC21 is the most probably modem.
Thanks again and have a nice travel.

300 ms sounds like the minimum for the guard time. This is the period of silence either side of the “+++”.

There’s no reason a data transmission shouldn’t include “+++” as part of the data stream. This post needs to be transmissible over a PPP connection without switching the port into command mode.

So the mechanism requires a pause, followed by “+++” without pause, followed by another pause.

The switch back to online mode with “ATO” should be instantaneous.

Dear Ismael,
You also consider read/write callback functions on pppos stack. When you want to switch command mode, callbacks don’t read or write. I use as below without any problem;
stop read/write callbacks
empty receive buffer
wait 1 sec
wait 100ms
wait 100ms
wait 1 sec

Best Regards