A76XX Series - TCPIP - Application Note - V1.01
A76XX Series - TCPIP - Application Note - V1.01
A76XX Series - TCPIP - Application Note - V1.01
_Application Note
LTE Module
GENERAL NOTES
COPYRIGHT
www.simcom.com 1 / 24
A76XX Series_TCPIP_Application Note_V1.01
About Document
Version History
Scope
This document presents the AT Command Set for SIMCom A76XXand A7678 Series, including
A76XX-XXXX, A5360E, A76X0X-XXXX and A7678C.
www.simcom.com 2 / 24
A76XX Series_TCPIP_Application Note_V1.01
Contents
About Document.................................................................................................................................. 2
Version History.........................................................................................................................................................2
Scope........................................................................................................................................................................ 2
Contents................................................................................................................................................. 3
1 Introduction.................................................................................................................................... 5
1.1 Purpose of the document...........................................................................................................................5
1.2 Related documents.....................................................................................................................................5
1.3 Conventions and abbreviations................................................................................................................ 5
1.4 The process of Using TCPIP AT Commands......................................................................................... 6
1.5 Error Handling..............................................................................................................................................9
1.5.1 Executing FTP(S) AT Commands Fails.......................................................................................9
1.5.2 PDP Activation Fails....................................................................................................................... 9
1.5.3 Error Response of TCPIP Server................................................................................................. 9
1.5.4 Description of Data Access Mode................................................................................................ 9
3 TCPIP Examples..........................................................................................................................12
3.1 Configure and Activate context...............................................................................................................12
3.1.1 Network Environment...................................................................................................................12
3.1.2 Configure Context.........................................................................................................................12
3.1.3 Activate context.............................................................................................................................12
3.1.4 Deactivate Context....................................................................................................................... 13
3.2 TCP Client.................................................................................................................................................. 13
3.2.1 TCP Client Works in Direct Push Mode.................................................................................... 13
3.2.2 TCP Client Works in Buffer Access Mode................................................................................ 14
3.2.3 TCP Client Works in Transparent Access Mode..................................................................... 15
3.3 UDP Client..................................................................................................................................................17
3.3.1 UDP Client Works in Direct Push Mode................................................................................... 17
3.3.2 UDP Client Works in Buffer Access Mode................................................................................18
3.3.3 UDP Client Works in Transparent Access Mode..................................................................... 19
3.4 TCP Server................................................................................................................................................ 20
3.4.1 Transparent Mode.........................................................................................................................20
3.4.2 Non-Transparent Mode................................................................................................................21
3.4.3 Query Connection Status............................................................................................................ 22
4 Appendix....................................................................................................................................... 23
4.1 Summary of Error Codes.........................................................................................................................23
www.simcom.com 3 / 24
A76XX Series_TCPIP_Application Note_V1.01
www.simcom.com 4 / 24
A76XX Series_TCPIP_Application Note_V1.01
1 Introduction
Based on module AT command manual, this document will introduce TCPIP application process.
Developers could understand and develop application quickly and efficiently based on this document.
In application, controlling device controls the GSM engine by sending AT Command via its serial interface.
The controlling device at the other end of the serial line is referred to as following term:
TE (Terminal Equipment);
DTE (Data Terminal Equipment) or plainly "the application" which is running on an embedded system;
Other Conventions:
PDP(Packet Data Protocol);
TCP(Terminal Control Protocol);
UDP(User Datagram Protocol);
www.simcom.com 5 / 24
A76XX Series_TCPIP_Application Note_V1.01
www.simcom.com 6 / 24
A76XX Series_TCPIP_Application Note_V1.01
www.simcom.com 7 / 24
A76XX Series_TCPIP_Application Note_V1.01
www.simcom.com 8 / 24
A76XX Series_TCPIP_Application Note_V1.01
When executing TCPIP AT commands, if ERROR response is received from the module, please check
whether the U(SIM) card is inserted and whether it is +CPIN: READY returned when executing AT+CPIN?.
If it is failed to activate a PDP context with AT+NETOPEN command, please make sure the PDP is not
activated. You can use AT+NETOPEN? to query it.
If all above configurations are correct, but activating the PDP context by AT+NETOPEN command still fails,
please reboot the module to resolve this issue. After rebooting the module, please check the
configurations mentioned above for at least.
Transparent Mode
(Data Mode)
Access Mode Direct Push Mode
Non-Transparent Mode
(Command Mode) Buffer Access Mode
www.simcom.com 9 / 24
A76XX Series_TCPIP_Application Note_V1.01
www.simcom.com 10 / 24
A76XX Series_TCPIP_Application Note_V1.01
Command Description
AT+NETOPEN Start Socket Service
AT+NETCLOSE Stop Socket Service
AT+CIPOPEN Establish Connection in Multi-Socket Mode
AT+CIPSEND Send data through TCP or UDP Connection
AT+CIPRXGET Set the Mode to Retrieve Data
AT+CIPCLOSE Close TCP or UDP Socket
AT+IPADDR Inquire Socket PDP address
AT+CIPHEAD Add an IP Header When Receiving Data
AT+CIPSRIP Show Remote IP Address and Port
AT+CIPMODE Set TCP/IP Application Mode
AT+CIPSENDMODE Set Sending Mode
AT+CIPTIMEOUT Set TCP/IP Timeout Value
AT+CIPCCFG Configure Parameters of Socket
AT+SERVERSTART Startup TCP Server
AT+SERVERSTOP Stop TCP Server
AT+CIPACK Query TCP Connection Data Transmitting Status
AT+CDNSGIP Query the IP Address of Given Domain Name
www.simcom.com 11 / 24
A76XX Series_TCPIP_Application Note_V1.01
3 TCPIP Examples
TCP/IP application is based on GPRS network. Please make sure that GPRS network is available before
TCP/IP setup.
AT+CSQ
+CSQ: 23,0
OK
AT+CREG?
+CREG: 0,1
OK
AT+CGREG?
+CGREG: 0,1
OK
AT+CGDCONT=1,"IP","CMNET"
OK
www.simcom.com 12 / 24
A76XX Series_TCPIP_Application Note_V1.01
AT+NETOPEN
OK
+NETOPEN: 0
AT+IPADDR
+IPADDR: 10.148.0.17
OK
AT+NETCLOSE
OK
+NETCLOSE: 0
AT+IPADDR
+IPADDR: Network not opened
ERROR
+NETOPEN: 0
AT+CIPOPEN=1,"TCP","117.131.85.139",5253 // set up a TCP connection, <link_num> is 1.
OK Before using AT+CIPOPEN, host should activate
PDP Context with AT+NETOPEN first.
+CIPOPEN: 1,0
www.simcom.com 13 / 24
A76XX Series_TCPIP_Application Note_V1.01
>HELLO
OK
+CIPSEND: 1,5,5
+CIPCLOSE: 1,0
+NETOPEN: 0
AT+CIPRXGET=1 // buffer access mode, get data by AT+CIPRXGET
OK
AT+CIPOPEN=1,"TCP","117.131.85.139",5253
OK
+CIPOPEN: 1,0
+CIPSEND: 1,5,5
www.simcom.com 14 / 24
A76XX Series_TCPIP_Application Note_V1.01
OK
AT+CIPRXGET=3,1,5 // get data in hex form
+CIPRXGET: 3,1,5,6
66726F6D20
OK
AT+CIPRXGET=4,1 // read the length of unread data in buffer
+CIPRXGET: 4,1,6
OK
AT+CIPRXGET=2,2 // the connection identified by link_num=2 has not
+IP ERROR: No data been established
ERROR
AT+CIPRXGET=2,1
+CIPRXGET: 2,1,6,0
server
OK
AT+CIPRXGET=4,1 // all the data in buffer has been read, the rest_len
+CIPRXGET: 4,1,0 is 0.
OK
+CIPCLOSE: 1,0
www.simcom.com 15 / 24
A76XX Series_TCPIP_Application Note_V1.01
AT+NETOPEN
OK
+NETOPEN: 0
AT+CIPOEPN=0,"TCP","117.131.85.139",5253 // only <link_num>=0 is allowed to operate with
CONNECT 115200 transparent mode.
OK
ATO //ATO to enter transparent mode again
CONNECT 115200
HELLO CLIENT
OK
CLOSED
+CIPCLOSE: 0,0
www.simcom.com 16 / 24
A76XX Series_TCPIP_Application Note_V1.01
+NETOPEN: 0
AT+CIPOPEN=1,"UDP",,,5000 // when set a UDP connection, the remote IP
+CIPOPEN: 1,0 address and port is not necessary, but the local
port
OK must be specified.
+CIPSEND: 1,5,5
OK
www.simcom.com 17 / 24
A76XX Series_TCPIP_Application Note_V1.01
+NETOPEN: 0
AT+CIPRXGET=1 // buffer access mode, get data by AT+CIPRXGET
OK
AT+CIPOPEN=1,"UDP",,,5000 // when set a UDP connection, the remote IP
+CIPOPEN: 1,0 address and port is not necessary, but the local
port
OK must be specified.
+CIPSEND: 1,5,5
OK
AT+CIPRXGET=2,1,5 // get data in ASCII form
+CIPRXGET: 2,1,5,11
data
OK
AT+CIPRXGET=3,1,5 // get data in hex form
+CIPRXGET: 3,1,5,6
66726F6D20
www.simcom.com 18 / 24
A76XX Series_TCPIP_Application Note_V1.01
OK
AT+CIPRXGET=4,1 // read the length of unread data in buffer
+CIPRXGET: 4,1,6
OK
AT+CIPRXGET=2,2 // the connection identified by link_num=2 has not
+IP ERROR: No data been established
ERROR
AT+CIPRXGET=2,1
+CIPRXGET: 2,1,6,0
server
OK
AT+CIPRXGET=4,1 // all the data in buffer has been read, the rest_len
+CIPRXGET: 4,1,0 is 0.
OK
+CIPCLOSE: 1,0
+NETOPEN: 0
AT+CIPOPEN=0,"UDP","117.131.85.139",5254, //only <link_num>=0 is allowed to operate with
5000 transparent mode.
CONNECT 115200
www.simcom.com 19 / 24
A76XX Series_TCPIP_Application Note_V1.01
OK
AT+CIPOPEN=0,"UDP","117.131.85.139",5254, //only <link_num>=0 is allowed to operate with
5000 transparent mode.
CONNECT 115200
AT+CIPMODE=1
OK
AT+NETOPEN
OK
+NETOPEN: 0
AT+SERVERSTART=8080, 0 //only <server_index>=0 is allowed to operate with
OK transparent mode.
+CLIENT: 0,0,192.168.108.5:57202 //only <link_num> 0 can be used for transparent
CONNECT 115200 mode operation.
CLOSED
www.simcom.com 20 / 24
A76XX Series_TCPIP_Application Note_V1.01
+CIPCLOSE: 0,0
AT+SERVERSTOP=0 // close server socket
+SERVERSTOP: 0,0
OK
AT+NETOPEN
OK
+NETOPEN: 0
AT+SERVERSTART=8080, 0 //only <server_index>=0 is allowed to operate with
OK transparent mode.
AT+SERVERSTART=9090, 1
OK
AT+SERVERSTART=7070, 2
OK
AT+SERVERSTART=6060, 3
OK
+CLIENT: 0,0,192.168.108.5:57202 //If a socket is accepted, the following URC will be
reported:
AT+CIPOPEN? //User can use AT+CIPOPEN? to check the
+CIPOPEN: 0,"TCP","192.168.108.5",57202,1 accepted socket
+CIPOPEN: 1 //last parameter of 1 indicates this is an accepted
+CIPOPEN: 2 socket, this server index is 1
+CIPOPEN: 3
+CIPOPEN: 4
+CIPOPEN: 5
+CIPOPEN: 6
+CIPOPEN: 7
+CIPOPEN: 8
+CIPOPEN: 9
OK
AT+CIPSEND=0,5 // only supports fixed-length to send
>HELLO
OK
+CIPSEND: 0,5,5
AT+SERVERSTOP=0 // if unspecified, it will close 0 channel
+SERVERSTOP: 0,0
OK
AT+SERVERSTOP=1
+SERVERSTOP: 1,0
www.simcom.com 21 / 24
A76XX Series_TCPIP_Application Note_V1.01
OK
AT+SERVERSTOP=2
+SERVERSTOP: 2,0
OK
AT+SERVERSTOP=3
+SERVERSTOP: 3,0
OK
AT+NETCLOS
OK
+NETCLOSE: 0
AT+CIPOPEN=1,"TCP","117.131.85.139",5253
OK
+CIPOPEN: 1,0
AT+CIPOPEN? // query the current state of all sockets
+CIPOPEN: 0
+CIPOPEN: 1,"TCP","117.131.85.139",5253,-1
+CIPOPEN: 2
+CIPOPEN: 3
+CIPOPEN: 4
+CIPOPEN: 5
+CIPOPEN: 6
+CIPOPEN: 7
+CIPOPEN: 8
+CIPOPEN: 9
OK
AT+CIPCLOSE?
+CIPCLOSE: 0,1,0,0,0,0,0,0,0,0
OK
AT+CIPCLOSE=1
OK
+CIPCLOSE: 1,0
AT+CIPCLOSE?
+CIPCLOSE: 0,0,0,0,0,0,0,0,0,0
OK
www.simcom.com 22 / 24
A76XX Series_TCPIP_Application Note_V1.01
4 Appendix
When you use these commands : AT+CIPACK AT+CIPRXGET, If something goes wrong, they maybe
reported as +IP ERROR: <err_info>.
The fourth parameter <errMode> of AT+CIPCCFG (TODO) is used to determine how <err_info> is
displayed.
If <errMode> is set to 0, the <err_info> is displayed with numeric value.
If <errMode>is set to 1, the <err_info> is displsayed with string value.
The default is displayed with string value.
www.simcom.com 23 / 24
A76XX Series_TCPIP_Application Note_V1.01
Information Description
+CIPEVENT: NETWORK Network is closed for network error(Out of service, etc). When
CLOSED UNEXPECTEDLY this event happens, user’s application needs to check and close
all opened sockets, and then uses AT+NETCLOSE to release the
network library if AT+NETOPEN? shows the network library is still
opened.
www.simcom.com 24 / 24
A76XX Series_TCPIP_Application Note_V1.01
+CLIENT: < TCP server accepted a new socket client, the index
link_num>,<server_index>,<clie is<link_num>, the TCP server index is <server_index>. The peer
nt_IP>:<port> IP address is <client_IP>, the peer port is <port>.
www.simcom.com 25 / 24