I am using the BG96 module and the SDK v 4.3.6. I am trying to run the example threadx MQTT application using an open source mqtt server(test.mosquitto.org), however, I am running into issues in connecting to the server. Below are pictures of the error debug messages and the
parameters that I have set in the code, respectively.
PLEASE NOTE that I am able to open, connect, publish, and subscribe using the AT commands to the mosquitto test server so I am unsure why the same parameters given into the demo application are not working as intended.
A quick update of the error logs that I am receiving on BG96 dev kit when running ThreadX MQTT demo application (example_mqtt.c). SDK version is 4.3.6. We are attempting to connect to Microsoft Azure IoT Hub server. An image of the server parameters/credentials is also included below.
Thank you for the response! As you suggested, I have attempted to connect to mqtt.eclipse.org @ port 8883 and used the CA certificate you have provided, however, we are now encountering another issue. When the application goes through the SSL checks and attempts to convert and store to mqtt_cert.bin(MQTT_CERT_BIN), BG96 crashes, and restarts the application repeatedly. Images of our configurations, Logs, and the line where the application crashes are provided below.
server name configuration in header file
mqtt parameter configuration in C file
Full CA certificate NOTE: client key and client cert are kept empty.
As seen in the log screenshot, the CA cert, Client, cert, and Client key are able to be read hence API returning 0, however, when the app gets to qapi_Net_SSL_Cert_Convert_And_Store(&cert_info, MQTT_CERT_BIN); (as seen in image below)
it will crash BG96 and restart the application.
Is this an issue with the certificates? I am not sure why qapi_Net_SSL_Cert_And_Store() API is fine with MQTT_CALIST_BIN but not MQTT_CERT_BIN as 2nd parameter. Perhaps it is because client cert and client key are kept empty? CA cert is the only thing that contains a certificate.
Okay, we are now running only convert and store on the CA root certificate and the board doesn’t crash anymore!
We are still getting error -20044 however, which is SSL connection error. Not sure why this is as the CA cert successfully converts and stores with the api returning 0 on success.
We have also tried SAS with username and password and ssl disabled, however, we still get error -20044. Is there a special format for how username and password should be? We followed the format found on microsoft azure site: connect to azure iot hub directly as device
On a side note: I have re-tried connecting to port 1883(mqtt.eclipse.org and test.mosquitto.org) and it works. I had to remove username and password for the configuration as keeping it empty is considered a bad parameter. which yields error -20026 = bad parameter on API call.
Thank you for the reference, however, I am trying to connect to Azure IoT Hub using the sample threadx applications provided by Quectel. In Your reference, you are using AT commands which I have been successful in using to connect to Azure IoT Hub.