Unable to Connect a Client to MQTT Server

Thanks for the quick replay.

I tested as per the document you shared earlier. But I am unable to connect the MQTT client.I don’t know how to connect with the MQTT client.This is the priority task for me on my project. can any one tell me how to connect with the mqtt client.Please find the below log for testing of Mqtt connection.

AT
OK
AT+CPIN?
+CPIN: READY
OK
AT+CREG?
+CREG: 0,1
OK
AT+CGATT?
+CGATT: 1
OK
AT+QCFG=“nwscanmode”,0
OK
AT+QCFG=“iotopmode”,1
ERROR
AT+QCFG=“iotopmode”,0
ERROR
AT+QFDEL="*"
OK
AT+QFUPL=“cacert.pem”,1206,5000
CONNECT
+QFUPL: 1206,5a63
OK
AT+QFUPL=“client.pem”,1224,5000
CONNECT
+QFUPL: 1224,d7a
OK
AT+QFUPL=“user_key.pem”,1679,5000
CONNECT
+QFUPL: 1679,243e
OK
AT+QFLST
+QFLST: “UFS:user_key.pem”,1679

+QFLST: “UFS:cacert.pem”,1206

+QFLST: “UFS:client.pem”,1224
OK
AT+QICSGP=1,1,“airtelgprs.com”,"","",0
OK
AT+QIACT=1
ERROR
AT+QIACT=?
+QIACT: (1-16)
OK
AT+QICSGP=1,1,“airtelgprs.com”,"","",1
OK
AT+QIACT=1
ERROR
AT+QIACT?
OK
AT+QIACT=1
ERROR
AT+QSSLCFG=“cacert”,2,“cacert.pem”
OK
AT+QSSLCFG=“clientcert”,2,“client.pem”
OK
AT+QSSLCFG=“clientkey”,2,“user_key.pem”
OK
AT+QSSLCFG=“seclevel”,2,2
OK
AT+QSSLCFG=“sslversion”,2,4
OK
AT+QSSLCFG=“ciphersuite”,2,0xFFFF
OK
AT+QSSLCFG=“ignorelocaltime”,2,1
OK
AT+QMTCFG=“SSL”, 0, 1, 2
OK
AT+QMTCFG=“version”,0,4
OK
AT+QIACT=1
OK
AT+QIDNSCFG=1,“8.8.8.8”,“8.8.4.4”
OK
AT+QMTOPEN=0,“xxxxxxxxxxxx-xxx.xxx.xx-xxxx-x.amazonaws.com”,8883
OK
+QMTOPEN: 0,0
AT+QMTCONN=0,“xxxxxxxxxx”
OK
+QMTCONN: 0,1
+QMTSTAT: 0,3

Please tell me is there any configurations missing on the above log file.

[xxxxxxxxxxxx-xxx.xxx.xx-xxxx-x.amazonaws.com](http://xxxxxxxxxxxx-xxx.xxx.xx-xxxx-x.amazonaws.com Can this domain name be parsed successfully?
AT+QIDNSGIP=1," xxxxxxxxxxxx-xxx.xxx.xx-xxxx-x.amazonaws.com"

Thank you for Quick response.

I tried the above command still same error. The MQTT is not connect with client.

AT+QIDNSCFG=1,“8.8.8.8”,“8.8.4.4”
OK
AT+QIDNSGIP=1,“a1jdqnbvy5dt1m-ats.iot.us-west-2.amazonaws.com
OK
+QIURC: “dnsgip”,0,5,60
+QIURC: “dnsgip”,“44.235.167.60”
+QIURC: “dnsgip”,“52.35.54.133”
+QIURC: “dnsgip”,“54.200.4.34”
+QIURC: “dnsgip”,“52.38.75.204”
+QIURC: “dnsgip”,“52.42.195.122”
AT+QMTOPEN=0,“a1jdqnbvy5dt1m-ats.iot.us-west-2.amazonaws.com”,8883
OK
+QMTOPEN: 0,-1
AT+QMTOPEN=1,“a1jdqnbvy5dt1m-ats.iot.us-west-2.amazonaws.com”,8883
OK
+QMTOPEN: 1,0
AT+QMTCONN=1,“TestIoThings”
OK
+QMTCONN: 1,1
+QMTSTAT: 1,3

i am unable to found the exact problem. Can you please tell me the why always the connection is not happening with MQTT client.

I tried with public MQTT broker. The connection is established and subscribe the topic and publish the data also working fine.
At the time of using AWS server the MQTT client is not Connected.
Is there any firmware upgrade is needed.If you have updated firmware files Please share.

Thanks

AT
OK
AT+CPIN?
+CPIN: READY

OK
AT+CREG?
+CREG: 0,1

OK
AT+CGATT?
+CGATT: 1

OK
AT+QMTCFG=“recv/mode”,1,1,1
OK
AT+QMTCFG=“pdpcid”,1,1,1
OK
AT+QMTOPEN=0,“broker.hivemq.com”,1883
OK

+QMTOPEN: 0,0

+QMTSTAT: 0,1
AT+QMTOPEN=0,“broker.hivemq.com”,1883
OK

+QMTOPEN: 0,0
AT+QMTCONN=0,“635394af302d4366bce82e54d5a687d1”
OK

+QMTCONN: 0,0,0
AT+QMTSUB=0,1,“EG95_ARGUS”,2
OK

+QMTSUB: 0,1,0,2
AT+QMTPUBEX=0,1,1,0,“EG95_ARGUS”,12

123456788888
OK
88889
+QMTRECV: 0,51,“EG95_ARGUS”,12,“123456788888”

+QMTPUBEX: 0,1,0
Above is the log for public MQTT broker.

I am also getting same error.
please help.
I am using EC200-U module
AT+QMTCONN=0,“wqm_test_06”

OK

+QMTCONN: 0,1

+QMTSTAT: 0,3

I’m facing the same issue with BG96 whose firmware is “Revision: BG96MAR03A09M1G”.

[2022-10-22 05:16:26,532] [Thread-TX] Write: AT+QMTCONN=0,"IoT-device1"
[2022-10-22 05:16:26,557] [Thread-RX] Read: AT+QMTCONN=0,"IoT-device1"
[2022-10-22 05:16:26,575] [Thread-RX] Read: OK
[2022-10-22 05:16:32,215] [Thread-RX] Read: 
[2022-10-22 05:16:32,227] [Thread-RX] Read: +QMTSTAT: 0,3

In my case, I got the following result to AT+QIDNSGIP=,.

[2022-10-22 06:17:56,563] [Thread-TX] Write: AT+QIDNSGIP=1,"hoge-ats.iot.ap-northeast-1.amazonaws.com"
[2022-10-22 06:17:56,638] [Thread-RX] Read: AT+QIDNSGIP=1,"hoge-ats.iot.ap-northeast-1.amazonaws.com"
[2022-10-22 06:17:56,638] [Thread-RX] Read: OK
[2022-10-22 06:17:56,838] [Thread-RX] Read: 
[2022-10-22 06:17:56,851] [Thread-RX] Read: +QIURC: "dnsgip",0,5,60
[2022-10-22 06:17:56,851] [Thread-RX] Read: 
[2022-10-22 06:17:56,882] [Thread-RX] Read: +QIURC: "dnsgip","52.196.145.xxx"
[2022-10-22 06:17:56,882] [Thread-RX] Read: 
[2022-10-22 06:17:56,926] [Thread-RX] Read: +QIURC: "dnsgip","13.115.199.yyy"
[2022-10-22 06:17:56,926] [Thread-RX] Read: 
[2022-10-22 06:17:56,956] [Thread-RX] Read: +QIURC: "dnsgip","54.178.200.zzz"
[2022-10-22 06:17:56,956] [Thread-RX] Read: 
[2022-10-22 06:17:57,000] [Thread-RX] Read: +QIURC: "dnsgip","52.192.237.aaa"
[2022-10-22 06:17:57,000] [Thread-RX] Read: 
[2022-10-22 06:17:57,000] [Thread-RX] Read: +QIURC: "dnsgip","52.69.14.bbb"

Also, I read the document “BG96_MQTT_Attach_AWS_IoTCore_Application_Note.pdf” and modified my AT-command-sequence but I got the error.

I solved my connection problem.
What I did was send “AT+QPRTPARA=3” to BG96 to restore the factory settings.

cf. BG96: AT command to reset non-volatile settings to default?

@herbert.pan-Q
I have same issue with EC20 GSM module. I am unable to connect to AWS IOT CORE. EC20 GSM Firmware version is EC20CEFILGR06A05M1G. Is this version supports AWS ??

Thanks in advance for you your support!

  • Are you trying to connect to AWS using 4G network ?

@herbert.pan-Q
Yes .I am using EC20 GSM module.

Is the current module registration network successful? Did you add SNI?

@herbert.pan-Q
Yes, registration network successful. How to add SNI & where is to be added?

@herbert.pan-Q
Thank you for your response!
I will add & test it .Will let you know.

@herbert.pan-Q
I added SNI command. But still I am not able to connect to AWS IOT Core MQTT server. Connection opened successfully but client not connecting to server and received response as +QMTSTAT: 0,1.

I suggest that you first use mqtt.fx tool for verification, preliminary judgment may be caused by CA authentication failure

@herbert.pan-Q
Thank you so much for your response & help. Now I am able to connect to AWS IOT Core server. Also I am able to configure last will for IOT device without SSL ,now I have to do same with SSL. How to do that ?Any suggestion will be very helpful.

AT+QMTCFG=“will”,[,<will_fg>[,<will_qos>,<will_retain>,“<will_topic>”,“<will_msg>”]]
AT+QMTCFG=“will”,0,1,1,0,“will/topic”,xx

@herbert.pan-Q
Yes, I used above AT command for configuring last will .But this is working for without SSL. I want to configure same for AWS IOT Core (i.e. using SSL commands).I configured last will with SSL commands ,but I am unable to connect to AWS IOT core.