This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3230SF: CC3235SF FreeRTOS MQTT Example Fails to Connect (Errors –111, –456, –468, –2006)

Part Number: CC3230SF
Other Parts Discussed in Thread: CC3235SF, CC3200

Tool/software:

I’m using TI’s CC3235SF LaunchXL FreeRTOS MQTT example to connect over Wi-Fi to my own broker (HiveMQ), but MQTTClient_Connect() fails with errors –111, –456, –468, and –2006. What exact certificate format (PEM vs. DER, root vs. chain), TLS parameters, and example settings (including how to populate Mqtt_Client_secure_files and MQTTClient_ConnParams) are required to establish a successful secure connection to the MQTT so I can subscribe and publish messages?

below are changes and results obtained:

Code modified in the main example project:

#define WILL_TOPIC "devices/865031063735368/telemetry"
#define WILL_MSG "Client start to test"
#define WILL_QOS MQTT_QOS_2
#define WILL_RETAIN false

/* Defining Broker IP address and port Number */
#define SERVER_ADDRESS "mqtt.mssve.ai"
#define SECURED_PORT_NUMBER 8883

#define SUBSCRIPTION_TOPIC0 "devices/865031063735368/telemetry"

/* Defining Publish Topic Values */
#define PUBLISH_TOPIC0 "devices/865031063735368/telemetry"
#define PUBLISH_TOPIC0_DATA \
"This is the testing results"

/* Defining Enrolled Topic Values. */
#define ENROLLED_TOPIC "devices/865031063735368/telemetry"

char ClientId[13] = "Inno1234";

/* Client User Name and Password */
const char *ClientUsername = "test";
const char *ClientPassword = "1234";

/* Server User Name and Password */
const char *ServerUsername = "test";
const char *ServerPassword = "1234";

#ifdef SECURE_CLIENT

char *Mqtt_Client_secure_files[CLIENT_NUM_SECURE_FILES] = {"isrgrootx1.der"};

MQTTClient_ConnParams Mqtt_ClientCtx =
{
MQTTCLIENT_NETCONN_SEC | MQTT_DEV_NETCONN_URL,
SERVER_ADDRESS, //SERVER_ADDRESS,
SECURED_PORT_NUMBER, // PORT_NUMBER
SLNETSOCK_SEC_METHOD_SSLv3_TLSV1_2,
SLNETSOCK_SEC_CIPHER_FULL_LIST,
CLIENT_NUM_SECURE_FILES,
Mqtt_Client_secure_files
};

#ifdef SECURE_SERVER
/* In order to use secured socket method, cipher, n_files and secure_files */
/* must be configured. certificates also must be programmed */
/* ("server-key.pem", "server-cert.pem") */
#define SERVER_NUM_SECURE_FILES 2
char *Mqtt_Server_secure_files[SERVER_NUM_SECURE_FILES] =
{ "isrgrootx1.pem", "isrgrootx1.der"};

MQTTServer_ConnParams Mqtt_Server =
{
SECURED_PORT_NUMBER,
SLNETSOCK_SEC_METHOD_SSLv3_TLSV1_2,
SLNETSOCK_SEC_CIPHER_FULL_LIST,
SERVER_NUM_SECURE_FILES,
Mqtt_Server_secure_files
};


Output:

[NETAPP EVENT] IP acquired by the device
Device came up in Station mode
[WLAN EVENT] STA Connected to the AP: Innowave , BSSID: a6:a4:6b:a4:97:7c
[NETAPP EVENT] IP acquired by the device

Device has connected to Innowave
Device IP Address is 192.168.100.137

Create MQTT client successfully
Client thread created successfully
MQTT client set successfully
..........Connection to broker failed, Error code: -111

CC3200 Publishes the following message
Topic: devices/865031063735368/telemetry
Data: This is the testing results

On-board Client Disconnected
In order to reconnect local client, Reset board.

Aiman,