This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sending SMS problem

Hi,

I am working on a project where i have to send some information using SMS from a microcontroller (8051). I have succeeded in sending and receiving the SMS with a "small" problem.

I am using as modem GenPro 20e. the problem is the following:
I send the following string to the modem (through the serial interface)
AT+CMGS="PPPPPPP"<CR> Data to be sent: ABCDEFG <ctrl-Z>
(where PPPPPP is the phone number)

the message i receive is missing the first 10 letters of the data part, so i receive the message on the phone as follows:
"e sent: ABCDEFG"
While testing, i realised that if i send an SMS containing less than 33 letters, the modem will not reply correctly.
I have some displays on my circuit which i am using to display the string i am sending to the modem. The displays show that the string sent to the modem contains all the letters of the data part in the right order.
I also saved the message in the modem's memory (using the command +CMGW) and read it on the PC using the hyperterminal it showed that the message is missing the first 10 letters :(

I went through all of the documents that come with the modem and made sure that the format of the command is correct.
Also the code i am working on was previously tested using another modem and no error was detected.
Also i have connected the modem to the PC and sent the same message to it and the message was received correctly.

Any help on this topic will be greatly appreciated.
Thanks a lot in advance.
FIF

  • you send it to e.g. a PC.
    if there are characters missing in that case it is your code (post it), if not it is your understanding of the required record format (not a put down, we all sometimes have difficulty with such)

    Erik

  • well i dont really know how to send it to the PC.. do you mean i connect the microcontroller through serial to the PC?? if so how do i communicate with it??using hyperterminal??
    Thanks

  • Are you waiting for the '>' prompt before starting to send the actual message?

  • Connect up a computer via the serial port to the SMS. Use a terminal program such as Tera Term using the correct baud, CR and/or LF; issue the commands by typing them in. You should see all and any responses the SMS performs. Get the protocol down before coding it in a uP

  • "I send the following string to the modem (through the serial interface)
    AT+CMGS="PPPPPPP"<CR> Data to be sent: ABCDEFG <ctrl-Z>"

    No, that is wrong.

    As Per says, after sending the phone number, you need to wait for the ">" prompt before sending the text of the message.

    In other words:

    Transmit: AT+CMGS="PPPPPPP"<CR>
    Wait for: >
    Transmit: ABCDEFG <ctrl-Z>
    

  • Im a bit confused because all the documents i read did not say anything about waiting for the prompt before sending the body of the message (I have seen it on the hyperterminal though but i thought that its just a differentiation between the actual commands and the message). Does that mean that the modem will reply with the prompt after the carriage return? if so does that apply to all modem types?? because my program is supposed to work with all modems...

    Thanks

  • What documents did you read?
    There is a lot of poor quality material on the internet that illustrates bad practices like this!

    "Does that mean that the modem will reply with the prompt after the carriage return?"

    If you enter the +CMGS command incorrectly - eg, an invalid phone number - the modem will reply with an error!

    Therefore you really do need to wait for the modem's response to +CMGS and verify that it is, in fact, the prompt!

    "does that apply to all modem types??"

    yes, that is the standard behaviour for all GSM modems.

  • well the documents i read are the user guide and command list of the modem i am using. i also have other documents about AT commands but they dont explain that i need to wait.
    Thanks a lot for your help

  • Why would the modem semd the '>' prompt if there were no need to wait for it?

    The whole meaning and point of any "prompt" is that it tells you when the system is ready and waiting for your action, isn't it?!

    The definitive specification is GSM 07.05, "Use of Data Terminal Equipment - Data Circuit Terminating Equipment (DTE-DCE) Interface for Short Message Services (SMS) and Cell Broadcast Services (CBS)"
    www.3gpp.org/.../0705.htm

    The definition of the +CMGS commands says:

    "the TA shall send a four character sequence <CR><LF><greater-than><sp> (IRA 13, 10, 62, 32) after command line is terminated with <CR>; after that text can be entered from TE to ME/TA"
    (my emphasis)

    Note that there is free access to the entire set of all GSM specifications here:
    www.3gpp.org/.../numbering.htm

  • I am sorry Andy. I made a mistake while writing i didnt mean to say that the documents didnt say that i need to wait for the prompt. i meant to say that the documents didnt say that the modem sends a prompt after receiving the carriage return. The documents i read are the command list that came with the modem and i thought that it is a reliable source. But i was wrong. Now i am waiting for the prompt and checking it and i recieved the whole message correctly.
    Thanks for the help.