Are there any working examples using MQTT protocol to connect CC3200 to Azure IoT hub.
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.
Hi Emilio!
This isn't exactly provided in the CC3200 SDK, but there are both MQTT client and server examples. This page may help you get started with Azure:
You can also find some references provided by the community that may help you out. For example, the following -
https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/389386
Best Regards,
Ben
Hi Ben
Have gone through heaps of examples but keep getting "broker connect fail for conn 1" error. Am using mqtt_client sample with connect_config structure set as follows:
connect_config usr_connect_config[] =
{
{
{
{
SL_MQTT_NETCONN_URL | SL_MQTT_NETCONN_SEC,
SERVER_ADDRESS, /* XXXX.azure-devices.net */
PORT_NUMBER, /* 8883 */
SL_SO_SEC_METHOD_TLSV1_1,
SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA,
1,
security_file_list /* == { NULL, NULL, "/cert/ms.der" } */
},
SERVER_MODE, /* MQTT_3_1_1 */
true,
},
NULL,
"myFirstDevice",
"XXXX.azure-devices.net/myFirstDevice",
"SharedAccessSignature sr=XXXX.azure-devices.net%2Fdevices%2FmyFirstDevice&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=1476363479",
true,
KEEP_ALIVE_TIMER,
{Mqtt_Recv, sl_MqttEvt, sl_MqttDisconnect},
TOPIC_COUNT,
{TOPIC1},
{QOS1},
{WILL_TOPIC,WILL_MSG,WILL_QOS,WILL_RETAIN},
false
}
};
ms.der is certificate used in sdk http iothub example provided by which in this case connected and sent messages. I verified the location ofthe ms.der file using uniflash.
Also included set_time() function from sdk http example before connect:
static int set_time()
{
SlDateTime_t dt;
struct tm startTime = {0};
time_t ts;
dt.sl_tm_day = DAY;
dt.sl_tm_mon = MONTH;
dt.sl_tm_year = YEAR;
dt.sl_tm_hour = HOUR;
dt.sl_tm_min = MINUTE;
dt.sl_tm_sec = SECOND;
sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
sizeof(SlDateTime_t),(unsigned char *)(&dt));
/* Set system clock on application microcontroller */
startTime.tm_mday = DAY;
startTime.tm_mon = MONTH - MONTHDIFF;
startTime.tm_year = YEAR - YEARDIFF;
startTime.tm_hour = HOUR;
startTime.tm_min = MINUTE;
startTime.tm_sec = SECOND;
ts = mktime(&startTime);
Seconds_set(ts - (unsigned int) TIMEDIFF);
return SUCCESS;
}
Not sure what to do next.
Thanks
Emilio