SIM800 Series - Serial Port - Application Note - V1.03
SIM800 Series - Serial Port - Application Note - V1.03
_Application Note
GPRS Module
GENERAL NOTES
COPYRIGHT
www.simcom.com 2 / 29
SIM800 Series_Serial Port_Application Note_V1.03
About Document
Version History
Scope
This document presents the AT command of Serial port operation and application examples. This document
can apply to SIM800 series modules with serial port function.
www.simcom.com 3 / 29
SIM800 Series_Serial Port_Application Note_V1.03
Contents
Contents ................................................................................................................................................4
1 Introduction ...................................................................................................................................8
1.1 Purpose of the document ............................................................................................................ 8
1.2 Related documents ..................................................................................................................... 8
1.3 Conventions and abbreviations ................................................................................................... 8
2 Connection .....................................................................................................................................9
www.simcom.com 4 / 29
SIM800 Series_Serial Port_Application Note_V1.03
www.simcom.com 5 / 29
SIM800 Series_Serial Port_Application Note_V1.03
Table Index
www.simcom.com 6 / 29
SIM800 Series_Serial Port_Application Note_V1.03
Figure Index
www.simcom.com 7 / 29
SIM800 Series_Serial Port_Application Note_V1.03
1 Introduction
This document describes the serial interface of the modules and how to take it into account in client’s
application design. This document can help user quickly understand serial interface of the modules.
Abbreviation Description
DCE Data Communication Equipment
DTE Data Terminal Equipment
UART Universal Asynchronous Receiver and transmitter
www.simcom.com 8 / 29
SIM800 Series_Serial Port_Application Note_V1.03
2 Connection
SIM800 series is designed as a DCE (Data Communication Equipment). It provides a full modem serial port
which is used for data transmission and for sending AT commands. The serial port contains data lines TXD
and RXD, hardware flow control lines RTS and CTS, status lines DTR, DCD and RI. Serial port interface is
available which complies with 2.80 Volts interface.
When the module is used in full modem mode for data transmission, all the signal lines should be
connected. The following figure shows the connection between module and client (DTE) in full modem
mode.
When the module is used in null modem (no handshaking) mode for data transmission,only RXD and TXD
are used in user’s application, other serial pins should be kept open. The following figure shows the
connection between module and client (DTE) in null modem mode.
www.simcom.com 9 / 29
SIM800 Series_Serial Port_Application Note_V1.03
NOTE
The DTR signal must pulled to low level voltage when DTE is sending data to module. If DTR does not
connect with DTE, DTR must be connected to GND via a 10K resistor.
www.simcom.com 10 / 29
SIM800 Series_Serial Port_Application Note_V1.03
3 URC Rule
The significant levels are 0V (for low data bit or ON condition) and 2.80V (for high data bit or OFF condition).
For electrical characteristics please refer to the following table.
VOL 0 0.1 V
If user’s MCU or PC’s voltage is out of the range, lever shifter needs to be used.
The module can choose the lever shifter by buffer with open drain outputs (e.g. NC7WZ07) or transistor.
www.simcom.com 11 / 29
SIM800 Series_Serial Port_Application Note_V1.03
By transistor:
NOTE
www.simcom.com 12 / 29
SIM800 Series_Serial Port_Application Note_V1.03
It is suggested doing the lever shifter by RS-232 transceivers (e.g.SP3238E or MAX3221 etc.)
If just RXD and TXD are connected, MAX3221can be chosen for the lever shifter.
www.simcom.com 13 / 29
SIM800 Series_Serial Port_Application Note_V1.03
SIM800 series is designed in autobauding mode by default. Autobauding allows SIM800 series to
automatically detect the baud rate of the host device. In application, host device must to synchronize the
baud rate with SIM800 series. Host device must firstly send character "AT" or "at" to synchronize the baud
rate. It is recommended to send "AT" until host device receives the "OK" response, which means host
device and SIM800 series are correctly synchronized. Once the baud rate is synchronized, it is suggested
to use AT command "AT+IPR" to set SIM800 series baud rate according the host baud rate. Following
figure shows the flow of synchronization of baud rate between SIM800 series and host device.
Start
Power on module
Send “AT” to
module
Receives the
“OK” response No
Yes
End
www.simcom.com 14 / 29
SIM800 Series_Serial Port_Application Note_V1.03
www.simcom.com 15 / 29
SIM800 Series_Serial Port_Application Note_V1.03
5 Flow Control
Flow control is very important for correct communication between the module (DCE) and host device (DTE).
In cases of a data or fax call, the sending device is transferring data faster than the receiving side is ready
to accept. When the receiving buffer reaches its capacity, the receiving device should be capable to pause
the sending device until it catches up.
SIM800 series is designed as no flow control by default. The AT command "AT+IFC" can be used to enable
the hardware flow control or software flow control, which are basically two approaches to achieve data flow
control.
Software flow control sends different characters to stop (XOFF, decimal 19) and resume (XON, decimal 17)
data flow. It is quite useful in some applications that only use three wires on the serial interface.
The AT command "AT+IFC=1,1" can be used to enable software flow control in the DTE interface and within
module. This setting is stored by AT&W.
Ensure that any communications software package (e.g. ProComm Plus, Hyper terminal or WinFax Pro)
uses software flow control.
The following three special character have been used in the software flow control: XON(0x11),XOFF(0x13),
When the MCU has received much data from the modem by the serial port and the data can’t be handled in
time, the MCU can directly send the XOFF to inform the modem to stop sending data.
After the part or all of data have been handled by the MCU, the MCU need send XON to inform the modem
continue to send the rest of the data.
Because the data sent to modem may include the character of 0x11, 0x13 and 0x77, the MCU must convert
these characters and then send them to modem, or the modem will mistake these data for the control
character of XON, XOFF and ESCAPE. The 0x11 convert to 0x77 0xEE two character, 0x13 to 0x77 0xEC
and 0x77 to 0x77 0x88. When receiving these data that begin with 0x77, the modem will automatically
restore them into the original data.
www.simcom.com 16 / 29
SIM800 Series_Serial Port_Application Note_V1.03
In the same way, when the modem received much data from the MCU and these data can not be handled in
time, the modem will send XOFF to inform the MCU to stop sending data. So it is essential that the MCU is
able to monitor the data from the modem whether these are character of XON, XOFF and ESCAPE.
After the part or all of data have been handled by modem, the modem need send XON to inform the MCU
continue to send the rest of the data.
Because the data sent to MCU may include the character of 0x11, 0x13 and 0x77, the modem will convert
these characters and then send them to MCU, or the MCU will mistake these data for the control character
of XON, XOFF and ESCAPE. The 0x11 convert to 0x77 0xEE two character, 0x13 to 0x77 0xEC and 0x77
to 0x77 0x88. When receiving these data that begin with 0x77, the MCU must restore them into the original
data to hand them over to upper application.
Hardware flow control achieves the data flow control by controlling the RTS/CTS line. When the data
transfer should be suspended, the CTS line is set inactive until the transfer from the receiving buffer has
been completed. When the receiving buffer is OK to receive more data, CTS goes active once again.
The AT command "AT+IFC=2,2" can be used to enable hardware flow control in the DTE interface and
within module. This setting is stored by AT&W.
To achieve hardware flow control, ensure that the RTS/CTS lines are present on user’s application platform.
NOTE
The DTR signal must be pulled to low level voltage when DTE is sending data to the module.
Otherwise, the CTS signal may always not be asserted by module and the handshaking will not be
established.
www.simcom.com 17 / 29
SIM800 Series_Serial Port_Application Note_V1.03
6 Control Signals
6.1 CTS
This signal is asserted by the module to inform the DTE device that transmission may begin. RTS and CTS
are commonly used as handshaking signals to moderate the flow of data into the module.
6.2 RTS
This signal is asserted (low level) to prepare the module (DCE) for accepting transmitted data from the DTE
device.
6.3 DCD
The AT command AT&C can be used to set DCD function mode. When set "AT&C0", DCD line is always ON
(low). When set "AT&C1", DCD line is ON (low) only in the presence of data carrier.
6.4 DTR
Module will automatically go into SLEEP mode (set AT+CSCLK=1) if DTR is set to high level and there is no
on air and no hardware interrupt (such as GPIO interrupt or data on serial port). In this case, the current
consumption of module will reduce to the minimal level. During SLEEP mode, the module can still receive
paging message and SMS from the system normally. If DTR Pin is pulled down to a low level, this signal will
wake up module from SLEEP mode. The serial port will be active after DTR changes to low level about
50ms. DTR must be held low during the call.
www.simcom.com 18 / 29
SIM800 Series_Serial Port_Application Note_V1.03
TCP/IP applications only support AT&D1 and AT&D0. In TCP/IP application (for more detail, please refer to
TCP/IP application NOTE), DTR line of serial port can also be used to switch from data mode to command
mode. To use this method, AT&D1 should be set firstly. Pull DTR line to ground for at least 1 second and
then pull up, the module will switch from data mode to command mode and OK will be returned which
indicates the module is in command mode.
6.5 RI
RI responds as table 3.
Table 3: RI responds
State RI respond
Standby HIGH
AT Commands According to GSM07.07 RING
Calling (include Voice and Data) If the module is used as caller, the RI will maintain high.
(NOT controlled by the setting of CFGRI) But when it is used as receiver, the responses of RI are
listed in the following:
Change to LOW, then:
www.simcom.com 19 / 29
SIM800 Series_Serial Port_Application Note_V1.03
command
RI
HIGH
...... ......
Power ......
LOW Hang on
Ring
MO or MT hang
up
RI
HIGH 120m
LOW
SMS received or URC
Figure 7: Behaviors of RI
www.simcom.com 20 / 29
SIM800 Series_Serial Port_Application Note_V1.03
OK
Write Command Response
AT+CFGRI=<status> OK
or
ERROR
Reference Note
Defined Values
<status> 0 off
1 on
It’s recommended connect the RI to an interrupt port of MCU. It can be used for waking up from power
saving mode. That means the MCU will receive an interrupt while a falling edge coming on RI.
www.simcom.com 21 / 29
SIM800 Series_Serial Port_Application Note_V1.03
SM800H, SIM800L, SIM800, SIM800M64, SIM800C and SIM800C-DS support the dual serial port function.
SM800H, SIM800L, SIM800 and SIM800M64 support the dual serial port function, the hardware will support
one full serial port (UART2) and one 3-line serial port (UART1) at the same time. This dual serial port
function must set by the AT command of "AT+CMNRP=1" on the UART1 port before using. If the customer
needs the dual serial port function, the hardware must be designed as the following table:
www.simcom.com 22 / 29
SIM800 Series_Serial Port_Application Note_V1.03
NOTE
1: The dual serial port function needs two pin of COL4 and ROW4.
2: The AT command of AT+CMNRP" only can be executed on UART1.
3: Only B05 and later version support dual serial port function.
OK
Read Command Response
AT+CMNRP? +CMNRP: <mode>
OK
Write Command Response
AT+CMNRP=<mode> OK
or
ERROR
Parameter Saving Mode AT&W_SAVE
Max Response Time -
Reference Note
Defined Values
The following figure shows the connection between module and client (DTE), the figure suits for
SIM800H, SIM800L, SIM800 and SIM800M64.
www.simcom.com 23 / 29
SIM800 Series_Serial Port_Application Note_V1.03
SM800C and SIM800C-DS support the dual serial port function, the hardware will support one full serial
port (UART1) and one 3-line serial port (UART2) at the same time. If the customer needs the dual serial port
function, the hardware must be designed as the following table:
The following figure shows the connection between module and client (DTE), the figure suits for
SIM800C and SIM800C-DS.
www.simcom.com 24 / 29
SIM800 Series_Serial Port_Application Note_V1.03
When the module works on dual serial port mode, some of AT command can only be executed on one serial
port, these AT commands list in following table:
www.simcom.com 25 / 29
SIM800 Series_Serial Port_Application Note_V1.03
On dual serial port mode, the UART1 and UART2 both are autobauding rate (the value of "AT+IPR" is 0).
The module cannot enter sleep mode in the absence of synchronous serial port baud rate after module
power on. Only the UART1 and UART2 have both synchronized baud rate, the module can enter sleep
mode.
On dual serial port mode, UART1 only contain 3 lines (TXD, RXD, and GND). Only the sleep mode2 can be
used. After setting "AT+CSCLK=2" command, the module will continuously monitor the serial port data
signal. When there is no data transfer over 5 seconds on the serial port and there is no on air and hardware
interrupts (such as GPIO interrupt), the module will enter sleep mode2 automatically. At this sleep mode,
the module also can receive incoming call and new SMS from network.
When the module is in sleep mode2 (AT+CSCLK=2), the following methods can wake up it.
Receive a voice or data call from network.
Receive a SMS from network.
Receive external interrupt.
UART1 receive data (the first character will lose).
NOTE
AT command from UART2 can not wake up the module; pull down DTR pin of UART2 can not wake up
the module too.
Customer can control the module to enter or exit the sleep mode1 (AT+CSCLK=1) by DTR signal. When
DTR is in high level and without interrupt (on air and hardware such as GPIO interrupt or data on serial port),
the module will enter sleep mode1 automatically. In this mode, the module can still receive paging or SMS
www.simcom.com 26 / 29
SIM800 Series_Serial Port_Application Note_V1.03
When the module is in sleep mode1 (AT+CSCLK=1), the following methods can wake up it.
Receive a voice or data call from network.
Receive a SMS from network.
Receive external interrupt.
Pull down DTR pin.
After module has received incoming call or new SMS, serial port can report URC, but the serial port can not
input AT command. Only after the DTR pin of UART2 pull to low level for 50ms, the serial port can input AT
command.
NOTE
On dual serial port mode, the UART1 and UART2 both are autobauding rate (the value of "AT+IPR" is 0).
The module cannot enter sleep mode in the absence of synchronous serial port baud rate after module
power on. Only the UART1 and UART2 have both synchronized baud rate, the module can enter sleep
mode.
Customer can control the module to enter or exit the sleep mode1 (AT+CSCLK=1) by DTR signal. When
DTR is in high level and without interrupt (on air and hardware such as GPIO interrupt or data on serial port),
the module will enter sleep mode1 automatically. In this mode, the module can still receive paging or SMS
from network but the serial port is not accessible.
www.simcom.com 27 / 29
SIM800 Series_Serial Port_Application Note_V1.03
After setting "AT+CSCLK=2" command, the module will continuously monitor the serial port data signal.
When there is no data transfer over 5 seconds on the serial port and there is no on air and hardware
interrupts (such as GPIO interrupt), the module will enter sleep mode2 automatically. At this sleep mode,
the module also can receive incoming call and new SMS from network.
When the module is in sleep mode1 (AT+CSCLK=1), the following methods can wake up it.
Receive a voice or data call from network.
Receive a SMS from network.
Receive external interrupt.
Pull down DTR pin.
After module has received incoming call or new SMS, serial port can report URC, but the serial port cannot
input AT command. Only after the DTR pin of UART2 pull to low level for 50ms, the serial port can input AT
command.
When the module is in sleep mode2 (AT+CSCLK=2), the following methods can wake up it.
Receive a voice or data call from network.
Receive a SMS from network.
Receive external interrupt.
UART1 receive data (the first character will lose).
NOTE
On dual serial port mode, UART2 only contain 3 lines (TXD, RXD, and GND). Only the sleep mode2 can be
used. After setting "AT+CSCLK=2" command, the module will continuously monitor the serial port data
signal. When there is no data transfer over 5 seconds on the serial port and there is no on air and hardware
interrupts (such as GPIO interrupt), the module will enter sleep mode2 automatically. At this sleep mode,
the module also can receive incoming call and new SMS from network.
www.simcom.com 28 / 29
SIM800 Series_Serial Port_Application Note_V1.03
When the module is in sleep mode2 (AT+CSCLK=2), the following methods can wake up it.
Receive a voice or data call from network.
Receive a SMS from network.
Receive external interrupt.
UART2 receive data (the first character will lose).
NOTE
AT command from UART1 cannot wake up the module; pull down DTR pin of UART1 cannot wake up
the module too.
www.simcom.com 29 / 29