Send AT commands while in PPPoS connection

aderregibus
Posts: 4
Joined: Mon Apr 13, 2020 6:36 pm

Send AT commands while in PPPoS connection

Postby aderregibus » Sat Apr 18, 2020 2:30 pm

I am working with a BG96 and using the PPPoS sample code (https://github.com/espressif/esp-idf/tr ... pos_client) which works fine.

However, I need to be able to send AT commands from time to time in order to check signal quality, incoming SMS, etc., but I want to keep the data connection open. For example, I want to keep the MQTT connection open for that short period of time while I send the AT commands.

There is a function in place to switch between PPP_MODE and COMMAND_MODE (esp_modem_dte_change_mode), but since the MQTT task is still running and the stack is not notified of the PPP_MODE "suspension", the serial port is still busy with PPPoS data and connections drop while I try to send AT commands (and fail).
I tried several "hacks" but failed.

Please don't suggest using the BG96 TCP/IP stack via AT commands, because the whole point of using PPPoS for me is to leverage all the high level libraries that ESP-IDF provides.

So, the question is: how do I switch to AT command mode for a few seconds while pausing the PPP data connection on the ESP?
I even have access to DTR pin on the BG96, so I can make a fast switch to AT command mode.

Thanks!

NotMyRealName
Posts: 41
Joined: Thu Feb 13, 2020 1:35 am

Re: Send AT commands while in PPPoS connection

Postby NotMyRealName » Thu Jun 25, 2020 9:48 pm

Did you find a solution?

I'm also looking at how to do this but with a Telit module.

My module supports multiplexing of the serial port over a single physical interface (i.e. two AT command interpreters on the same port) which is one solution. No idea if the BG96 supports this though?

If you did find a simple solution I would be interested so I don't have to figure out the whole mux thing. :D

aderregibus
Posts: 4
Joined: Mon Apr 13, 2020 6:36 pm

Re: Send AT commands while in PPPoS connection

Postby aderregibus » Sat Sep 12, 2020 11:07 pm

Hello NotMyRealName.

I still haven't been able to find a solution to this problem.
I wasn't able to find any hint of this being address in newer versions of ESP-IDF either.

It's really a surprise to me that no one else is considering this a HUGE problem, since checking signal levels or receiving SMS while holding a data connection seems like a standard requirement.

NotMyRealName
Posts: 41
Joined: Thu Feb 13, 2020 1:35 am

Re: Send AT commands while in PPPoS connection

Postby NotMyRealName » Sun Sep 13, 2020 10:02 pm

I think it might be a problem that doesn't have an easy solution...

I'm using code based on the modem example code in ESP idf. I've re-written a few things in esp_modem.c and a few other things.

I have tried mine using the DTR pin to exit online mode without closing the connection (See AT&D). I put a semaphore to basically flag when the modem was in PPP mode. I added some code the net interface binding to try to obtain this semaphore before sending packets.

It sort of works but its a bit flaky. Haven't had time to properly debug it. I'm have three different model Telit modules and some of the modules I tried are better than others. The firmware doesn't always implement the AT&D nicely somehow.

I think the main problem with this approach is all those packets have to go somewhere while the network link is closed so you would need big buffers on both ends if you have high data rates. (I don't understand this all that well though so could be wrong). So if you aren't sending any data on the other connection and simply wish to keep it open, it could work, but its always going to struggle with lots of throughput.

I think the proper way to do this might be to look at connection multiplexing. (AT+CMUX)

m.urbant
Posts: 3
Joined: Thu Sep 28, 2023 2:25 pm

Re: Send AT commands while in PPPoS connection

Postby m.urbant » Thu Sep 28, 2023 2:29 pm

Hi,

Some modems do provide additional UART port which can be used in parallel. And in case of USB connection some modems do support second virtual COM port capable of processing AT commands. This how I solved the problem.

oarcher
Posts: 2
Joined: Tue May 07, 2024 4:50 pm

Re: Send AT commands while in PPPoS connection

Postby oarcher » Thu May 09, 2024 12:15 am

During setup, if last mode was CMUX with PPP, you can force manual command mode with

Code: Select all

dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_COMMAND)
see https://docs.espressif.com/projects/esp ... L_COMMANDE

NotMyRealName
Posts: 41
Joined: Thu Feb 13, 2020 1:35 am

Re: Send AT commands while in PPPoS connection

Postby NotMyRealName » Thu May 09, 2024 9:32 pm

Thanks for the tip oarcher

I'm still using IDF 4.x but I'll be making that leap to 5.x at some point I hope, so I'll take a look at this when I get there! You've probably saved me trying to implement it myself! :D

I see there is a whole section here:
https://docs.espressif.com/projects/esp ... ementation

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 136 guests