BG95-M2 unable to connect to AWS IoT using QuecOpen

Hi,

I have been trying to connect to AWS Core IoT using the BG95-M2 modem using a modified version of the mqtt QuecOpen example project from Quectel_BG95_QuecOpen_SDK_Package_V1.1.7. My modem is running the following firmware version: BG95M2LAR02A04_01.009.01.009

Currently, the device is unable to connect to the server using QuecOpen, always returning error code -20044 (see QuecOpen debug output below). I have tested the same setup using AT commands and have no issues connecting (see AT command debug output below).

My QuecOpen code has been thoroughly checked against all of the examples provided by Quectel for connecting to AWS using QuecOpen and setting up certs etc using the file AWS_MQTT_1click_cert+selfsigned_CA_setup_instruction_tony_0213.

Just wondering if somebody might be able to help me with this? Is there a newer version of the SDK and/or Firmware that I should be using instead?

QuecOpen debug output:

MQTT Task Start...
Initializes the DSS netctrl library
qapi_DSS_Init success
Registering Callback tcp_dss_handle
tcp_dss_handle 193497970, status 0
Registed tcp_dss_handler success
Setting tech to Automatic
Setting APN - mdata.net.au
Setting family to IPv4
qapi_DSS_Start_Data_Call start!!!.
Start Data service success.
Data test event callback, event: 1
Data Call Connected.
SIGNAL EVENT IS [4]
DSS_SIG_EVT_CONN_E Signal
<--- static IP address information --->
static IP: 10.70.1.146
Gateway IP: 10.70.1.145
Primary DNS IP: 101.168.244.106
Second DNS IP: 101.168.244.100
<--- End of system info --->
conn_mqtt entry
@@@j = 1
Primary DNS IP: 101.168.244.106
Second DNS IP: 101.168.244.100
Start DNSc.........device_name: rmnet_data0
hostname: a2tejm37fl2egx-ats.iot.ap-southeast-2.amazonaws.com is resoling in interface: rmnet_data0
reshost ret: 0

a2tejm37fl2egx-ats.iot.ap-southeast-2.amazonaws.com --> 13.238.71.228
Reading EFS file size 1187 
Read /datatx/AmazonRootCA1.pem, result 0
mqtt_calist.bin qapi_Net_SSL_Cert_Convert_And_Store: 0
Reading EFS file size 1224 
Read /datatx/certificate.pem.crt, result 0
Reading EFS file size 1675 
Read /datatx/private.pem.key, result 0
mqtt_cert.bin qapi_Net_SSL_Cert_Convert_And_Store: 0
client_len=15, client_str=QUECTEL_TEST_01
mqtt_cli_connect entry
Mqtt Context created success, ctx=0x8a6ee7f4
Connecting...
MQTT Connect Failed, Error type -20044
subscribing...
MQTT Subscribe Failed, Error type -1
Published trying...
MQTT Publish Failed, Error type -1
Disconnecting...
MQTT Disconnect Failed, Error type -1
Data test event callback, event: 2
Data Call Disconnected.
SIGNAL EVENT IS [16]
DSS_SIG_EVT_EXIT_E Signal
Release data service handle success

AT command debug output:

AT+QGMR
BG95M2LAR02A04_01.009.01.009

OK
AT+CEREG=2
OK
AT+QFLST="*"
+QFLST: "AmazonRootCA1.pem",1187
+QFLST: "certificate.pem.crt",1224
+QFLST: "private.pem.key",1675

OK
AT+CGDCONT=1,"IP","mdata.net.au"
OK
AT+CGPADDR=1
+CGPADDR: 1,10.70.1.146

OK
AT+COPS?
+COPS: 0,0,"Telstra",8

OK
AT+CEREG?
+CEREG: 2,1,"8003","8D9A80C",8

OK
AT+QSSLCFG="sslversion",1,4
OK
AT+QSSLCFG="ciphersuite",1,0x0035
OK
AT+QSSLCFG="seclevel",1,2
OK
AT+QSSLCFG="negotiatetime",1,300
OK
AT+QSSLCFG="cacert",1,"AmazonRootCA1.pem"
OK
AT+QSSLCFG="clientcert",1,"certificate.pem.crt"
OK
AT+QSSLCFG="clientkey",1,"private.pem.key"
OK
AT+QSSLCFG="ignorelocaltime",1,0
OK
AT+QSSLCFG="sni",1,1
OK
AT+QMTCFG="pdpcid",0,1
OK
AT+QMTCFG="ssl",0,1,1
OK
AT+QMTCFG="version",0,4
OK
AT+QMTOPEN=0,"a2tejm37fl2egx-ats.iot.ap-southeast-2.amazonaws.com",8883
OK

+QMTOPEN: 0,0
AT+QMTCONN=0,"MQTT"
OK

+QMTCONN: 0,0,0
AT+QMTPUBEX=0,0,0,0,"myTopic","Hello"
OK

+QMTPUB: 0,0,0
AT+QMTDISC=0
OK

Kind regards,
Sam.

Based on your debug log (via API) , this fault come from the certificate of CA . But as you said , you can publish the message via AT sucessfully ,

pls double check your CA certificate , if you met trouble still ,pls send email to stephen.li@quectel.com , I wil send the log tools for more analysis .