GSM's at Operation Command 20160615

Source: Internet
Author: User

Due to the work exposure to the GSM module, so gathered a bit about the operation of the GSM module at command information:

The history and application of 1.AT

History of 1.1 at
The AT command set is a control protocol invented by the inventor of the dial-up modem (modem) (Hayes) in order to control the modem invention. At is an abbreviation for attention,
The protocol itself uses text. Each command is preceded by an at and is therefore named. This history is Http://en.wikipedia.org/wiki/Hayes_command_set

With the network upgrade to broadband, the speed is very low dial modem basically has exited the general use of the market. The last time I saw a dial modem, it was Shenzhen.
Network tax filing system. It is necessary to dial to the Inland Revenue server for use. It was in this very small market that only a little space was left. The rest is generally used ADSL
Modem.

He company, like many inventions great products of the company, in the invention of the epoch-making modem products, no further upgrade technology. It is now in 1999
Years of bankruptcy disappeared, similar examples of the invention of the browser Netscape, the first to become a network operating system Novell, is now marginalized.
On the bankruptcy of Hayes, we can find a old news http://news.sina.com.cn/richtalk/news/tech/9901/010704.html
But interesting, http://www.hayes.com is still selling products, hard to come back to life?

But the at command was preserved. The major mobile phone manufacturers Nokia, Ericsson, Motorola and HP jointly developed a complete set of at directives for GSM, with
GSM module for mobile phone control. This includes the control of SMS. the AT command evolves on this basis and is added to GSM 07. The 05 standard and the current GSM07. -
Standard.
In the subsequent GPRS control, the 3G module, as well as the industrial common PDU, are controlled by the AT command set, so that at the command actually on these products become the thing
The real standard.

The advantages of 1.2 at.

Command simple and easy to understand, and the use of standard serial port to send and receive at commands, so that the device control greatly simplified, converted into a simple serial programming.
The AT command provides a standard set of hardware interfaces-the serial port. This simplified hardware design. Newer telecom network module, almost all adopt serial port hardware interface.
At command function is full, can complete the control of the device through a set of commands, complete the call, text message, telephone book, data service, fax.

The relationship between 1.3 at command and PPP protocol

In the application of data communication, such as wireless dial-up Internet. In addition to the AT command, you will often hear another network protocol PPP (Point-to-point
Protocol).

In the application of serial communication, we can clearly see from the hardware divided into two chunks.

DTE (data Terminal equipment) terminal equipment. Typically a smart device, such as a PC, an embedded host, etc., used to send the AT command and
PPP command,
There is also a DCE (data circuit Terminal) Data circuit terminal for link communication. A link used to establish communication with the outside world.
The DTE and DCE are connected by a serial port. For example, when a PC uses a serial port to dial modem, the PC is DTE, and the dial modem is DCE.

At and PPP are the same points that are sent by DTE to the DCE protocol. the difference is that the at is used only for DTE to control DCE. such as initializing the device for sending calls,
Send short messages, etc., although at is standard, most DTE producers extend some at commands.

While PPP is used for data communication , it is the protocol that DTE communicates with the Remote access server (Access server). is a data Link layer association that belongs to the network communication
, theDCE itself receives a PPP packet that, in addition to being modulated to the physical layer, is sent to the remote server itself and does not handle the contents of PPP itself .

2.AT command format
at instruction format: At directives are all beginning with "at", with <CR> (that is, \ r, carriage return) end, after the module runs, the serial port default setting is: 8 bit data bits, 1 bit
stop bit, no parity bit, hardware flow control (cts/ RTS).
Note In order to send the AT command, and finally add <LF> (that is \ n, line break) This is the serial terminal requirements.
There are some commands that can be appended with additional information. such as phone number

after each at command executes, DCE usually gives the status value, which is used to determine the result of the command execution.
The
at return status includes three case Ok,error, and the command-related error reason string. There is a <CR> character before and after the return status.
such as <CR>OK<CR> indicates that the AT command was successful.
<CR>ERROR<CR> indicates that the AT command failed to execute
<cr>no DIAL tone<cr> only appears in the ATD command return state, indicating that there is no dial tone, and that such return status is checked in the command manual

Some of the commands themselves are to query the DCE for data, and when the data returns, it is usually the + command. Returns the format
<cr>+ command: command result <cr>
For example: at+cmgr=8 (get 8th information)
return +cmgr: "REC unread", "+8613508485560", "01/07/16,15:37:28+32", Once more

3.DCE status switch with at command dialing process

Both protocols are DTE sent to DCE via the serial port. How does the DCE differentiate between the AT command and how the PPP protocol package is distinguished? Most DCE uses a split-time transfer
, two protocols are not sent at the same time. However, you can use the AT command two dedicated commands to toggle whether the AT Command window or PPP protocol window.

The command state is called when the AT command is sent, when the PPP packet is sent or when the voice communication is called the data state.

In modem device boot into, default to enter at command receive State , with ATDN; command dial out phone number n (voice dialing); Atdn Dial out phone number n (number
According to the dial), the difference is that the former has a semicolon. After dialing with data dial , the PPP interaction state is entered. when you need to cut back to receive the AT command state, the DTE
You need to send the + + command to the DCE. While keeping it online, the receive is at command . If the link needs to be severed at this point, the ath Hang command is sent.
Note that sending + + + requires a second time before and after each . Otherwise it will be sent out as data.

the ATO switches the online command to the data receiving State .

A DCE dial-up process is

3.1. Initialize the DCE modem device
The primary DTE configures the serial port parameters and sends some AT commands to the device to initialize the settings

The "atz\r" command is required to perform a soft reset;
Suppress command echo need to execute "ate0\r" command;
To make the return result code in the form of a number, "atv0\r" should be executed;
You need to set the S register to perform "atsn=x\r" and so on.

3.2 Dial-up connection
At dial-up connection, voice dial connection and data dial connection. The Voice dialing command is "atdn;\r" (note with a semicolon); The data dialing command is "atdn\r
(note without a semicolon). The connection successfully returned "\r\nconnectxxxx/rlp\r\n", where xxxx represents the connection rate. Here we only discuss the data dial
Number of connections. Note that the dial-up connection takes a certain amount of time, programming should be based on the actual situation of the appropriate delay waiting.

3.3 Data transfer and processing
After the connection is established, the user can send, receive and manipulate data via DCE. At this time to send data is simply to write the serial port, data collection
is the read serial port, even if the data contains the AT command string DCE will not be processed. The PPP dialing process is now in progress.

3.4 Switch from data State to online command status
After the data is sent and received, the DCE should be switched from the data state to the online command state. send a code sequence command "+ + +" to the DCEand have at least
a second delay (without sending data to TC35) allows DCE to switch from the data state to the online command state, otherwise Dec will send "+ + +" as data.
send "ato\r" in the offline command state to return to the data state .
3.5 Hanging up connection
Hang up connection (that is, hang up) is send "ath\r" to DCE

4. Common at command

The AT command of different producers is much the same, but there is still a difference, generally depends on the product manual, such as the following producers of
Siemens Tc35i's Http://www.sendsms.cn/download/TC35i_AT_C.pdf
Nokia's Http://wiki.forum.nokia.com/index.php/AT_Commands
Huawei CM300 Http://www.sangrong.com/download/cm300.pdf

Here is a list of some common at commands

4.1 Basic operations

1.1 at
Command explanation: Check whether module and serial port is connected, can receive at command;
Command Format:at<cr>
Command return: OK (communication with serial port normal) (no return, communication with the serial port is not connected)

1.2 AT+CSQ
Command explanation: Check network signal strength and SIM card status
Command Format:at+csq<cr>
Command return: +CSQ: **,##
where * * should be between 10 and 31, the larger the value indicates the better the signal quality, # #应为99.
Otherwise you should check that the antenna or SIM card is properly installed
Test result:at+csq<cr>
+CSQ:31, 99
The signal strength value will change slightly, by hand cover the antenna, the signal strength value will drop (approximately 26).
1.3 ATZ
Command explanation: Restore factory settings
Command Format:atz<cr>
Command return: OK

1.4 AT+CGMR
Command Explanation: Query module version;
Command Format:at+cgmr<cr>
Command return: <revision >
+cmeerror <err>
Test result:at+cgmr<cr>
r4a021 CXC1122528
Ok
Explanation: The module version number is r4a021

1.5 AT+IPR
Command explanation: Modify the serial port 1 baud rate;
Command format: At+ipr=<value ><CR>
Command return: ERROR
Ok
Test result:at+ipr=19200<cr>
Ok
Note: The serial port baud rate is modified to 19200 to set the baud rate of the serial debugging tool to the corresponding
The module will return after the baud rate

1.6 At&w
Command Explanation: Save module settings;
Command Format:at&w<cr>
Command return: OK
ERROR (save not successful)
Test Result: At&w <CR>
Ok

4.2. Call operation


2. 1ATD
Command explanation: Make a phone call
Command Format:atd**********;<cr> (* * * = phone number)
Command return: OK
No DIAL TONE (no dial tone)
No CARRIER (no carrier)
Test result: A. Atd13510090403;<cr>
Ok
The call was successful;
B. atd13510090403;<cr>
NO DIAL TONE
The antenna is not connected well, the contact is bad;
C. atd13510090403<cr>
NO CARRIER
Command error, missing {;} ;
2.2 RING
Command explanation: There is a phone call in
Command format:
Command return: None

2.3 ATA
Command explanation: Off-hook
Command Format:ata<cr>
Command return: OK
Test Result: RING
RING
Ata<cr>
Ok
Answer phone calls;

2.4 ATH
Command explanation: Hanging machine
Command Format:ath<cr>
Command return: OK
Test result:ath<cr>
Ok
The phone hangs up (during the call);

2.5 at+chup
Command explanation: Hanging machine
Command Format:at+chup<cr>
Command return: OK
Test Result: RING
Ath<cr>
Ok
The phone hangs up (not yet connected to the incoming call);

2.6at+vts
Command explanation: Dialing an extension
Command format: at+vts= "extension number" <CR>
Command return: OK
Test results:
at+vts= "0" <CR>
Ok

4.3. SMS operation

SMS operation steps and Related commands:
(1) Set SMS format--AT+CMGF
(2) Set SMS storage carrier--AT+CPMS
(3) Set SMS receiving prompt mode--at+cnmi
(4) Send SMS--at+cmgs
(5) Display SMS--AT+CMGL

3.1 At+cpms
Command explanation: Select SMS Storage Carrier

3.1.1 Command format: AT+CPMS=&LT;MEM1&GT;[,&LT;MEM2&GT;][,&LT;MEM3&GT;]
Set up SMS Storage vectors
Command returns:+cpms:<used1>,<total1>,<used2>,<total2>,<used3>,<total3>
Ok
ERROR
Test result: A. At+cpms= "SM"
+cpms:8,15,8,15,1,40
Ok
The setting is successful and the status is displayed: SM (SIM card) memory Total capacity is 15, current storage 8;
ME (module) memory Total capacity is 40, the current storage 1;mem1 is defined as SM;
B. at+cpms= "SM", "SM"
+cpms:8,15,8,15,1,40
Ok
The setting is successful and the status is displayed: The total capacity of SM memory is 15, the current storage is 8;
The total capacity of the Me memory is 40, and the current storage 1;mem1 is defined as SM;MEM2
defined as SM;
C. at+cpms= "SM", "SM", "SM"
+cpms:8,15,8,15,8,15
Ok
The setting is successful and the status is displayed: The total capacity of SM memory is 15, the current storage is 8;
The total capacity of the Me memory is 40, and the current storage 1;mem1 is defined as SM;MEM2
defined as Sm;mem3 defined as SM;
D. at+cpms= "ME", "SM", "SM"
+cpms:1,40,8,15,8,15
Ok
The setting is successful and the status is displayed: The total capacity of SM memory is 15, the current storage is 8;
The total capacity of the Me memory is 40, and the current storage 1;mem1 is defined as ME;MEM2
defined as Sm;mem3 defined as SM;
E. at+cpms= "Me", "SM", "Me"
+cpms:1,40,8,15,1,40
Ok
The setting is successful and the status is displayed: The total capacity of SM memory is 15, the current storage is 8;
The total capacity of the Me memory is 40, and the current storage 1;mem1 is defined as ME;MEM2
defined as Sm;mem3 defined as me;
F. at+cpms= "ME
ERROR
Bad command format, missing {"};

3.1.2 Command format: At+cpms?
Display current SMS storage vector settings
Command return: +CPMS:<MEM1>,<USED1>,<TOTAL1>,<MEM1>,<USED2>,<TOTAL2>
<mem1>,<used3>,<total3>
Ok
ERROR
Test result: A. At+cpms?
+cpms: "SM", 8,15, "SM", 8,15, "ME", 1,40
Ok
The current SMS storage carrier is set to: Mem1 to SM,MEM2 for SM,MEM3
For me;
B. at+cpms!
ERROR
Command error;

3.1.3 Command format: at+cpms=?
Show supported parameters for this command
Command return: +cpms: (List of Supported<mem1>s), (List of supported<mem2>s),
(List of Supported<mem3>s)
Ok
ERROR
Test Result: at+cpms=?
+cpms: ("Me", "SM"), ("Me", "SM"), ("Me", "SM")
Ok

3.2 AT+CMGF
Command explanation: Set SMS Format
3.2.1 Command Format:at+cmgf=<mode>
Command return: OK
ERROR
Set SMS Format

3.2.2 Command format: at+cmgf=?
Command return: OK
ERROR
Show supported parameters for this command

3.2.3 command format: AT+CMGF?
Command return: OK
ERROR
Show current SMS format
Test result: at+cmgf=?
+CMGF: (0,1)
OK
AT+CMGF?
+cmgf:0
OK
at+cmgf=1
OK
AT+CMGF?
+cmgf:1
OK

3.3 at+cmgs
Command explanation: Send SMS
Command format: at+cmgs=<da>[,<toda>]<cr>
Text is entered<ctrl-z/esc>
Command return: +cmgs:<mr>[,<scts>]
+cms error:<err>
OK
ERROR
Test result: A. At+cmgs=13510090403<cr>
>abcd1234.456<ctrl-z>
+cms error:500
Command error;
B. at+cmgs= " 13510090403 "<CR>
> IT is TEST now<ctrl-z>
+cmgs:235
OK

3.4 At+cmgr
Command explanation: Read SMS
Command Format:at+cmgr=<indes>
Command returns:+cmgs:<stat>,[<alpha>],<length>]<cr><lf><pdu>
+cms error:<err>
Ok
ERROR
Test result: A. At+cmgr=5
+cms error:500
Command error, 5th SMS location is empty;
B. at+cmgr=2
+cmgl:2, "REC READ", "+8613682326205", "N?" R "," 03/08/28 17:30:35+00 "
998b76844f60002e518d5fcd5fcd5427+cmgs:235
Ok
Read the 2nd SMS;

3.5 AT+CMGW
Command explanation: Write a text message and save to the storage carrier
Command Format:at+cmgw=<length>[,<stat>]<cr>
Command returns:+cmgs:<index>
+cms error:<err>
Ok
ERROR
Test Result: at+cmgw= "13534139079" <CR>
> shelley123456<ctrl-z>
+cmgw:1
Ok
Send SMS with target address 13534139079 to storage carrier and assigned address
For SMS 1th;

3.6 AT+CMGD
Command explanation: Delete SMS
Command Format:at+cmgd=<index>
Command return: +cms error:<err>
Ok
ERROR
Test Result: at+cmgd=1
Ok
SMS 1th is deleted;

3.7 AT+CMGL
Command explanation: Show SMS List
Command Format:at+cmgl=<stat>
Command return: +CMGL:<INDEX1>,<STAT>,<OA/DA>,[<ALPHA>],[<SCTS>] [,<tooa/toda>,< Length>]
<CR><LF><data>[<CR><LF>
Test results: See the total test results;

3.8 At+cmss
Command explanation: Send SMS in the storage carrier
Command Format:at+cmss=<index>
Command returns:+cmss:<mr>
+cms error:<err>
Ok
ERROR
Test Result: at+cmss=2
+cmss:204
Ok

3.9at+cnmi
Command explanation: New SMS Prompt
3.9.1 command format: AT+CNMI=[<MODE>[,<MT>[,<BM>[,<DS>]]
Command return: OK
ERROR
Test Result: at+cnmi=3,2
Ok

3.9.2 command format: At+cnmi?
Command returns:+cnmi:<mode>,<mt>,<bm>,<ds>
Ok
ERROR
Test Result: At+cnmi?
+cnmi:3,2,0,0
Ok

3.9.3 command format: at+cnmi=?
Command returns: +cnmi: (List of Supported<mode>s), (List of Supported<mt>s), (List of supported<bm>s),
(List of Supported<ds>s)
Ok
ERROR
Test Result: at+cnmi=3,2
Ok

4.4. Voice part:

4. 1 at*e2eams
Command explanation: Set audio working parameters (modify voice channel)
4.1.1 Command format: At*e2eams=<op >,<num >,<val >
Command return: OK
ERROR
The test result:<op> is n between 1-20, which indicates that the nth parameter is set
at*e2eams=9,2 (Set the module's voice mic channel to the handle)
Ok
at*e2eams=10,2 (Set the voice SPK channel of the module to the handle)
Ok
<op > 0 To set all parameters
at*e2eams=0,2,1,2,0,0,2,5,9,2,2,0,1,0,0,0,1,1,0,0,1
Ok
<op > 255 means to save the settings
at*e2eams=255
Ok

4.5. GPS Interface:

5. 1 At*eenmea
Command explanation: Set GPS data to enable
Command format: at*eenmea=<val >
Command return: OK
ERROR
Test results:
At*eenmea=0 (do not accept NMEA data from serial 2)
Ok
at*eenmea=2 (accepts NMEA data from serial 2)
Ok

5.2 At*e2nmpr
Command explanation: Set the serial port 2 to send GPS data baud rate
5.2.1 command format: at*e2nmpr=<val >
Command return: OK
ERROR
Test Result: at+cnmi=5 (set baud rate of serial port 2 is 19200)
Ok

In addition are some commonly used network commands, that is, the GPRS network operation commands are as follows,

1, at+cipsend= (send data via GPRS network instructions) equals after the transmission data length, return the number can be filled with data, to achieve the specified amount of data automatically sent, also support the sending of no specified data volume, send successfully returned send OK, unsuccessful return to send FAIL, may also not return east;

2, at+cipstart= "TCP", "192.43.10.157", "4005" (GPRS dial-up line) correctly return OK, error errors, format errors, and even go back to connect OK, the connection failed to return to connect fail Format can understand it should be;

3, At+cipstatus (query module GPRS status) module return State:connect OK (online), State:ip IND (connection failure, accept scene configuration), State:ip CLOSED (the other side dropped or disconnected), state: PDP deact (disconnect, you should check your antenna), STATE:TCP connecting (connection, in this case, the general connection failure, so it is directly at+cipclose,at+cipshut together with, and then re-connect, of course, I practice , not necessarily good), I encountered only these kinds of States, other States have not encountered;

4, at+cclk= "07/03/28,06:46:30+00" (to the module set the time and date) format should be read, correctly put back OK, error returned to error, format is wrong;

5, AT+CCLK? (read date Time) returns +CCLK: "03/01/01,16:07:46+00" in the form of information;

Of course, in the use of the SIMXXX series of GSM and other business commands

See MORE:

Http://wenku.baidu.com/link?url=Ei-QBjtDdkoSPWx9pYgicQ89_ mgmu9eil3zg3op962qlwt7cbfpsps3d3ul3kxdia04sqayumky5hunrpnwrbz1no_zvosz8olmuuchk19e

GSM's at Operation Command 20160615

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.