AT+CMGS returns ERROR
Asked Answered
G

5

18

I am using SIM900 GSM module connect to my AVR Microcontroller. I tested it with FT232 to see transmitting data. First Micro sends AT it will response OK

AT OK
AT+CMGF=1 OK
AT+CMGS="+9893XXXXXX" returns ERROR and doesn't show ">"

Could anybody advise me what to do?

Gwendolyngweneth answered 3/2, 2014 at 8:38 Comment(3)
You should enable the extended error message reporting using the +CMEE command and see what ERROR code the device returns.Stonecutter
When should I send that? And what structure?Gwendolyngweneth
Please show some effort and just take a look in the SIM900 command manual yourself. Everything about how +CMEE is used and what exactly it does is there.Stonecutter
S
22

Command AT+CSCS? will answer You what type of sms-encoding is used. Properly answer is "GSM", and if not, You should set it by command AT+CSCS="GSM".

And remember about "Ctrl+Z" (not "Enter") as a finish of sms text, please.

Shrunk answered 16/2, 2014 at 12:46 Comment(1)
The AT+CSCS="GSM" solved the problem for me. Thanks!Titleholder
C
6

You aren't passing all the parameters to the command.

The command format is:

AT+CMGS=<number><CR><message><CTRL-Z>

Where:

<CR> = ASCII character 13
<CTRL-Z> = ASCII character 26

You have passed only the number and without the <CR> you won't see the > note for the message.

Example:

AT+CMGS="+9893XXXXXX"
> This is the message.→

The response is:

+CMGS:<mr>
OK

Where <mr> is the message reference.

Cristophercristy answered 3/2, 2014 at 15:43 Comment(1)
@MohammadFarahi <CR> is 0x0D (=13), but Ctrl-Z is 0x1A (=26).Autolysis
M
2

If AT+CSCS? command returns UCS2, then many arguments need to be encoded as hex string of UTF-16 encoding, so the phone number would become "002B0039003800390033...", and the SMS text would need to be encoded in the same way. If you don't need UCS2 encoding, then the easiest thing to do is to switch to GSM encoding (or another encoding from the available set as shown by AT+CSCS=? command)

Marlanamarlane answered 27/7, 2016 at 11:56 Comment(0)
F
2

Sometimes the issue is the text mode you are in. Enter AT+CMGF? and you should receive +CMGF: 1. If instead you receive +CMGF: 0, enter AT+CMGF=1. This changes the message format from PDU mode to Text mode. I'm not sure what either of those mean exactly, but this fixed my issue.

SIM 800 AT command manual

Fidellia answered 23/7, 2018 at 16:9 Comment(1)
Answers to old questions are great! Questions aren't meant to only help OP but to help everyone that would have the same question.Benco
B
0

I have faced the same ERROR. All previous recommendations are right. I want just to share my experience. I use SIM800L module. It was tuned AT+CMGF=1 at start of my project. But as it turned out the sim-module forgot this parameter occasionally. The programm wasn`t able to send and read sms. And I was trying to find the reason of the problem for several days.

My recommendation is to check some parameters like CMGF=1, CSCS="GSM", CMEE=2 right before use the CMGS or CMGR commands.

Blackpoll answered 16/6, 2023 at 21:16 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.