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

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 -
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:
Gateway IP:
Primary DNS IP:
Second DNS IP:
<— End of system info —>

                       "MQTT Starts from Here 


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

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
MQTT Connect Failed, Error type -20044
Now Subscribing mqtt Service
MQTT Subscribe Failed, Error type -1
Now Publishing on mqtt Service
Published trying…
MQTT Publish Failed, Error type -1
Topic : SignAge
Going for wait/ Sleep mode
Serial port COM11 closed