PDA

View Full Version : AT+CMGS hangs if command is misissued



flotulopex
- 14th February 2021, 20:52
Hi there,

I was wondering if there is any way to get out of a "sitting" situation from a GSM module when, i.e., a AT+CMGS is misissued.

This situation I'll discribe further on should actually not appear since the program takes care to send "clean" SMSs.

Since my project is about a GSM monitoring system, I would like to make sure the modem will always be functional even if something goes wrong.

In this example, I've omitted the CTRL-Z command to terminate the message. This leads the module to hang showing ">" lines (yellow highlight).

9019


Appart from the next line +CMTI: "SM",0 indicating an incoming message, the next lines (braun highlight) are commands issued by my PIC but not recognized and therefore not executed. AAMOF, these three last lines are preceeded by a ">", the one that is probably waiting for AT+CMGS command termination.

Unfortunately, sending a CTRL-Z does not finally terminate the AT+CMGS command and my module is stuck here until...I switch it OFF.

Is there a way to get out of this trap?

richard
- 14th February 2021, 22:21
in the old dialup days +++ used to be a modem escape sequence, worth a try

pedja089
- 15th February 2021, 00:53
There is no universal solution for that. It depends on implementation of AT command parser and sometimes there is difference between modems FW versions.
In my programs I repeat command 3 times, if there is no valid reply, then just reset modem. I tried few times to make error handler for modem comm, and in 90% error cases it end up resetting modem.

flotulopex
- 15th February 2021, 06:05
Hi Richard,

I actually never saw this "+++" command - I'll give it a try asap :wink:


Pedja,

I'm thinking of doing the same thing, repeating commands and waiting for acknowledgement.

As you said: this can be modem dependent.

Currently I use a SMICOM 7600E one. I think to give a try with a QUECTEL one or any other if you have a suggestion.

flotulopex
- 15th February 2021, 11:14
Pedja,

May I kindly ask you what type of modem(s) you use?

pedja089
- 15th February 2021, 11:52
Started with sim300, then sim900D, now sim800C.
I think simcom is best modem for price.
There is at least 150 pcs in few different products, and I think that there is no failed modem in field. There was few that fail testing after assembly.
If you want to be sure that modems works reliable, you must have way to switch power off(for reason that you are trying to solve), good supply(low ESR caps, good regulation-no more than 0.2V drop on 1.6A pulse), and good antenna.
Flow control is optional.
Where I have large files to transver(10's of KB )I use flow control or if device can download new FW from FTP.
I had no luck with built in FTP client, so I stick to mine FTP and SMTP clients in PBP.

flotulopex
- 15th February 2021, 15:51
Thanks Pedja,

Where I live, 2G has been by end 2020 so I choose to go SIM7600E.

And thank you for all your usefull remarks :wink:

flotulopex
- 15th February 2021, 16:12
BTW,

In the AT command book for my module (SIM7600E), I finally noticed this:

9021

There is no mention of this ESCape command in the datasheet, just here in this table. But, unlike it is appearing, even if I cancel the CMGS command, I will get an OK.

For any reason, I didn't understand that part of the DS (...as well as a lot of other parts, in fact :D).

Anyway, the ESC termination command does the job and cancels the AT+CMGS command and yelds an "OK" which I can wait for to "move on".

Problem solved! ;)

Richard, I did check the +++ command which is now allocated, in my module, to switch from data mode to command mode. But it was a good idea to mention it; thank you :)