Quectel M10 SMS Application Note V1.0
Quectel M10 SMS Application Note V1.0
Quectel M10 SMS Application Note V1.0
SMS Application
Note
GSM_SMS_Application_Note_V1.0
Document Title:
Revision:
1.0
Date:
2010-11-15
Status:
Release
GSM_SMS_Application_Note_V1.0
General Notes
Quectel offers this information as a service to its customers, to support application and
engineering efforts that use the products designed by Quectel. The information provided is
based upon requirements specifically provided for Quectel by the customers. Quectel has not
undertaken any independent search for additional relevant information, including any
information that may be in the customers possession. Furthermore, system validation of this
product designed by Quectel within a larger electronic system remains the responsibility of
the customer or the customers system integrator. All specifications supplied herein are
subject to change.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Copyright
This document contains proprietary technical information which is the property of Quectel
Limited. The copying of this document, distribution to others, and communication of the
contents thereof, are forbidden without express authority. Offenders are liable to the payment
of damages. All rights are reserved in the event of a patent grant or registration of a utility
model or design. All specification supplied herein are subject to change without notice at any
time.
Copyright Quectel Wireless Solutions Co. Ltd. 2010
GSM_SMS_Application_Note_V1.0
-1-
Contents
Contents .................................................................................................................................................... 2
Table Index ............................................................................................................................................... 4
0. Revision history .................................................................................................................................... 5
1. Introduction .......................................................................................................................................... 6
1.1. Reference ....................................................................................................................................... 6
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
1.2.2.
1.2.3.
1.2.4.
2.1.2.
2.1.3.
2.1.4.
2.2.2.
2.2.3.
2.2.4.
2.4.2.
Send English short message(GSM coding) and not require status report ...................... 22
2.5.2.
Send Chinese short message(UCS2 coding) and require status report .......................... 24
3.1.2.
3.2.2.
-2-
3.5.1.
3.5.2.
3.5.3.
3.5.4.
Send English short message(GSM coding) and not require status report ...................... 35
3.6.2.
Send Chinese short message(UCS2 coding) and require status report .......................... 38
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
4.1.2.
4.1.3.
4.3. Store Class 0 SMS to <mem3> When Received Class 0 SMS (+QCLASS0) ............................. 43
4.4. Configure SMS code mode (+QSMSCODE) .............................................................................. 44
GSM_SMS_Application_Note_V1.0
-3-
Table Index
TABLE 1: REFERENCE ................................................................................................................................ 6
TABLE 2: RELATED AT COMMANDS ........................................................................................................... 6
TABLE 3: ABBREVIATIONS ......................................................................................................................... 7
TABLE 4: AT+CMGF SYNTAX................................................................................................................... 9
TABLE 5: AT+CSCS SYNTAX .................................................................................................................... 9
TABLE 6: AT+CSCA SYNTAX .................................................................................................................. 10
TABLE 7: AT+CPMS SYNTAX ................................................................................................................. 11
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
-4-
0. Revision history
Revision
Date
Author
Description
draft
2009-6-25
Willis YANG
Initial
1.0
2010-11-15
Joanna Li
Add details
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
-5-
1. Introduction
This document describes how to use Point to Point Short Message Service (SMS) through Hyper
Terminal by AT commands which Quectels module provides. The Cell Broadcast Service (CBS)
is not included in this document.
1.1. Reference
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Table 1: Reference
SN
Document name
Remark
[1]
Mxx_ATC
[2]
GSM 07.05
[3]
GSM 03.38
[4]
GSM 03.40
[5]
GSM 07.07
[6]
GSM 04.11
AT command
Description
Reference
AT+CMGF
GSM07.05
AT+CSCS
GSM07.07
AT+CSCA
GSM07.05
AT+CSMP
GSM07.05
AT+CNMI
GSM07.05
AT+CMGW
GSM07.05
AT+CMSS
GSM07.05
AT+CMGS
GSM07.05
AT+CMGR
GSM07.05
AT+CMGL
GSM07.05
AT+CMGD
GSM07.05
AT+QMGDA
Quectel defined
AT+CSDH
GSM07.05
AT+CSAS
GSM07.05
AT+CRES
GSM07.05
AT+CPMS
GSM07.05
AT+QCLASS0
AT+QSMSCODE
GSM_SMS_Application_Note_V1.0
TO
SIM
WHEN
Quectel defined
Quectel defined
-6-
AT+QEXTUNSOL
ENABLE/DISABLE
UNSOLICITED INDICATIONS
Table 3: Abbreviations
Abbreviation
Description
SMS
SME
SMSC/SC
MO
Mobile Originated
MT
ME
MS
TE
TA
PDU
TP
URC
TOA
TON
NPI
FO
MR
OA
DA
RA
PID
DCS
SCTS
DT
VP
VPF
UDL
UD
UDHI
RP
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Mobile Terminated
Mobile Equipment
Type of Number
Message Reference
Originator Address
Destination Address
Recipient Address
Protocol Identifier
SRI
SRR
SRQ
RD
Reject Duplicate
ST
Status
PI
Parameter Identifier
MTI
GSM_SMS_Application_Note_V1.0
-7-
MMS
&b
Binary Format
&h
Hexadecimal Format
&d
Decimal Format
1.2. Overview
The SMS provides a way to transfer short messages between Mobile Stations (MS) via a Service
Center (SC). The SM services comprise three basic services:
SMS-Submit (SM-Mobile Originated): the module sends a SM to the SC.
SMS-Deliver (SM-Mobile Terminated): the module receives a SM from the SC.
SMS Status Report: the message which indicates whether a MO message is received by
destination address correctly.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Note:
Preparation before using Hyper Terminal:
1. Connect the EVB of the module to PC through a serial cable.
2. Start the Hyper Terminal procedure on computer, and set the same baud rate as the modules
(Default is auto bauding for module).
3. Make sure the Quectel module and the SIM card are assembled on EVB, then power on the
module.
Types of AT Commands and responses
Test Command
AT+<x>=?
Read Command
AT+<x>?
Write Command
AT+<x>=<>
AT commands are case-insensitive, but the parameters may be case-sensitive. And press
Enter (<CR>) to execute command.
In the examples of this document, the blue text are the commands or parameters which user
should input in Hyper Terminal, and text after // are descriptions, others are responses for
your input or URC.
Possible response maybe ERROR, +CME ERROR: <err>, or +CMS ERROR: <err>.
Please refer to [1] Mxx_ATC document for the meaning of error code <err>.
1.2.1.
There are two modes when using AT commands to send, receive, list, read and write message: text
mode and PDU mode. In text mode, you can write your message as text and set parameters for
GSM_SMS_Application_Note_V1.0
-8-
sending and receiving by some AT commands. In PDU mode, you must write your messages in
fixed hexadecimal format, which parameters are included in the PDU package.
The mode sets by command AT+CMGF. See table below.
Table 4: AT+CMGF Syntax
Command
Possible Response
Example
Comment
AT+CMGF=?
+CMGF: (0,1)
AT+CMGF?
+CMGF: <mode>
+CMGF: 0
AT+CMGF=<
mode>
OK
AT+CMGF=0
AT+CMGF=1
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Section 2 introduces how to send and read SM and status report in text mode. Section 3 introduces
AT commands in PDU mode. Section 4 introduces other AT commands related with SM.
1.2.2.
AT+CSCS sets character set <chset> used by the TE. The TA can then convert character strings
correctly between the TE and ME. The character set will affect transmission and reception of
SMS.
Command
Possible Response
Example
AT+CSCS=?
+CSCS: (list of
supported <chset>s)
+CSCS:
("GSM","HEX","IRA","PCCP437","UCS2","
8859-1")
AT+CSCS?
+CSCS: <chset>
+CSCS: "GSM"
AT+CSCS=<chset>
OK
AT+CSCS="GSM"
OK
(default)
Parameter <chset>
"GSM"
"HEX"
GSM default alphabet, 7-bit coded ([3] GSM 03.38 subclause 6.2.1, or Appendix
5.3 in this document).
Character strings consist only of hexadecimal numbers from 00 to FF.
"IRA"
"PCCP437"
"UCS2"
"8859-1"
Note:
For English message, recommend to select GSM in most cases. And for other
languages, its better to select UCS2. Unicode of characters can be found easily by some
GSM_SMS_Application_Note_V1.0
-9-
tools, for example, Windows charmap.exe, or Excel Symbol dialog. Please go to unicode.org
for more information about Unicode and UCS2. Also you can find mappings from
GSM/PCCP437/8859-1 to unicode.
1.2.3.
Service Center (SC) is responsible for the relaying and store-and-forwarding of a short message.
To use the SMS function you have to declare the number of the SMSC in the MS (Mobile Station).
However, SMSC is provided by network provider, and saved in SIM card as factory setting. It is
highly recommended that you do NOT change it at any time. And its better to check it
before sending short message.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Command
Possible Response
AT+CSCA=?
OK
AT+CSCA?
+CSCA: <sca>,<tosca>
AT+CSCA=<sca>[,<tosca>]
OK
Parameters:
<sca>
<tosca>
<tosca> uses <TOA> (Type of Address) decimal format (see [4]GSM 03.40 sub clause 9.1.2.5).
Example:
AT+CSCS?
+CSCS: "GSM"
OK
AT+CSCA?
+CSCA: "+8613800210500",145
OK
AT+CSCS="UCS2"
OK
AT+CSCA?
+CSCA: "002B0038003600310033003800300030003200310030003500300030",145
OK
Note:
Recommended to store every address in International numbering format to avoid problems
while roaming!
Ask your local network provider for the right SMSC number.
It is highly recommended that you do NOT change it at any time. And its better to
GSM_SMS_Application_Note_V1.0
- 10 -
1.2.4.
AT+CPMS selects memory storages to be used for reading, writing, receiving and etc.
Command
Possible Response
Example
AT+CPMS=
?
AT+CPMS?
+CPMS:
<mem1>,<used1>,<total1>,<mem2>,<use
d2>,<total2>,<mem3>,<used3>,<total3>
+CPMS:
"SM",10,50,"SM",10,50,"SM",10
,50
AT+CPMS=
[<mem1>
,<mem2>
,<mem3>]
+CPMS:
<used1>,<total1>,<used2>,<total2>,<used
3>,<total3>
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Parameters
<mem1>/<mem2>/<mem3>
<used1>/<used2>/<used3>
<total1>/<total2>/<total4>
Note:
The maximum number of short messages is 300, and the maximum number in module is 200,
and SIM card is preferred. So if SIM card can store 150 messages, the module can only store 150
messages.
GSM_SMS_Application_Note_V1.0
- 11 -
2.1.1.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Command
Possible Response
Example
AT+CSMP=?
+CSMP:
(17,49),(0-255),(0-255),(0255)
AT+CSMP?
+CSMP: <fo>,<vp>,<pid>,<dcs>
+CSMP: 17,167,0,241
AT+CSMP=[<fo>[<
vp>[,pid>[,<dcs>]]]]
OK
other language
+CSCS="GSM"
<dcs>=241
+CSCS="UCS2"
<dcs>=25
want to immediately
display message and
not store message
+CSCS="GSM"
<dcs>=240
+CSCS="UCS2"
<dcs>=24
Note
When writing message, +CSCS and <dcs> should match each other. For example, if you
select UCS2 character set by +CSCS, but set 7-bit coding schema in <dcs>, then messy code
may be gotten by SMS receiver.
The meaning of parameter <fo>,<vp>,<pid>,<dcs> is the same as which is in the PDU mode.
Their value and meaning are listed in the following section 3.5 Basic elements of the PDU.
And the difference is that decimal format is used in the parameters of +CSMP in text mode
while hexadecimal format is used in PDU mode.
GSM_SMS_Application_Note_V1.0
- 12 -
2.1.2.
Command
Possible Response
AT+CMGS=?
OK
AT+CMGS=<da>[,<tod
a>]<CR>
>text is entered
<ctrl-Z/ESC>
+CMGS: <mr>
or +CMS ERROR:
<err>
Example
Send English characters TEST to
13795403834:
AT+CSCS=GSM
AT+CMGS=13795403834
>TEST <Ctrl+Z>
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Send Chinese characters to
13795403834:
AT+CSCS=UCS2
AT+CMGS=
003100330037003900350034003000330038
00330034
>6D4B8BD5 <Ctrl+Z>
Parameters:
<da>
<toda>
<mr>
<Ctrl+Z> (Press Ctrl and Z simultaneously) is used to finish the inputting and begin to send short
message. Esc is used to cancel the operation.
Note:
If +CSCS=UCS2, <da> should be input in UCS2 format.
2.1.3.
Command
Possible Response
AT+CMGW=?
OK
AT+CMGW=<oa/da>[,<tooa/toda>[,<stat>]]<CR>
> <text is entered >
<ctrl-Z/ESC>
+CMGW: <index>
or +CMS ERROR: <err>
Parameters:
<da> <toda> and message text are the same as the AT command +CMGS.
<stat>: By default message status will be set to STO UNSENT, but parameter <stat>
allows STO SENT to be given.
GSM_SMS_Application_Note_V1.0
- 13 -
The message written by +CMGW will be stored in <mem2> (see +CPMS). The correct write
command will return the index in <mem2>, and then this message can be sent by AT command
+CMSS as below.
2.1.4.
Command
Possible Response
AT+CMSS=?
OK
AT+CMSS=<index>[,<da>[,<toda>]]
+CMSS: <mr>
OK
or +CMS ERROR: <err>
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Example:
AT+CMGW="15021012496"
> teset <Ctrl+Z>
+CMGW: 54
//Write message successfully and the index is 54
OK
AT+CMSS=54
+CMSS: 122
OK
AT+CMSS=54,"13795403834"
+CMSS: 123
OK
Note:
If <da> is given in this command, it shall be used instead of the one stored with the message,
that is, the message will be sent to <da> in this command.
No difference in PDU mode and text mode for +CMSS.
When short message is received, how to handle it (how to display URC, where to save) will be
decided by AT command +CNMI and message class type defined in <dcs>. User can read message
content from URC or +CMGR/+CMGL if saved. +CSDH will decide which information will be
displayed in text mode.
GSM_SMS_Application_Note_V1.0
- 14 -
2.2.1.
Command
Possible Response
Example
AT+CSDH=?
+CSDH: (0, 1)
AT+CSDH?
+CSDH: <show>
+CSDH: 0
AT+CSDH=[<show>]
OK
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
show
<show> defines whether to show header values defined in AT commands +CSCA and +CSMP
(<sca>, <tosca>, <fo>, <vp>, <pid> and <dcs>) nor <length>, <toda> or <tooa> in +CMT,
+CMGL, +CMGR result codes for SMS-DELIVERs and SMS-SUBMITs in text mode
Note:
This command only affects text mode.
2.2.2.
Command
Possible Response
Example
AT+CNMI=?
+CNMI:
(0-3), (0-3),
(0,2,3),
(0,1), (0,1)
AT+CNMI?
+CNMI: <mode>,<mt>,<bm>,<ds>,<bfr>
+CNMI:
2,1,0,0,0
(default)
AT+CNMI=[<mode>[,<
mt>[,<bm>
[,<ds>[,<bfr>]]]]]
OK
or
ERROR
TA selects the procedure for how the receiving of new messages from the network is indicated to
the TE when TE is active, e.g. DTR signal is ON. If TE is inactive (e.g. DTR signal is OFF),
message receiving should be done as specified in GSM 03.38.
<mode> controls the processing of URC specified within this command.
<mode> values: refer to below figure ([2]GSM07.05 Section 3 Figure 2)
GSM_SMS_Application_Note_V1.0
- 15 -
Buffer unsolicited result codes in the TA. If TA result code buffer is full, indications can
be buffered in some other place or the oldest indications may be discarded and replaced
with the new received indications.
Discard indication and reject new received message unsolicited result codes when
TA-TE link is reserved (e.g. in on-line data mode). Otherwise forward them directly to
the TE.
Buffer unsolicited result codes in the TA when TA-TE link is reserved (e.g. in on-line
data mode) and flush them to the TE after reservation. Otherwise forward them directly
to the TE. (Recommended, default)
Forward unsolicited result codes directly to the TE. TA-TE link specific inband
technique used to embed result codes and data when TA is in on-line data mode.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
<mt> values:
The rules for storing received SMs depend on <dcs>, preferred memory storage <mem3> setting
(+CPMS) and this value
0
GSM_SMS_Application_Note_V1.0
- 16 -
SMS-DELIVERs (except class 2) are routed directly to the TE using unsolicited result
code: +CMT: [<alpha>],<length><CR><LF><pdu> (PDU mode enabled)
or
+CMT: <oa>, [<alpha>],<scts>
[,<tooa>,<fo>,<pid>,<dcs>,<sca>,<tosca>,<length>]<CR><LF><data>
(text mode enabled; about parameters in italics, refer Command Show Text Mode
Parameters +CSDH).
Class 2 messages result in indication as defined in <mt>=1: +CMTI
Class 3 SMS-DELIVERs are routed directly to TE using unsolicited result codes defined
in <mt>=2: +CMT
Messages of other classes result in indication as defined in <mt>=1: +CMTI
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
<bfr> values:
0
TA buffer of unsolicited result codes defined within this command is flushed to the TE
when <mode> 1...3 is entered (OK response shall be given before flushing the codes).
TA buffer of unsolicited result codes defined within this command is cleared when
<mode> 1...3 is entered
Note:
Its strongly recommended to set <mode> as 2, in this way, the message indication will
not be lost. Its the default setting.
As to <mt>, if user wants to store the message, set it as 1 (AT+CNMI=2,1 default), then get
URC +CMTI: <mem>,<index> and read the message AT+CMGR=<index>. If user wants to
read the message directly, set it as 2 (AT+CNMI=2,2), then get the message content from
URC +CMT.
Please refer to [2]GSM 07.05 Clause 3 Figure 3 or appendix 5.2 in this document for message
receiving procedures.
2.2.3.
Command
AT+CMGR=?
OK
GSM_SMS_Application_Note_V1.0
- 17 -
AT+CMGR=<ind
ex>[,<mode>]
TA returns short message with location value <index> from message storage <mem1> (+CPMS)
to the TE.
<index>
<mode>
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Integer type; value in the range of location numbers supported by the associated
memory
0
Example:
AT+CSDH=0
AT+CSDH=1
AT+CMGR=6
+CMGR: "STO
UNSENT","",""
test
AT+CMGR=6
+CMGR: "STO
UNSENT","","",0,49,0,0,71,"",0,4
test
OK
OK
+CMTI: "SM",3
AT+CMGR=3
+CMGR: "REC
UNREAD","+86150210124
96","","2010/08/18
17:29:12+32"
test
OK
+CMT:
"+8615021012496",,"2010/0
8/18 17:32:02+32"
test
+CMTI: "SM",4
AT+CMGR=4
+CMGR: "REC
UNREAD","+8615021012496","","201
0/08/18
17:37:23+32",145,4,0,241,"+86138002
10500",145,4
test
+CMT:
"+8615021012496",,"2010/08/18
17:26:52+32",145,4,0,0,"+8613800210
500",145,4
test
Note:
The difference of text mode and PDU mode: only the response format.
GSM_SMS_Application_Note_V1.0
- 18 -
2.2.4.
Command
Possible Response
AT+CMGL=?
OK
or +CMS ERROR: <err>
AT+CMGL=<sta
t>[,<mode>]
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
The execution command AT+CMGL returns messages with status value <stat> from preferred
message storage <mem1> to the TE.
Parameters:
Text value
<state>
<mode>
PDU value
Description
"REC UNREAD"
"REC READ"
"STO UNSENT"
"STO SENT"
"ALL"
All messages
Normal
Example:
AT+CSDH=0
OK
AT+CMGL="ALL"
+CMGL: 1,"STO
UNSENT","15021012496","",
test
AT+CSDH=1
OK
AT+CMGL="ALL"
+CMGL: 1,"STO
UNSENT","15021012496","",,129,4
test
+CMGL: 2,"STO
SENT","15021012496","",
test
+CMGL: 2,"STO
SENT","15021012496","",,129,4
test
+CMGL: 3,"REC
READ","+8615021012496","","2010/08/18
17:29:12+32"
+CMGL: 3,"REC
READ","+8615021012496","","2010/08/18
17:29:12+32",145,4
GSM_SMS_Application_Note_V1.0
- 19 -
test
test
+CMGL: 4,"REC
READ","+8615021012496","","2010/08/18
17:37:23+32"
test
+CMGL: 4,"REC
READ","+8615021012496","","2010/08/18
17:37:23+32",145,4
test
OK
OK
Note:
The difference of text mode and PDU mode: the parameter <state> value and response
format.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Status report can be used to get information whether a short message is received by the target
address after its sent. If status report is needed, two parameters should be set in text mode:
1) AT+CNMI=2,1,0,1,0
//The forth parameter <ds> must be equals to 1
2) AT+CSMP=49,167,0,241 //The first parameter <fo> must be equals to 49
When the message is received, sender will get URC in text mode as below:
+CDS: <fo>,<mr>,[<ra>],[<tora>],<scts>,<dt>,<st>
Please refer to section 2.5 for example.
Command
Possible Response
AT+CMGD=?
+CMGD:(Range of SMS on
preferred storage <mem1>
can be deleted)
AT+CMGD=<index>[,<delflag>]
OK
+CMS ERROR:<err>
Example
+CMGD: (1-50)
TA deletes message(s) from preferred message storage <mem1> (+CPMS). If <delflag> is omitted
or equals to 0, it will delete message of location <index>. If <delflag> is present and not set to 0,
<index> is ignored and TA deletes all messages of one or more types. See table below.
Parameter <delflag>:
GSM_SMS_Application_Note_V1.0
- 20 -
0 or omitted
Note:
No difference for text mode and PDU mode.
2.4.2.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Command
AT+QMGDA=?
Possible Response
+QMGDA: (listed of
supported <type>s)
+CMS ERROR: <err>
Example
Text mode:
+QMGDA:("DEL READ","DEL
UNREAD","DEL SENT","DEL
UNSENT","DEL INBOX","DEL ALL")
PDU mode:
+QMGDA:(1-6)
AT+QMGDA=<type>
OK
ERROR
+CMS ERROR:<err>
TA deletes all messages with type value <type> from preferred message storage <mem1>
(+CPMS).
<type> parameters:
Text mode
PDU mode
Description
"DEL READ"
"DEL UNREAD"
"DEL SENT"
"DEL UNSENT"
"DEL INBOX"
"DEL ALL"
Note:
The difference of text mode and PDU mode: the parameter <type> value.
GSM_SMS_Application_Note_V1.0
- 21 -
2.5.1.
Send English short message(GSM coding) and not require status report
Receiver: +8613795403834
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
OK
OK
- 22 -
AT+CSDH=1
//More information will
be displayed if it equals 1.
OK
//Step 3: Send English short message
AT+CMGS="13795403834"
// Send
SMS: Enter the mobile phone
number directly. Enter message
content after > and end the input
by pressing Ctrl and Z
simultaneously.
>Hello<Ctrl+Z>
+CMGS: 140
OK
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
//Step 3: Receive and read short message
+CMTI: "SM",1
AT+CMGR=1
+CMGR: "REC
UNREAD","+8613651979176","","2010/09/0
1
11:11:47+32",145,4,0,241,"+8613800210500"
,145,5
Hello
OK
AT+CSCS="UCS2"
//if set character set as
UCS2, the message content will
be displayed in UCS2 format.
OK
AT+CMGR=1
+CMGR: "REC
READ","002B0038003600310033003600350
031003900370039003100370036","","2010/0
9/01
11:11:47+32",145,4,0,241,"002B0038003600
3100330038003000300032003100300035003
00030",145,5
00480065006C006C006F
OK
Note 1
The short message service center is provided by network provider, and saved in SIM card as
factory setting. It is highly recommended that you do not change it at any time. And its better
to check it before sending short message.
GSM_SMS_Application_Note_V1.0
- 23 -
Note 2:
The meaning represented by them is the same as the PDU mode parameters. The difference is that
the parameter must be input in decimal mode. The parameter 241 means that the short message
content is default in GSM coding and sent to <mem3> to store. If changed into 240, means that the
short message content is in GSM coding and sent to the destination terminal directly.
2.5.2.
Receiver: 13795403834
OK
OK
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
OK
- 24 -
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
OK
Note 1:
The meaning represented by them is the same as the PDU mode parameters. And the difference is
that the parameters must be input in decimal mode. The parameter 25 means that the short
message content is UCS2 coding and sends to <mem3> to store. If changed into 24, means that the
short message content is UCS2 coding and sends to destination terminal directly.
GSM_SMS_Application_Note_V1.0
- 25 -
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Command
Possible Response
AT+CMGS=?
OK
AT+CMGS=<length>
<CR>
PDU
is
given
<ctrl-Z/ESC>
+CMGS: <mr>
or +CMS ERROR:
<err>
Example
Note:
<pdu> includes all parameters for sending a message, such as the target address, type of
address, message content and settings of <+CSMP> in text mode. The structure of <pdu> is
represented in section 3.5.1SMS-Submit PDU Packet (MO)
<length> must match the actual length of <pdu>.
<length> equals to the number of octets of <pdu> excluding <SCA>. See section 3.5.1 Submit
PDU packet.
3.1.2.
Command
Possible Response
AT+CMGW=?
OK
AT+CMGW=<length>[,<stat>]<CR>
PDU is given <ctrl-Z/ESC>
+CMGW: <index>
+CMS ERROR: <err>
The parameter and <pdu> content are the same as above command <+CMGS>, but the message
will be saved to storage <mem2> (+CPMS) and not be sent.
The stored message can be sent by AT command +CMSS. There is no difference between PDU
GSM_SMS_Application_Note_V1.0
- 26 -
3.2.1.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Command
Possible Response
Example
AT+CMGR=<index>[,
<mode>]
+CMGR:
<stat>,[<alpha>],<length
><CR><LF><pdu>
AT+CMGR=5
+CMGR: 0,,24
0891683108200105F0040D916851200
12194F600F10180817144302304F4F2
9C0E
OK
See next AT command +CMGL for <stat> and <mode> value and meaning in PDU mode.
3.2.2.
Command
Possible Response
AT+CMGL=?
OK
Or +CMS ERROR: <err>
AT+CMGL=<sta
t>[,<mode>]
+CMGL:<index>,<stat>,[<alpha>],<length><CR><LF><pdu><CR><LF>
+CMGL: <index>,<stat>,[alpha],<length><CR><LF><pdu>[...]]
The execution command +CMGL returns messages with status value <stat> from preferred
message storage <mem1> to the TE.
Parameters:
Text value
<state>
PDU value
Description
"REC UNREAD"
"REC READ"
GSM_SMS_Application_Note_V1.0
- 27 -
"STO UNSENT"
"STO SENT"
"ALL"
All messages
Normal
<mode>
Example:
AT+CMGL=4
+CMGL: 1,2,,18
0011FF0B815120012194F600004704F4F29C0E
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
+CMGL: 2,3,,18
00117E0B815120012194F600004704F4F29C0E
+CMGL: 3,1,,24
0891683108200105F0040D91685120012194F600F10180817192212304F4F29C0E
+CMGL: 4,1,,24
0891683108200105F0040D91685120012194F600F10180817173322304F4F29C0E
OK
Same as text mode, user can delete one or more short messages by AT command +CMGD, or
delete all short messages with <type> by AT command +QMGDA. The difference is <type> value
in command +QMGDA, see above section 2.4.
- 28 -
number of octets
1-12
2-12
0,1 or 7
0-140
Element
SCA
FO
MR
DA
PID
DCS
VP
UDL
UD
3.5.2.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
number of octets
1-12
2-12
0-140
Element
SCA
FO
OA
PID
DCS
SCTS
UDL
UD
3.5.3.
number
of octets
Element
1-12
2-12
0140
SCA
FO
MR
RA
SC
TS
DT
ST
PI
PID
DC
S
UD
L
UD
3.5.4.
Element descriptions
&b
&h
&d
0001
81
129
Unknown
001
0001
91
145
010
0001
A1
161
National number
TON
NPI
000
1
1
Description
Please refer to GSM 04.08 subclause 10.5.4.7 Called party BCD number for details of TON (Type
of Number) and NPI (Numbering plan identification).
- 29 -
Element
SCA length
Example(&h)
08
TOA
91
SCA
683108200105F0
Above example shows <sca> address +8613800210500 (SCA of China Mobile in Shanghai).
Parameters:
SCA length = 8 = 1 (octets length of TOA) + 7 (octets length of SCA)
TOA = 91: The address is international number (Begin with +).
SCA = 683108200105F0: Service Center Address. Number formatting rule:
1) One octet includes two BCD-digit Fields.
2) If the digits number is odd, the last digit shall be filled with F&h.
3) Switch every two digits from beginning.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Original number
86 13 80 02 10 05 0(F)
after formatting
68 31 08 20 01 05 F0
Note:
When sending message (SMS-Submit), if <SCA> sets as 00, the address of AT command
<+CSCA> will be used. It is highly recommended that you do NOT change it at any time.
And its better to check it before sending short message.
Element
Example(&h)
Address length
TOA
OA/DA/RA
0D
91
683197453038F4
Parameters:
Address length = 0D&h = 13&d = number of digits of <OA>/<DA>/<RA> (8613795403834)
<OA>/<DA>/<RA>: the address format is the same as above field <SCA>
Note:
If TOA does not match with address, short message maybe fail to send.
Recommended to store every address in International numbering format to avoid problems
while roaming!
First Octet includes some properties of the message, for example, the message type (MTI) Its a
SMS Submit, SMS Deliver or SMS Status report; request status report or not (SRR) when send a
message; present VP(Validity Period) or not and its format(VPF), etc.
Table 28: <FO> elements
Bit
SMS-Submit
RP
UDHI
SRR
VPF
SMS-Deliver
RP
UDHI
SRI
GSM_SMS_Application_Note_V1.0
RD
MTI
MMS
MTI
- 30 -
SMS-Status
Report
RP
UDHI
SRQ
MMS
MTI
<FO> parameters
Value
(bit)
Parameter
User Data
Header
Indicator
Status Report
Indication
Status Report
Request
00
01
Enhanced VP format
10
11
00
01
SMS-Submit
10
SMS-Status Report
10
RP
Reply Path
UDHI
SRI
SRR
SRQ
VPF
MMS
RD
MTI
Meaning
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Status Report
Qualifier
Validity Period
Format
More Messages
to Send
Reject
Duplicates
Message Type
Indicator
&h
&d
Bit 7
RP
UDHI
SRR
GSM_SMS_Application_Note_V1.0
3
VPF
2
RD
0
MTI
- 31 -
0
00010001
11
17
10
No header
in UD
not request
status report
VP relative
format
10
No header
in UD
request
status report
VP relative
format
0
00110001
31
49
01
SMS-Submit
01
SMS-Submit
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
The PID is the information element by which the transport layer either refers to the higher layer
protocol being used, or indicates interworking with a certain type of telematic device.
Table 29: <PID>
<PID> value
&h
00
01
Protocol
&d
0
<DCS> identifies the coding scheme within the User Data (UD). It comprises one octet and may
indicate the message class, alphabet, etc. Please refer to [3] GSM 03.38 for details.
Table 30: <DCS>
bit7-4
00xx
( general data
coding
indication)
1111
Meanings
default alphabet
8 bit alphabet
Reserved
GSM_SMS_Application_Note_V1.0
(data coding
message class)
default alphabet
8-bit data
0
Message Class indicates how to store message when its received. Class 0 message is displayed
directly in the destination terminal, not stored. If you want to store it in SIM, you can use AT
command +QCLASS0.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Default alphabet indicates the user data is coded from the 7-bit alphabet.
Example
&b
&h
&d
character coding
message class
00000000
00
7-bit
no class
00001000
08
UCS2
no class
00011000
18
24
UCS2
00011001
19
25
UCS2
class 1 (ME-specific)
11110000
F0
240
7-bit
11110001
F1
241
7-bit
class 1 (ME-specific)
<VP> identifies the time period for which the short message is valid in the SMSC. Its format is
defined in <VPF> of <FO> field.
When <VPF> is relative format (<VPF>=10&b), <VP> comprises 1 octet, which illustrates the
period between the time when SC receives the SM and SC discards the SM.
Table 31: <VP> relative format
<VP> value
&h
00 to 8F
&d
0 to 143
(VP+1)*5 minutes
5 minutes to 12 hours
144 to 167
A8 to C4
168 to 196
(VP-166)*1 day
2 days to 30 days
C5 to FF
197 to 255
(VP-192)*1 week
5 weeks to 63 weeks
90 to A7
GSM_SMS_Application_Note_V1.0
- 33 -
Year
Month
Digits(Semi-octets)
Example
01
80
Day
Hour
Minute
Second
Time Zone
12
41
14
80
23
The Time Zone expressed in quarters of an hour, between the local time and GMT. The above
example shows time 10-08-21 14:41:08+32, GMT +08.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
The TP-Discharge-Time field indicates the time at which a previously submitted SMS-SUBMIT
was successfully delivered to or attempted to deliver to the recipient SME or disposed of by the
SC.
SMS UDL
meaning
character table
Default(GSM 7-bit)
Number of
characters
see [3]GSM03.38
8-bit data
Number of octets
user specific
Number of octets
ISO/IEC10646 Universal
Multiple-Octet Coded Character Set
(UCS)
<dcs>
UCS2
16
Note:
For GSM 7-bit coding, UDL equals to the number of characters, it does NOT equal to the number
of octets.
If <UDHI> equals 0 (no header in <UD>) and message is not compressed, the maximum
individual Short Message sizes of 160 7-bit characters, 140 8-bit characters, or 70 16-bit
characters (1120 bits = 160*7 = 140*8 = 70*16).
General characters in English can be found in GSM alphabet table ([3] GSM 03.08 subclause 6.2.1
Default alphabet or appendix 5.3 in this document), and so can be encoded using GSM 7-bit
encoding. Characters in languages such as Arabic, Chinese, Korean, Japanese or Cyrillic alphabet
languages (e.g. Russian, Serbian, Bulgarian, etc) must be encoded using the 16-bit UTF-16
character encoding.
Please refer to [3] GSM 03.08 subclause 6.1.2.1.1 for SMS point-to-point packing of 7-bit
characters.
GSM_SMS_Application_Note_V1.0
- 34 -
GSM coding(hex)
31
32
33
34
35
36
37
38
GSM coding(bit)
0110
001
0110
010
0110
011
0110
100
0110
101
0110
110
0110
111
0111
000
0011
0001
1101
1001
1000
1100
0101
0110
1011
0011
1101
1101
0111
0000
31
D9
8C
56
B3
DD
70
So for string 12345678, UD = 31D98C56B3DD70 and UDL=8 (note its the number of
characters, not number of octets).
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
ST indicates the status of a previously submitted SMS-SUBMIT when a status report has been
requested. It consists of one octet. If it equals to 00&h, that means short message has been
received.
User can send the English and Chinese short message in PDU mode as follows.
3.6.1.
Send English short message(GSM coding) and not require status report
Receiver: +8613795403834
GSM_SMS_Application_Note_V1.0
OK
- 35 -
AT+CMGF=0
OK
OK
AT+CNMI=2,1,0,0,0
// Set parameters
for new message indication. 1
get indication +CMTI
OK
AT+CPMS?
//Check if short message
storage is full. If it has been full,
delete some messages by AT
command +CMGD or +QMGDA.
+CPMS: "SM",1,50,"SM",1,50,"SM",1,50
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
OK
1-12
2-12
0,1 or
7
0-140
Element
SCA
FO
MR
DA
PID
DCS
VP
UDL
UD
Example
00
11
00
0D91683197
453038F4
00
00
01
05
C8329
BFD06
- 36 -
&b
&h
00010001
11
&d
Bit 7
RP
UDHI
SRR
VPF
RD
MTI
10
01
No header
in UD
not request
status report
VP relative
format
17
SMS-Sub
mit
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Character
GSM coding(hex)
48
65
6C
6C
6F
GSM coding(bit)
1001000
1100101
1101100
1101100
1101111
11001000
00110010
10011011
11111101
00000110
C8
32
9B
FD
06
SMS-DELIVER PDU:
number of
octets
1-12
2-12
0-140
Element
SCA
FO
OA
PID
DCS
SCTS
UDL
UD
04
0D9168315
6919771F6
00
0190102
1912523
05
C832
9BFD
06
Example
0891683108
200105F0
00
SMS-Deliver
RP
UDHI
SRI
Example
3
00
2
MMS
01
0
MTI
00
UDHI = 0: no header in UD
MMS = 1: No more messages are waiting for the MS in this SC
GSM_SMS_Application_Note_V1.0
- 37 -
3.6.2.
Receiver: +8613795403834
OK
OK
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
- 38 -
OK
//Step4: Get status report
+CDS: 26
0891683108200105F006930D916831974530
38F4019010314291230190103142912300
//See below Note 3 for descriptions
Note 1: Descriptions for SMS-SUBMIT PDU:
AT+CMGS=19
> 0031000D91683197453038F40008010460A8597D <Ctrl+Z>
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
SMS-SUBMIT PDU:
number of
octets
1-12
2-12
0,1 or
7
0-140
Element
SCA
FO
M
R
DA
PID
DCS
VP
UDL
UD
00
31
00
0D916831974
53038F4
00
08
01
04
60A8597
D
Example
&h
&d
Bit 7
RP
UDHI
SRR
00110001
31
49
VPF
RD
MTI
01
10
No
header
in UD
request
status
report
VP relative
format
SMS-Submit
1-12
2-12
0-140
Element
SCA
FO
OA
PID
DC
S
SCTS
UD
L
UD
GSM_SMS_Application_Note_V1.0
- 39 -
Example
08916831082
00105F0
24
0D9168315
6919771F6
00
0190103
1424123
08
60A859
7D
04
SMS-Deliver
RP
UDHI
SRI
Example
3
-
MMS
00
0
MTI
01
00
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
UDHI = 0: no header in UD
SRI = 1: A status report will be returned to the SME
MMS = 1: No more messages are waiting for the MS in this SC
1-12
2-12
Element
SCA
FO
MR
RA
SCTS
DT
ST
0891683108
200105F0
06
93
0D9168319745
3038F4
01901031
429123
01901031
429123
00
Example
SMS-Status
report
RP
UDHI
SRQ
Example
00
MMS
01
MTI
10
UDHI = 0: no header in UD
SRQ = 0: The SMS-Status-Report is the result of a SMS-Submit
MMS = 1: No more messages are waiting for the MS in this SC
GSM_SMS_Application_Note_V1.0
- 40 -
4.1.1.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Command
Possible Response
AT+CSAS=?
AT+CSAS=[<profile>]
OK
ERROR
Example
+CSAS: (0-3)
Parameter:
<profile>
0-3
Execution command saves active message service settings to a non-volatile memory. A TA can
contain several profiles of settings. Settings specified in AT commands Service Centre Address
+CSCA and Set Message Parameters +CSMP are saved.
4.1.2.
Command
Possible Response
AT+CRES=?
AT+CRES=[<profile>]
OK
ERROR
Example
+CRES: (0-3)
4.1.3.
- 41 -
+CSDH
+CSCS
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Example:
//Send a long message
AT+CMGF=1
// Set the short message mode as TEXT mode
OK
AT+CSCS=GSM
// Set the character mode as GSM mode.
OK
AT+CSMP=17,167,0,241
// Set parameters for sending short message in text mode
OK
AT+CMGS=13795403834
> Focusing on the wireless M2M market sector, Quectel designs and manufactures variety
wireless modules to fulfill different industrial standards and requirements. The Quectel
products have been applied in the wireless M2M sectors like telematics, telemetry, remote
control and monitoring, fleet management, wireless POS, security, healthcare, etc.
//The message length is 347, larger than the maximum length of a single short
message 152. So it will be divided to three messages (length 152+152+43) to
send, and merged when receiving.
+CMGS: 156
OK
+CMTI: "SM",5
AT+CMGF=1
OK
AT+CMGR=3
+CMGR: "REC UNREAD","+8613651979176","","2010/09/01 15:01:54+32"
Focusing on the wireless M2M market sector, Quectel designs and manufactures variety
wireless modules to fulfill different industrial standards and requirements. The Quectel
products have been applied in the wireless M2M sectors like telematics, telemetry, remote
GSM_SMS_Application_Note_V1.0
- 42 -
control and monitoring, fleet management, wireless POS, security, healthcare, etc.
//Three parts are merged to display in the first message.
OK
AT+CMGR=4
+CMGR: "REC READ","+8613651979176","","2010/09/01 15:01:52+32"
irements. The Quectel products have been applied in the wireless M2M sectors like
telematics, telemetry, remote control and monitoring, fleet management
//Second part, 152 characters
OK
AT+CMGR=5
+CMGR: "REC READ","+8613651979176","","2010/09/01 15:01:54+32"
, wireless POS, security, healthcare, etc.
//Third part, 43 characters
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
OK
AT+CMGD=3
//If delete the first message, three messages of this long message will be deleted
OK
AT+CPMS?
+CPMS: "SM",2,50,"SM",2,50,"SM",2,50
OK
4.3. Store Class 0 SMS to <mem3> When Received Class 0 SMS (+QCLASS0)
As normal class0 message (set in <dcs>) will be displayed immediately in the terminal. Using AT
command +QCLASS0, Quectel module can store this kind of message.
Table 35: AT+QCLASS0 syntax
Command
Possible Response
AT+QCLASS0=?
+QCLASS0: (0, 1)
AT+QCLASS0?
+QCLASS0: <mode>
AT+QCLASS0=[<mode>]
OK
ERROR
Parameter <mode>
0
Disable to store Class 0 SMS to <mem3> when received Class 0 SMS (default)
Example
//Send class 0 message
AT+CMGF=1
// Set the short message mode as TEXT mode
OK
GSM_SMS_Application_Note_V1.0
- 43 -
AT+CSCS=GSM
// Set the character mode as GSM mode.
OK
AT+CSMP=17,167,0,240
// Set parameters for sending short message in text mode.
<DCS>=240 stands for a class0 message
OK
AT+CMGS=13795403834
>TEST CLASS0 MESSAGE<Ctrl+Z>
+CMGS: 160
OK
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Command
Possible Response
GSM_SMS_Application_Note_V1.0
- 44 -
AT+QSMSCODE=?
+QSMSCODE:(0,1)
AT+QSMSCODE?
+QSMSCODE:<mode>
AT+QSMSCODE=<mode>
OK
ERROR
Parameter <mode>
0
Note:
Set AT+CMGF=1, AT+CSCS=GSM, <dcs> (+CSMP) as GSM-7-bit coding before using
this command.
Use the same setting for sender and receiver.
This command is still not able to make sure all special characters are shown correctly. The
best method is to use UCS2 coding.
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
+QEXTUNSOL is provided to enable/disable proprietary unsolicited indications. User can use this
command to get the notification for SMS full as the following format.
AT+QEXTUNSOL=SM ,<mode>
<SM> stands for additional SMS Information. Displays additional information about SMS events
in the form of Unsolicited messages of the following format.
+TSMSINFO: <CMS error info>
where <CMS error info> is a standard CMS error in the format defined by the AT+CMEE
command i.e. either a number or a string.
<mode> parameter
0
Disable (default)
Enable
Query
Example:
AT+QEXTUNSOL=SM,1
OK
AT+CPMS?
+CPMS: "SM",49,50,"SM",49,50,"SM",49,50
OK
+CMTI: "SM",50
//Short messages are full, get below URC:
GSM_SMS_Application_Note_V1.0
- 45 -
+TSMSINFO: 322
//Restart module
+TSMSINFO: 322
+TSMSINFO: 3513
// memory full
// memory full
//unread records on SIM
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
- 46 -
5. Appendix
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
- 47 -
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
- 48 -
l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
GSM_SMS_Application_Note_V1.0
- 49 -
GSM_SMS_Application_Note_V1.0
- 50 -