ThreadX AWSMQTT with BG95

I am using the ThreadX With the BG95 and I am using the AWS IOT Core (MQTT),

  • When I am running the AWS MQTT with the AT command it’s working fine.

  • When I am using the ThreadX with AWS MQTT it’s not working. Please suggest how we can start communication with ThreadX and AWS MQTT>

The below link include the resource to connect AWS mqtt

https://cnquectel-my.sharepoint.com/:f:/g/personal/america-fae_quectel_com/EgowDGgjf6lJuVQSclqszDsBRx8HAWFR7-R-D0hTFXDY6g?e=Ixryt3

Pls pay more attention to " “AWS_MQTT_1click_cert+selfsigned_CA_setup_instruction_tony_0213”

Hello Stephen. Li
Thanks for your replay it’s very useful for me,

  • I generate the certificate as per your method it’s working with the AT command firmware version.

As I Share in the post It’s working fine BG95-M3 with the AT command,
When I shift over the “Threadx” that gives the following error.

After your feedback, we use your solution so we found this error.

Serial port COM11 opened
Debug$APN_Start: Type + Value

APN Type : Internal APN Selected.
MQTT Task Start…
TXM_Module Not Defined…
Now Creating MQTT Thread.
MQTT Thread Creation Done…
Now Going to Set GPS Thread…
GPS Byte Pool Done…
GPS Object Allocation in Process…
GPS Object Allocation done…
GPS Thread Creation in Process…
GPS Thread Creation Done…


       "Network Connection and Thread Init Start from Here

qapi_Device_Info_Init OK [0]
[dev_info] status, status 0
[dev_info] qapi_Device_Info_Set_Callback, status 0
Wait for Event Flag to trigger
~type[b] id[29] status[0]
QT# GPS quectel_task_entry…
tx_semaphore_create ok with status 0LOCATION_INIT SUCCESS
~type[b] id[29] status[0]
LOCATION RESPONSE CALLBACK err=0 id=4~type[b] id[29] status[1]
~type[b] id[29] status[0]

GPS Data Valid…
Location Lat : 022.79565
Location Long: 075.92740

Flag Set for “GPS Valid” Ok Done…!
Location DeInit Operation Done…!!!
Flag Read Operation Success…!!!
waiting for network registering…
network registered!
Initializes the DSS netctrl library
qapi_DSS_Init success
Registering Callback tcp_dss_handle
tcp_dss_handle -1069592726, status 0
Registed tcp_dss_handler success
Setting tech to Automatic
Setting APN - airtelgprs.com
Setting family to IPv4
qapi_DSS_Start_Data_Call start!!!.
Start Data service success.
Data test event callback, event: 1
Data Call Connected.
<— static IP address information —>
static IP: 100.76.20.87
Gateway IP: 100.76.20.88
Primary DNS IP: 202.56.224.143
Second DNS IP: 59.144.127.117
<— End of system info —>
SIGNAL EVENT IS [4]


                       "MQTT Starts from Here 

DSS_SIG_EVT_CONN_E Signal

Now Going to connect MQTT Serer
conn_mqtt entry
MQTT Server Details as:
@@@j = 1
Primary DNS IP: 202.56.224.143
Second DNS IP: 59.144.127.117
Start DNSc…device_name: rmnet_data0
hostname: api-dev.devicewise.com is resoling in interface: rmnet_data0
reshost ret: 0

api-dev.devicewise.com --> 52.200.8.131

Address: a2ty7neqvzspac-ats.iot.ap-south-1.amazonaws.com
Port : 8883
SSL Service Enabled and need to configure Certificates
Reading EFS file size 1188
Read /datatx/ca.crt, result 0
mqtt_calist.bin qapi_Net_SSL_Cert_Convert_And_Store: 0
Reading EFS file size 1224
Read /datatx/client.crt, result 0
Reading EFS file size 1675
Read /datatx/client.key, result 0
mqtt_cert.bin qapi_Net_SSL_Cert_Convert_And_Store: 0
client_len=1, client_str=1
username_len=3, username_str=abc
pwd_len=3, pwd_str=123
mqtt_cli_connect entry
Mqtt Context created success, ctx=0xef28c5d8
Connecting…
MQTT Connect Failed, Error type -20044
Now Subscribing mqtt Service
subscribing…
MQTT Subscribe Failed, Error type -1
Now Publishing on mqtt Service
Published trying…
MQTT Publish Failed, Error type -1
Topic : SignAge
{“IMD”:“AX0001”,“IMI”:“864475040105040”,“SIG”:“025”,“RTC”:“190421012725”,“CNT”:“00001”,“CMD”:“normal”,“acX”:“00123”,“acY”:“00123”,“acZ”:“00123”,“gyX”:“00123”,“gyY”:“00123”,“gyZ”:“00123”,“tmP”:“00123”,“lat”:“022.7956”,“lng”:“075.9274”}
Going for wait/ Sleep mode
Serial port COM11 closed