AT+CMGS hangs if command is misissued


+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french part)
    Posts
    797

    Default AT+CMGS hangs if command is misissued

    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).

    Name:  000630.png
Views: 180
Size:  6.1 KB


    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?
    Roger

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    1,930

    Default Re: AT+CMGS hangs if command is misissued

    in the old dialup days +++ used to be a modem escape sequence, worth a try
    This is more entertaining than Free to Air TV

  3. #3
    Join Date
    Sep 2009
    Posts
    716

    Default Re: AT+CMGS hangs if command is misissued

    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.

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french part)
    Posts
    797

    Default Re: AT+CMGS hangs if command is misissued

    Hi Richard,

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


    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.
    Roger

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french part)
    Posts
    797

    Default Re: AT+CMGS hangs if command is misissued

    Pedja,

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

  6. #6
    Join Date
    Sep 2009
    Posts
    716

    Default Re: AT+CMGS hangs if command is misissued

    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.

  7. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french part)
    Posts
    797

    Default Re: AT+CMGS hangs if command is misissued

    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
    Roger

  8. #8
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french part)
    Posts
    797

    Default Re: AT+CMGS hangs if command is misissued

    BTW,

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

    Name:  000635.png
Views: 130
Size:  35.7 KB

    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 ).

    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
    Roger

Similar Threads

  1. pic18f4550 hangs.. RX_INT DT_INTS-18.. please help
    By cluster in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th November 2011, 16:32
  2. uC Hangs after second serout command
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th August 2011, 17:57
  3. Trouble with PIC16F88 (chip hangs up)
    By nobner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th January 2009, 09:23
  4. PIC HANGS with SERIN and Timeout?
    By koossa in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 18th January 2008, 17:33
  5. PIC Hangs when using Serin TimeOut
    By Squibcakes in forum Serial
    Replies: 2
    Last Post: - 20th July 2006, 01:59

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts