Hi All,
I have tested AWS IoT sample.
It can successfully connect to AWS IoT server for MQTT function.
However, I found that sample is hard to use because it is not like TI's sample code format.
And I am trying to use TI's MQTT sample to connect to AWS IoT.
Here is my code for configuration:
/*Defining Broker IP address and port Number*/
#define SERVER_ADDRESS "XXXXXXXXXXXXX.iot.ap-northeast-1.amazonaws.com"
#define PORT_NUMBER 8883
char *security_file_list[] = {"/cert/private.key", "/cert/client.pem", "/cert/ca.pem"};
/* connection configuration */
connect_config usr_connect_config[] =
{
{
{
{
SL_MQTT_NETCONN_SEC, //SL_MQTT_NETCONN_URL, /**< Enumerate connection type */
SERVER_ADDRESS, /**< Server Address: URL or IP */
PORT_NUMBER, /**< Port number of MQTT server */
SL_SO_SEC_METHOD_TLSV1_2, //0 /**< Method to tcp secured socket */
SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, //0, /**< Cipher to tcp secured socket */
3, //0, /**< Number of files for secure transfer */
security_file_list, //NULL /* SL needs 4 files*/
},
SERVER_MODE,
true,
},
NULL,
(unsigned char*) CLIENT_ID,
NULL,
NULL,
true,
KEEP_ALIVE_TIMER,
{Mqtt_Recv, sl_MqttEvt, sl_MqttDisconnect},
TOPIC_COUNT,
{TOPIC1, TOPIC2}, //, TOPIC3},
{QOS2, QOS2}, //, QOS2},
{WILL_TOPIC,WILL_MSG,WILL_QOS,WILL_RETAIN},
false
}
};
Before connect to MQTT broker, I already set current time with
retVal = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
sizeof(SlDateTime_t),(unsigned char *)(&g_time));
The CA, Client, key files are flashed to CC3200 on Uniflash.
The CA, Client, Key files can be used on IoT sample successfully
but it seems cannot use same setting on MQTT demo code.
It cannot connect to server on MQTT sample code.
Does anyone have experience about this?
Thank you.
Best Regards,
Bryan