Part Number:CC3200-LAUNCHXL
Hello,
I'm trying to connect to AWS IoT using MQTT Client example of SDK 1.3 with a CC3200, but it's not working.
Here is the output on my serial terminal:
This is what i have going till date:
- On the AWS IoT side, I created a "thing", a policy to access that thing, linked it to one another and generated the certificates.
- I made the conversion of the three .PEM certificates to .DER using OpenSSL.
- To test whether the certificates and settings in AWS were correct, I tried to post a data in AWS using MQTT.fx. This worked normally and I was able to publish the data.
- From that point, I returned to the CC3200 and began to customize the "MQTT Client Exemple" according to the needs of AWS IoT:
#define MQTT_3_1_1 true #define MQTT_3_1 false #define WILL_QOS QOS0 #define SERVER_ADDRESS "a2ofr87029z36p.iot.us-east-2.amazonaws.com" #define PORT_NUMBER 8883 #define SERVER_MODE MQTT_3_1_1 #define PUB_TOPIC_FOR_SW3 "myTopic1" #define PUB_TOPIC_FOR_SW2 "myTopic2" #define SL_SSL_KEY_CERT "/cert/private.der" #define SL_SSL_CLIENT_CERT "/cert/client.der" #define SL_SSL_CA_CERT "/cert/ca.der" #define DAY 10 #define MONTH 5 #define YEAR 2018 #define HOUR 16 #define MINUTE 0 #define SECOND 0 char *security_file_list[4] = { SL_SSL_KEY_CERT, SL_SSL_CLIENT_CERT, SL_SSL_CA_CERT, NULL }; connect_config usr_connect_config[] = { { { #ifdef USE_SSL { SL_MQTT_NETCONN_SEC | SL_MQTT_NETCONN_URL, SERVER_ADDRESS, PORT_NUMBER, SL_SO_SEC_METHOD_TLSV1_2, 0xFF, 4, security_file_list }, #else { SL_MQTT_NETCONN_URL, SERVER_ADDRESS, PORT_NUMBER, 0, 0, 0, NULL }, #endif SERVER_MODE, true, }, NULL, "user1", NULL, NULL, true, KEEP_ALIVE_TIMER, {Mqtt_Recv, sl_MqttEvt, sl_MqttDisconnect}, TOPIC_COUNT, {TOPIC1, TOPIC2, TOPIC3}, {QOS0, QOS0, QOS0}, {WILL_TOPIC,WILL_MSG,WILL_QOS,WILL_RETAIN}, false } }; SlDateTime_t g_time; g_time.sl_tm_day = DAY; g_time.sl_tm_mon = MONTH; g_time.sl_tm_year = YEAR; g_time.sl_tm_sec = SECOND; g_time.sl_tm_hour = HOUR; g_time.sl_tm_min = MINUTE; sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION, SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME, sizeof(SlDateTime_t), (unsigned char *)(&g_time)); SlDateTime_t dateTime = {0}; _u8 configLen = sizeof(SlDateTime_t); _u8 configOpt = SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME; sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&configOpt, &configLen,(_u8 *)(&dateTime)); UART_PRINT("******************************************************\n\r"); UART_PRINT("Day %d, Mon %d,Year %d, Hour %d, Min %d, Sec %d\n",dateTime.sl_tm_day,dateTime.sl_tm_mon, dateTime.sl_tm_year, dateTime.sl_tm_hour, dateTime.sl_tm_min, dateTime.sl_tm_sec); UART_PRINT("******************************************************\n\r"); // // Initialze MQTT client lib // lRetVal = sl_ExtLib_MqttClientInit(&Mqtt_Client);
5. And then I flashed all the certificates using UniFlash:
After all the above steps, I still can not connect to the Broker.
Someone, please, have any suggestions?
Tiago Silva.