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!
Send AT commands while in PPPoS connection
-
- Posts: 4
- Joined: Mon Apr 13, 2020 6:36 pm
-
- Posts: 41
- Joined: Thu Feb 13, 2020 1:35 am
Re: Send AT commands while in PPPoS connection
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.
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.
-
- Posts: 4
- Joined: Mon Apr 13, 2020 6:36 pm
Re: Send AT commands while in PPPoS connection
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.
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.
-
- Posts: 41
- Joined: Thu Feb 13, 2020 1:35 am
Re: Send AT commands while in PPPoS connection
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)
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)
Re: Send AT commands while in PPPoS connection
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.
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.
Re: Send AT commands while in PPPoS connection
During setup, if last mode was CMUX with PPP, you can force manual command mode with
see https://docs.espressif.com/projects/esp ... L_COMMANDE
Code: Select all
dce->set_mode(esp_modem::modem_mode::CMUX_MANUAL_COMMAND)
-
- Posts: 41
- Joined: Thu Feb 13, 2020 1:35 am
Re: Send AT commands while in PPPoS connection
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!
I see there is a whole section here:
https://docs.espressif.com/projects/esp ... ementation
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!
I see there is a whole section here:
https://docs.espressif.com/projects/esp ... ementation
Who is online
Users browsing this forum: VinayDand and 441 guests