Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GSM project AT command question

Status
Not open for further replies.

bikashh

Full Member level 5
Joined
Nov 28, 2009
Messages
264
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
india
Activity points
3,132
I have a doubt reagding GSm AT commands, when sending sms using AT+CMGS command, I wait for '>' symbol to appear. if within 3 sec I don't receive this symbol I issue <ctl+z> but the module give +CMS ERROR: 3765(which means invalid input), what should I do in this case. should I restart the module as the module goes into hang mode.

Also,is this 3 mins Ok to check response
Thanks
 

Restart the module. Be careful not to delete incoming sms during start up routine in case you need them. You could even make it more fancy by sending 2-3 times before restart. After that you could detect where the problem lies, but in any case a timeout is OK to exist. I think 3 seconds are OK, you could add a couple more if you wish.

Are there any other events happening during this "hang mode"? An incoming sms or something like that? Which modem are you using?
 

I am using M10(Quectel), yes my code hangup when I receive '>' and +CMTI at the same time.
To resolve this I had to put hard delay by __delay_ms(3000) for 3 sec.
Previously, I was using a counter in the ISR for timeout and my code used to hang in the above situation.

Thanks
 

This is the exact same problem I had with another modem, Sagem's HiLoNC v2 modem. Never really found out what the problem was. I just restart the modem in this case. The new sms is still there after modem restart, so no harm is really done, except the fact that the modem is in startup mode for many seconds, but still this is not a big deal. So you are saying that by adding the delay the problem is solved? What delay is this? After you receive '>' you implement this delay?
 

yes if I use __delay_ms(3000) after AT+CMGS command is sent and then I check for '>'. and also the same delay I used after sending the message and waiting for "OK".

At+CMGS="XXXXXXXXXX"<enter>
delay(3sec)
check for '>'
write message and press <cntl+z>
delay(3sec)
check for OK.
 
  • Like
Reactions: alexxx

    alexxx

    Points: 2
    Helpful Answer Positive Rating
Thanks man, I will check this out. As I said, the timeout also works well.
 

By Timeout , do you mean running a counter in the ISR and waiting for it to elapse?

I tried using the same but it get hanged in the above situation.
Like, while(((UART_Buff[2] == 'O') && (UART_Buff[3] == 'K')) || (ui_Timeout< 400));
 

No I mean that whenever I throw a command to the gsm a counter starts counting. It is cleared when I get the responce. If it counts let's say 20 seconds (less could be a problem due to outgoing sms responce), then this means that the gsm did not answer. Then I clear the counter again and throw the last command for once more. If it timeouts again, then I hardware restart the modem (using power on and reset pin) and then the initialization code starts running. In this way the modem "gets alive" again and when initialization finishes I can then perform my tasks, search for incoming sms, make my calls etc, whatever the application level demands. The problem with this solution is that the modem will be dead for about a minute or so, but this is not really a problem. As I said in a previous post, if you don't erase incoming sms during startup code, then it works fine.
 

Ok, I got it. Also, I've observed that the module I am using doesn't respond if I check after a day or two. I thought the module may be going to sleep mode when no operation is being running,so, I grounded DTR pin according to the user manual of the module but still the problem persist.Don't know what exactly I am ignoring.
 
Last edited:

Do you mean that it is going to sleep mode automatically?
You could throw a dummy command every once in a while (every few seconds) like let's say "clear echo" command.
 

Yes, I've implemented the mentioned technique by throwing "AT" command every 5 sec but not yet tested. I'll let you know if this resolves the issue.
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top