SIM900 - Serial Port - Application Note - V1.03

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

SIM900_Serial Port_Application

Note_V1.03
Smart Machine Smart Decision

Document Title: Serial Port Application Note

Version: 1.03

Date: 2012-04-26

Status: Release

Document Control ID: AN_SIM900_Serial Port_V1.03

General Notes
SIMCom offers this information as a service to its customers, to support application and engineering efforts that
use the products designed by SIMCom. The information provided is based upon requirements specifically
provided to SIMCom by the customers. SIMCom has not undertaken any independent search for additional
relevant information, including any information that may be in the customer’s possession. Furthermore, system
validation of this product designed by SIMCom within a larger electronic system remains the responsibility of the
customer or the customer’s system integrator. All specifications supplied herein are subject to change.

Copyright
This document contains proprietary technical information which is the property of SIMCom Limited., copying of
this document and giving it to others and the using or communication of the contents thereof, are forbidden
without express authority. Offenders are liable to the payment of damages. All rights reserved in the event of grant
of a patent or the registration of a utility model or design. All specification supplied herein are subject to change
without notice at any time.

Copyright © Shanghai SIMCom Wireless Solutions Ltd. 2011

SIM900_Serial Port_Applocation Note_V1.03 2 2012.04.26


Smart Machine Smart Decision

Contents

Contents .............................................................................................................................................................. 3
Version history .................................................................................................................................................... 4
Related documents.............................................................................................................................................. 4
1 Introduction...................................................................................................................................................... 5
2 Connection....................................................................................................................................................... 5
3 Level shifter ..................................................................................................................................................... 6
3.1 Communication with MCU..................................................................................................................... 6
3.2 Communication with PC (RS232) .................................................................................................... 7
4 Synchronize baud rate...................................................................................................................................... 8
5 Flow control..................................................................................................................................................... 8
5.1 Software flow control (XON/XOFF flow control) ................................................................................. 9
5.2 Hardware flow control (RTS/CTS flow control) .................................................................................... 9
6 Control signals ................................................................................................................................................. 9
6.1 CTS ......................................................................................................................................................... 9
6.2 RTS ......................................................................................................................................................... 9
6.2 DCD...................................................................................................................................................... 10
6.3 DTR ...................................................................................................................................................... 10
6.4 RI .......................................................................................................................................................... 10

Table Index
Table 1: Logic levels of the serial port................................................................................................................ 6
Table 2: The voltage of RS232 ........................................................................................................................... 7
Table 3: RI responds ......................................................................................................................................... 10
Table 4: AT+CFGRI Indicate RI when using URC........................................................................................... 12

Figure Index
Figure 1: Connection of the serial interfaces in full modem mode..................................................................... 5
Figure 2: Connection of the serial interfaces in null modem mode .................................................................... 5
Figure 3: The lever shifter by buffer with open drain outputs ............................................................................ 6
Figure 4: The lever shifter by transistor for communication with MCU ............................................................ 7
Figure 5: The lever shifter by SP3238E for communication with PC ................................................................ 7
Figure 6: Synchronizing baud rate flow chart..................................................................................................... 8

SIM900_Serial Port_Applocation Note_V1.03 3 2012.04.26


Smart Machine Smart Decision

Version history

Date Version Description of change Author


2011-02-28 1.01 Origin Ligang
2011-5-18 1.02 &5.2 Modified hardware flow control AT command.
2012-4-26 1.03 &6.3 Add the description of DTR

Related documents

SN Document name Remark


[1] TCPIP Application Note TCPIP Application Note

SIM900_Serial Port_Applocation Note_V1.03 4 2012.04.26


Smart Machine Smart Decision

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.

2 Connection

SIM900 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

Figure 1: Connection of the serial interfaces 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.

Figure 2: Connection of the serial interfaces in null modem mode

NOTE: The DTR signal must pulled to low level voltage when DTE is sending data to module. If DTR does

SIM900_Serial Port_Applocation Note_V1.03 5 2012.04.26


Smart Machine Smart Decision

not connect with DTE, DTR must be connected to GND via a 10K resistor.

3 Level shifter

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.

Table 1: Logic levels of the serial port

Parameter Min Max Unit


VIL 0 0.4 V
VIH 2.4 3.0 V
VOL 0 0.1 V
VOH 2.7 3.0 V

If user’s MCU or PC’s voltage is out of the range, lever shifter needs to be used.

3.1 Communication with MCU

The module can choose the lever shifter by buffer with open drain outputs (e.g. NC7WZ07) or transistor.
by buffer with open drain outputs
Note:
VDD_EXT is supplied by the module(2.80V),VCC_MCU is voltage of user UART interface

Figure 3: The lever shifter by buffer with open drain outputs

By transistor

SIM900_Serial Port_Applocation Note_V1.03 6 2012.04.26


Smart Machine Smart Decision

Figure 4: The lever shifter by transistor for communication with MCU

3.2 Communication with PC (RS232)

Table 2: The voltage of RS232

RS232 voltage values

Transmitter Receiver
Level
capable (V) capable (V)

logic 0 +5 ... +15 +3 ... +25

logic 1 -5 ... -15 -3 ... -25

Undefined - -3 ... +3

It is suggested doing the lever shifter by RS-232 transceivers (e.g.SP3238E or MAX3221 etc.)
Connect all signals

Figure 5: The lever shifter by SP3238E for communication with PC


SIM900_Serial Port_Applocation Note_V1.03 7 2012.04.26
Smart Machine Smart Decision

If just RXD and TXD are connected, MAX3221can be chosen for the lever shifter.

4 Synchronize baud rate

SIM900 is designed in autobauding mode by default. Autobauding allows SIM900 to automatically detect the
baud rate of the host device. In application, host device must to synchronize the baud rate with SIM900. Host
device must firstly send character “A” to synchronize the baud rate. It is recommended to send “AT” until host
device receives the “OK” response, which means host device and SIM900 are correctly synchronized. Once the
baud rate is synchronized, it is suggested to use AT command “AT+IPR” to set SIM900 baud rate according the
host baud rate. Following figure shows the flow of synchronization of baud rate between SIM900 and host device.

Figure 6: Synchronizing baud rate flow chart

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.

SIM900_Serial Port_Applocation Note_V1.03 8 2012.04.26


Smart Machine Smart Decision

SIM900 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.

5.1 Software flow control (XON/XOFF 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 automatically.


Ensure that any communications software package (e.g. ProComm Plus, Hyper terminal or WinFax Pro) uses
software flow control.
NOTE:
Software Flow control should not be used for data calls where binary data will be transmitted or received (e.g.
TCP/IP) as the DTE interface may interpret binary data as flow control characters.

5.2 Hardware flow control (RTS/CTS flow control)

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 automatically.

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.

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
SIM900_Serial Port_Applocation Note_V1.03 9 2012.04.26
Smart Machine Smart Decision

device.

6.2 DCD

The AT command AT&C can be used to set DCD function mode. When set “AT&C=0”, DCD line is
always ON (low). When set “AT&C=1”, DCD line is ON (low) only in the presence of data carrier.

6.3 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.

The AT command “AT&D” can be used to set DTR function mode.


When it is set to “AT&D0”, TA ignores status on DTR.
When it is set to “AT&D1”, ON (low)->OFF (high) on DTR: module will be changed to command mode when the
connected call is remained..
When it is set to “AT&D2”, ON->OFF on DTR: call is disconnected, module is changed to Command mode.
During state DTR = OFF, it is auto-answer off.
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.
DTR line of serial port can also be used to synchronize the SIM900 and MCU at autobauding mode.If MCU wants
to change the baud rate when it is already synchronized with SIM900 at autobauding mode: When DTR line is
pulled down, pull DTR line to high for at least 2 seconds and then pull down and send any AT command starting
with capitalized “A” to SIM900, SIM900 will synchronize the baud rate with MCU. It is recommended to send
the AT command and wait until MCU receives the response, which means SIM900 and MCU are correctly
synchronized. It only works at autobauding mode. It is useful when MCU changes the baud rate.

6.4 RI

If the module is used as caller, the RI will maintain high. But when it is used as receiver, the responses of RI are
listed in the following table.

Table 3: RI responds

State RI respond
Standby HIGH

SIM900_Serial Port_Applocation Note_V1.03 10 2012.04.26


Smart Machine Smart Decision

Voice calling Change to LOW, then:


(1)Change to HIGH when call is established.
(2)Use AT command ATH, the RI pin is changed to HIGH.
(3)Sender hangs up, change to HIGH.
(4)SMS received
Data calling Change LOW, then:
(1)Change to HIGH when call is established.
(2)Use AT command ATH, the RI is changed to HIGH.
SMS When receiving SMS, The RI will be changed to LOW and hold at low
level for about 120 ms, then it is changed to HIGH.
URC Following URCs triggers 120ms low level on RI.
UNDER-VOLTAGE WARNNING
OVER-VOLTAGE WARNNING
+CEXTHS:
+CEXTBUT:
RING
Call Ready
+CBMT:
+CMTI:
+CMT:
+TSMSINFO:
+SMREADY:
+CDS:

Figure 7: Behaviors of RI

SIM900_Serial Port_Applocation Note_V1.03 11 2012.04.26


Smart Machine Smart Decision

Table 4: AT+CFGRI Indicate RI when using URC

Read command Response :


AT+ CFGRI ? +CFGRI: <status>
ok
Parameter:
See set command
Set Command Response :
AT+ OK
CFGRI=<status> Parameter:
<status>
0 on
1 off
Reference Note

We suggest that you 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.

SIM900_Serial Port_Applocation Note_V1.03 12 2012.04.26


Contact us:
Shanghai SIMCom Wireless Solutions Ltd.
Add: SIM Technology Building,No.633,Jinzhong Road,Changning District,Shanghai P.R. China
200335
Tel: +86 21 3235 3300
Fax: +86 21 3235 3301
URL: www.sim.com/wm

You might also like