Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/CC3220SF-LAUNCHXL: Error(-12 ) Connecting to AWS IOT Core using Subscribe and Publish sample. Error in iot_tls_read function (recv() returned 0)

$
0
0

Part Number:CC3220SF-LAUNCHXL

Tool/software: TI-RTOS

Hello,

Recently i program the CC3220SF-LAUNCHXL with Subscribe_publish_sample program to connect to the AWS IOT Core. But i cannot able to connect the AWS IOT Server , the IOT AWS Server is not Sending ACK response.(iot_tls_read function  (recv() returned 0))

Versions Info

Simplink Version : simplelink_cc32xx_sdk_2_30_00_05

AWS IOT Plugin : aws_cc32xx_2_10_00_04
Service pack : sp_3.9.0.6_2.0.0.0_2.2.0.6.bin


Application fails in the aws_iot_mqtt_internal_wait_for_read() function and returns Error NETWORK_SSL_READ_ERROR.

File Name : aws_iot_mqtt_client_connect.c+424

/* send the connect packet */
rc = aws_iot_mqtt_internal_send_packet(pClient, len, &connect_timer);
if(SUCCESS != rc) {
FUNC_EXIT_RC(rc);
}

/* this will be a blocking call, wait for the CONNACK */

rc = aws_iot_mqtt_internal_wait_for_read(pClient, CONNACK, &connect_timer);

if(SUCCESS != rc) {

FUNC_EXIT_RC(rc);

}

NOTE : The Yellow highlighted function fails because the sub function recv() in iot_tls_read() return 0.

My Various Configuration are as Follows.

1. aws iot configuration

#define AWS_IOT_MQTT_HOST "xxxxxxxxxxxxxx-ats.iot.ap-south-1.amazonaws.com"

#define AWS_IOT_MQTT_PORT 8883

#define AWS_IOT_MQTT_CLIENT_ID "arn:aws:iot:ap-south-1:xxxxxxxxxxxx:thing/aws_iot"

#define AWS_IOT_MY_THING_NAME "aws_iot"

2. AWS policy in aws iot core server

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:*",
"Resource": "*"
}
]
}

My Certificate files are formatted like this


I am Using ats endpoint in Mumbai Region. The Root CA Certificate is used is RSA 2048 Bit Key.

unsigned char root_ca_pem[] =
"-----BEGIN CERTIFICATE-----\r\n"
"MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\r\n"

<>
"rqXRfboQnoZsG4q5WTP468SQvvG5\r\n"
"-----END CERTIFICATE-----";

As pe rthe following thread   https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/t/735565#mce_temp_url#

I used both the endpoint for connection.But Still it is failing.

With ATS :  xxxxxxxxxxxxxx-ats.iot.ap-south-1.amazonaws.com

Without ATS : xxxxxxxxxxxxxx.iot.ap-south-1.amazonaws.com

I also have the correct time stamp.  Offsetted(added 19800) with the GMT to get the Local time.

do {
/* Get the time using the built in NTP server list: */
retval = SNTP_getTime(NULL, 0, &timeval, &ntpTimeStamp);
if (retval != 0) {
Display_printf(display, 0, 0,
"startSNTP: couldn't get time (%d), will retry in %d secs ...",
retval, NTP_POLL_TIME);
sleep(NTP_POLL_TIME);
Display_printf(display, 0, 0, "startSNTP: retrying ...");
}

/* Save the current (NTP Epoch based) time */
currentTimeNtp = (ntpTimeStamp >> 32) + 19800;                                          /* Offsetted the 5:30 hrs with respect to GMT*/

} while (retval < 0);

/*

Any help would be very Helpful

My Console Logs as Follows:

 

Starting the AWS IoT example application

startSNTP: Current time: Mon Dec 31 17:50:14 2018


CC32XX has connected to AP and acquired an IP address.

IP Address: 192.168.X.X

Flashing certificate file ...
Successfully wrote file /cert/ca.pem to flash

Flashing certificate file ...
Successfully wrote file /cert/cert.pem to flash

Flashing certificate file ...
Successfully wrote file /cert/key.pem to flash


AWS IoT SDK Version 3.0.1-

FUNC_ENTRY: aws_iot_mqtt_init L#210

FUNC_ENTRY: aws_iot_mqtt_set_connect_params L#139

FUNC_EXIT: aws_iot_mqtt_set_connect_params L#169 Return Code : 0

FUNC_EXIT: aws_iot_mqtt_init L#281 Return Code : 0

Connecting...


FUNC_ENTRY: aws_iot_mqtt_connect L#461

FUNC_ENTRY: aws_iot_mqtt_get_client_state L#63

FUNC_EXIT: aws_iot_mqtt_get_client_state L#68 Return Code : 1

FUNC_ENTRY: aws_iot_mqtt_set_client_state L#110

FUNC_ENTRY: aws_iot_mqtt_get_client_state L#63

FUNC_EXIT: aws_iot_mqtt_get_client_state L#68 Return Code : 1

FUNC_EXIT: aws_iot_mqtt_set_client_state L#135 Return Code : 0

FUNC_ENTRY: _aws_iot_mqtt_internal_connect L#391

FUNC_ENTRY: aws_iot_mqtt_set_connect_params L#139

FUNC_EXIT: aws_iot_mqtt_set_connect_params L#169 Return Code : 0

FUNC_ENTRY: _aws_iot_mqtt_serialize_connect L#161

FUNC_ENTRY: _aws_iot_get_connect_packet_length L#124

FUNC_EXIT: _aws_iot_get_connect_packet_length L#141 Return Code : 83

FUNC_ENTRY: aws_iot_mqtt_internal_init_header L#188

FUNC_EXIT: aws_iot_mqtt_internal_init_header L#264 Return Code : 0

FUNC_ENTRY: aws_iot_mqtt_internal_write_len_to_buffer L#59

FUNC_EXIT: aws_iot_mqtt_internal_write_len_to_buffer L#70 Return Code : 1

FUNC_EXIT: _aws_iot_mqtt_serialize_connect L#245 Return Code : 0

FUNC_ENTRY: aws_iot_mqtt_internal_send_packet L#272

FUNC_EXIT: aws_iot_mqtt_internal_send_packet L#315 Return Code : 0

FUNC_ENTRY: aws_iot_mqtt_internal_wait_for_read L#657

FUNC_EXIT: aws_iot_mqtt_internal_wait_for_read L#674 Return Code : -12

FUNC_EXIT: _aws_iot_mqtt_internal_connect L#426 Return Code : -12

FUNC_ENTRY: aws_iot_mqtt_set_client_state L#110

FUNC_ENTRY: aws_iot_mqtt_get_client_state L#63

FUNC_EXIT: aws_iot_mqtt_get_client_state L#68 Return Code : 2

FUNC_EXIT: aws_iot_mqtt_set_client_state L#135 Return Code : 0

FUNC_EXIT: aws_iot_mqtt_connect L#490 Return Code : -12

ERROR: runAWSClient L#108
Error(-12) connecting to XXXXXXXXXX-ats.iot.ap-south-1.amazonaws.com:8883


FUNC_ENTRY: aws_iot_mqtt_autoreconnect_set_status L#337

FUNC_EXIT: aws_iot_mqtt_autoreconnect_set_status L#342 Return Code : 0

Subscribing...


FUNC_ENTRY: aws_iot_mqtt_subscribe L#301

FUNC_ENTRY: aws_iot_mqtt_is_client_connected L#292

FUNC_EXIT: aws_iot_mqtt_is_client_connected L#323 Return Code : 0

FUNC_EXIT: aws_iot_mqtt_subscribe L#308 Return Code : -13

ERROR: runAWSClient L#126
Error subscribing (-13)


ERROR: runAWSClient L#178
An error occurred in the loop. Error code = -13

 


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>