A7600 Series_
MQTT(S)_Application Note
LTE Module
SIMCom Wireless Solutions Limited
Building B, SIM Technology Building, No.633, Jinzhong Road
Changning District, Shanghai P.R. China
Tel: 86-21-31575100
support@simcom.com
www.simcom.com
A7600 Series_MQTT(S)_Application Note_V1.00
A7600 Series_MQTT(S)_Application Note
1.00
2020.6.19
Released
Document Title:
Version:
Date:
Status:
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.
SIMCom Wireless Solutions Limited
Building B, SIM Technology Building, No.633 Jinzhong Road, Changning District, Shanghai P.R.China
Tel: +86 21 31575100
Email: simcom@simcom.com
For more information, please visit:
https://www.simcom.com/download/list-863-en.html
For technical support, or to report documentation errors, please visit:
https://www.simcom.com/ask/ Or email to: support@simcom.com
Copyright © 2020 SIMCom Wireless Solutions Limited All Rights Reserved.
www.simcom.com 1 /21
A7600 Series_MQTT(S)_Application Note_V1.00
About Document
Version History
Revision Date
V1.00
2020-06-19
Scope
Chapter
All
Description
New version
This document applies to the following products
Name
A7600XX-XXXX
A7620
A7670X
A5360E
Type
LTE
CAT1/LTE
CAT1/LTE
CAT4/WCDMA
Size(mm)
30.0*30.0*2.5
24.0*24.0*2.5
24.0*24.0*2.5
30.0*30.0*2.5
Comments
N/A
N/A
N/A
N/A
www.simcom.com 1 /21
A7600 Series_MQTT(S)_Application Note_V1.00
Contents
About Document .................................................................................................................... 1
Version History ...................................................................................................................................... 1
Scope .................................................................................................................................................... 1
Contents ................................................................................................................................. 2
1 Introduction ......................................................................................................................... 3
1.1 Purpose of the document ................................................................................................................. 3
1.2 Related documents .......................................................................................................................... 3
1.3 Conventions and abbreviations ....................................................................................................... 3
1.4 The process of Using MQTT(S) AT Command ................................................................................ 4
1.5 Error Handling.................................................................................................................................. 5
2 AT Commands for MQTT(S) ............................................................................................... 6
2.1 Overview of AT Commands for MQTT(S) ........................................................................................ 6
3 MQTT Examples .................................................................................................................. 7
3.1 Access to MQTT server not SSL/TLS .............................................................................................. 7
3.2 Connect to SSL/TLS MQTT server (not verify server) ................................................................... 10
3.3 Access to SSL/TLS MQTT server (only verify the server) .............................................................. 11
3.4 Access to SSL/TLS MQTT server (verify server and client) ........................................................... 14
3.5 Access to MQTT server without checking UTF8 coding ................................................................ 16
4 Appendix ............................................................................................................................ 18
4.1 Summary of Error Codes ............................................................................................................... 18
www.simcom.com 1 /21
A7600 Series_MQTT(S)_Application Note_V1.00
1 Introduction
1.1 Purpose of the document
Based on module AT command manual, this document will introduce MQTTS application process.
Developers could understand and develop application quickly and efficiently based on this document.
1.2 Related documents
[1] A7600 Series_AT Command Manual
1.3 Conventions and abbreviations
In this document, the GSM engines are referred to as following term:
ME (Mobile Equipment);
MS (Mobile Station);
TA (Terminal Adapter);
DCE (Data Communication Equipment) or facsimile DCE (FAX modem, FAX board);
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:
MQTT(Message Queuing Telemetry Transport);
SSL(Secure Sockets Layer);
PDP(Packet Data Protocol);
www.simcom.com 1 /21
A7600 Series_MQTT(S)_Application Note_V1.00
1.4 The process of Using MQTT(S) AT Command
Power on the module
Check the status of SIM card or
Reboot the module
SIM Card Status:
Execute AT+CPIN?,if response is
+CPIN:READY,means SIM Card Status is
normal.Reboot the module or check SIM
card status if AT+CPIN? Fails to identify
SIM card in 20s.
Signal quality:
Execute AT+CSQ to query signal quality.If
rssi is equals to 99,please check SIM card
status or reboot the module
CS Service:
If
of AT+CREG? equals to 1,it means
that the module has registered on CS
domain service.Reboot the module if fals
to registered on CS domain.
PS Serivce:
If of AT+CGREG?/AT+CEREG? equals
to 1,it means that the module has
registered on PS domain service.
Query SIM card status by AT+CPIN?
+CPIN: READY
Query signal quality by AT+CSQ
+CSQ: ,,0 < rssi < 31
Query CS service by AT+CREG?
+CREG: 0,1
Query PS service by
AT+CGREG?/AT+CEREG?
UE system information:
If is “NO SERVICE”,it
means network status has some problem.
Query UE information by AT+CPSI?
NO SERVICE
PDP Context:
1.Configure PDP Context by
AT+CGDCONT=,,
2.Activate the PDP Context by
AT+CGACT=,[]
3.Query IP address of the PDP context by
AT+CGACT?
Configure the PDP context by
AT+CGDCONT
Active the PDP context by
AT+CGACT=,[] and
AT+CGACT?
PDP ACTIVE FAIL
AT+CMQTTSTART:
AT+CMQTTSTART also can activate the
PDP Context.But It can not customize PDP
activation parameters.
AT+CMQTTSTART
(PDP active and initialize
MQTT(S) service)
AT+CSSLCFG:
If choosing MQTTS,you should use
AT+CSSLCFG to select the SSL context.
AT+CMQTTACCQ
(MQTTS or MQTT?)
Yes
AT+CSSLCFG
(Set the SSL context id for
MQTTS session)
AT+CFTPSLOGIN:
You can change the parameter
to login a FTP server/FTPS
server.
No
AT+CMQTTCONNECT
(Connect to a MQTT(S)
server)
CMQTTSUBTOPIC can
set up to ten topic
AT+CMQTTTOPIC
(Set the topic for
publish)
AT+CMQTTSUBTOPIC
(Set the topic for
subscribe)
AT+CMQTTSUB
(subscribe a
message to server)
AT+CMQTTPAYLOAD
(Set the message body
of a publish message)
AT+CMQTTUNSUB
(Unsubscribe a
message to server)
AT+CMQTTSUB
(Subscribe a
message to server)
AT+CMQTTPUB
(Publish a message to
server)
AT+CMQTTDISC
(Disconnect from the
server)
AT+CMQTTSTOP
(stop MQTT service)
CMQTTUNSUBTOPIC
can set up to ten topic
AT+CMQTTUNSUBTOPIC
(Set the topic for
unsubscribe)
AT+CMQTTUNSUB
(Unsubscribe a message
to server)
www.simcom.com 1 /21
A7600 Series_MQTT(S)_Application Note_V1.00
1.5 Error Handling
For more details, please refer to A7600 Series_AT Command Manual.
www.simcom.com 1 /21
A7600 Series_MQTT(S)_Application Note_V1.00
2 AT Commands for MQTT(S)
2.1 Overview of AT Commands for MQTT(S)
Command
AT+CMQTTSTART
AT+CMQTTSTOP
AT+CMQTTACCQ
AT+CMQTTREL
AT+CMQTTSSLCFG
AT+CMQTTWILLTOPIC
AT+CMQTTWILLMSG
AT+CMQTTCONNECT
AT+CMQTTDISC
AT+CMQTTTOPIC
AT+CMQTTPAYLOAD
AT+CMQTTPUB
AT+CMQTTSUBTOPIC
AT+CMQTTSUB
AT+CMQTTUNSUBTOPIC
AT+CMQTTUNSUB
AT+CMQTTCFG
For detail information, please refer to “A7600 Series_AT Command Manual”.
Description
Start MQTT service
Stop MQTT service
Acquire a client
Release a client
Set the SSL context (only for SSL/TLS MQTT)
Input the topic of will message
Input the will message
Connect to MQTT server
Disconnect from server
Input the topic of publish message
Input the publish message
Publish a message to server
Input the topic of subscribe message
Subscribe a message to server
Input the topic of unsubscribe message
Unsubscribe a message to server
Configure the MQTT Context
www.simcom.com 1 /21