Other Parts Discussed in Thread: CC3220S, UNIFLASH
This code uses the netwifi.c file found in many of the examples to make the initial connection to the wlan, but afterwards it attempts a Secure TLS connection to the AWS IOT port, and fails with the -468 error.
This has been discussed in a few threads here with no solution that I can find. There are some workarounds that involve ignoring the connection error, but no solution.
I'm starting a new one because the others have died or become to confused.
Can someone at TI verify that this fails or works on different hardware than I'm using. I manually wrote the DER certificates/key files into directories mentioned.
I'm using a CC3220S LAUNCHXL Rev A.
//***************************************************************************** // includes //***************************************************************************** #include <stdlib.h> /* TI-DRIVERS Header files */ #include <ti/display/Display.h> #include <ti/drivers/net/wifi/simplelink.h> #include "uart_term.h" //**************************************************************************** // LOCAL FUNCTION PROTOTYPES //**************************************************************************** #define AWS_IOT_MQTT_HOST "a3joj5u9gv9t8f.iot.us-east-1.amazonaws.com" ///< Customer specific MQTT HOST. The same will be used for Thing Shadow #define AWS_IOT_MQTT_PORT 8883 ///< default port for MQTT/S #define AWS_IOT_ROOT_CA_FILENAME "/cert/root-ca.crt" ///< Root CA file name #define AWS_IOT_CERTIFICATE_FILENAME "/cert/545acc1c00-certificate.crt" ///< device signed certificate file name #define AWS_IOT_PRIVATE_KEY_FILENAME "/cert/545acc1c00-private.key" ///< Device private key filename extern void NetWiFi_init(); extern Display_Handle AWSIOT_display; //***************************************************************************** // //! mainThread //! //! \param pvParameters //! //! \return none //! //! \brief Task handler // //***************************************************************************** void *manualMainThread(void *arg0) { _i16 status = -1; _u32 DestinationIP; SlSockAddrIn_t Addr; _u8 secMethod = SL_SO_SEC_METHOD_SSLv3_TLSV1_2; /* Initialize SimpleLink */ NetWiFi_init(); // Assume no errors sl_NetAppDnsGetHostByName(AWS_IOT_MQTT_HOST, strlen(AWS_IOT_MQTT_HOST), &DestinationIP, SL_AF_INET); _i16 sHandle = sl_Socket(SL_AF_INET, SL_SOCK_STREAM, SL_SEC_SOCKET); sl_SetSockOpt(sHandle, SL_SOL_SOCKET, SL_SO_SECMETHOD, &secMethod, sizeof(secMethod)); sl_SetSockOpt(sHandle, SL_SOL_SOCKET, SL_SO_SECURE_FILES_CA_FILE_NAME, &AWS_IOT_ROOT_CA_FILENAME, strlen(AWS_IOT_ROOT_CA_FILENAME)); sl_SetSockOpt(sHandle, SL_SOL_SOCKET, SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME, &AWS_IOT_CERTIFICATE_FILENAME, strlen(AWS_IOT_CERTIFICATE_FILENAME)); sl_SetSockOpt(sHandle, SL_SOL_SOCKET, SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME, &AWS_IOT_PRIVATE_KEY_FILENAME, strlen(AWS_IOT_PRIVATE_KEY_FILENAME)); Addr.sin_family = SL_AF_INET; Addr.sin_port = sl_Htons(AWS_IOT_MQTT_PORT); Addr.sin_addr.s_addr = sl_Htonl(DestinationIP); // fail -468 error here status = sl_Connect(sHandle, (const SlSockAddr_t *)&Addr, sizeof(Addr)); if ( status < 0 ) { Display_printf(AWSIOT_display, 0, 0, "sl_Connect fail: %d\n", status); return (NULL); } sl_Close(sHandle); return (NULL); }