SIM800C learning materials and establish a TCP connection process

1. Power Test: AT

Return: the OK
2. Query network registration status: AT + CPIN?
Return: + CPIN: READY

The OK
3. query signal quality AT + CSQ
return: + CSQ: 26,0

The OK
4. GSM network registration status query AT + CREG?
Return: + CREG: 0,1

The OK
5. Query GPRS network registration status AT + CGREG?
Return: + CGREG: 0,1

The OK
6. The attaching the module to the GPRS network AT + CGATT = 1
returns: OK

7. Set APN: AT + CSTT
returns: OK

8. Activate mobility scenario, wireless connection is established AT + CIICR
returns: OK

9. The IP address obtaining module AT + CIFSR
Returns: 10.150.31.187

10. A TCP connection is established, the connection to the server
returns: AT + CIPSTART = "TCP" , "IP address", the port number

例如:AT+CIPSTART="TCP","172.27.8.147",1883 

Return: the OK

CONNECT OK

 

11. (select command) queries the connection status AT + CIPSTART =?
Return: + CIPSTART:... ( "TCP", "UDP"), ( "(0-255) (0-255) (0-255) ( 0-255) "), (1-65535)
+ CIPSTART: (" TCP "," UDP "), (" DOMAIN NAME "), (1-65535)

OK

12. The data transmission AT + CIPSEND
Returns:> 

13. Close TCP connection AT + CIPCLOSE
Returns: CLOSE OK
or AT + CIPSHUT
Returns: SHUT OK

PS1: The tenth step is necessary to return the connection is successful CONNECT OK

IP address must be a public network IP, if there is no public network IP, TCP server http://www.tongxinmao.com/App/Detail/id/1 can connect to the public,

It can also be done within the network penetration with peanut shells, contact details, bloggers

PS2: connection must be maintained "heartbeat", if more than a predetermined time does not transmit data to the server, the connection is automatically interrupted, and the need to repeat step 10

PS3: If step 10 fails, repeat step 10 to step 6, steps 7 and 8 can not be omitted

Note: This document is the author's experience, have questions, please contact the author [email protected]

Guess you like

Origin www.cnblogs.com/bihua/p/11445027.html