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.

CCS/CC3220SF-LAUNCHXL: CC3220SF-LAUNCHXL: AWS IoT subscribe_publish_sample Error (-24)

Part Number:

Tool/software: Code Composer Studio

Tool/software: Code Composer Studio

Been running into some errors when running the subscribe_publish_sample code. 

The error message:

startSNTP: Current time: Thu Jun 6 14:12:05 2019


CC32XX has connected to AP and acquired an IP address.

IP Address: 172.30.5.134


AWS IoT SDK Version 3.0.1-

Connecting...


ERROR: runAWSClient L#108
Error(-24) connecting to xxxxxxxxxxxx.iot.us-east-1.amazonaws.com:8883


Subscribing...


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


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

 

What I've done:

  • Recreated project from scratch, double checking wificonfig.h,certs.h and aws_iot_config.h
  • Tried both Starfield Class 2 Certificate Authority, as well as the VeriSign Class 3 Public G5 certificate
  • Tried using non-ats and ats endpoints

What I believe:


After exploring the forums i BELIEVE the issue lies in the network_sl.c file. Multiple post refer back to following code:

static int getErrno(int ret)
{
    if (ret == -1) {
        return (errno);
    }
    else {
        return (ret);
    }
}

IoT_Error_t iot_tls_connect(Network *pNetwork, TLSConnectParams *TLSParams)
{
    int retConnect;

...

    retConnect = connect(skt, (struct sockaddr  *)&address, sizeof(address));
    if ((retConnect < 0) && (getErrno(retConnect) != SL_ERROR_BSD_ESECUNKNOWNROOTCA)) {
//    if ((retConnect < 0)) {
        ret = NETWORK_ERR_NET_CONNECT_FAILED;
        goto QUIT;
    }
...
}

but i am not 100% sure how to actually implement this into my current code, more specifically where to paste it in. When i attempted I got errors saying most added variables were undefined. 

Any help would be much appreciated

  • Hi Christopher,

    Thanks for providing details on your setup and what you've already tried to resolve your issue.

    What version of the CC3220 SDK and the AWS plugin are you using? The code snippet that you posted seems to be based off of an older version of network_sl.c from a previous release. You should be using SDK version 3.10.0.04 and AWS plugin version 2.0.0.09, as some functionality has been tweaked in the plugin to increase ease-of-use and remove the need to modify network_sl.c. I suggest you update to those versions, and then reimport the subscribe_publish_sample and try again.

    If you still run into the same issues at the latest version of the plugin, there are a couple more things to look at.

    First, you should ensure that you are using the correct root CA cert for your endpoint. With the -ats endpoints, you should be using the Starfield Class 2 root CA cert while for the legacy non-ats endpoints you should be using the VeriSign Class 3 Public G5 certificate.

    Second, you should ensure that your cloud setup is correct. If you haven't done so already, I encourage you to look at the guide included with the AVS thermostat and follow along the cloud setup steps to ensure that your AWS IoT environment is correct.

    http://www.ti.com/lit/ug/tidudq7a/tidudq7a.pdf

    You'll want to look at section 3.2.2.1.

    Let me know if that helps, or if you are still having issues with AWS.

    Regards,

    Michael

  • Hello Michael,

    Thank you so much for the quick response back. Previously I was using version 2.40.02.00 for the cc33200 sdk and version 2.20.00.02 for aw, but have updated and changed over to the ones you recommended. 

    When changing over I run into an error building. It was saying that the I2SCC32XXDMA.h didn't exist inside the new cc3220 drivers. I see that the name for that header file has changed to I2SCC32XX.h and i think i made most of the necessary adjustments for that, except for what to do on line 402 of the CC3220SF_LAUNCHXL.c file, which is:

    const I2S_Config I2S_config[CC3220SF_LAUNCHXL_I2SCOUNT] = {
        {
            .fxnTablePtr = &I2SCC32XX_fxnTable,
            .object = &i2sCC3220SObjects[CC3220SF_LAUNCHXL_I2S0],
            .hwAttrs = &i2sCC3220SHWAttrs[CC3220SF_LAUNCHXL_I2S0]
        }

    specifically what do do for I2SCC33XX_fxnTable, which i don't believe is in this header file anymore.

    Any suggestions on fixing this?

    Thank you so much,

    Chris

  • Actually the more i look at it, the more i see that almost everything about the I2S header files have changed. Is any of the code listed under the I2S section usable?

  • Hi Chris,

    Looking into the AWS sample projects, it seems like they were developed with the 2.40.xx.xx SDKs in mind, and not the latest 3.10.xx.xx SDK versions. If you need to use I2S in your application then I advise you revert to your older SDK that you were using before. Otherwise, you can simply block comment out the I2S section of CC3220SF_LAUNCHXL.c and the project should build fine with that change.

    Regards,

    Michael

  • Hi Michael,

    Thank you for the help. I commented out the section and was able to compile everything with no errors. When running the code i still am getting error -13. 

    Maybe a shot in the dark, but could being on a company wifi be the reason for receiving that error? Perhaps it is restricting the connection between the board and AWS?

  • Hi Chris,

    Connectivity issues due the network you are using is certainly possible. I personally use a cellular Wi-Fi hotspot at the office to bypass network policy restrictions that affect internet traffic on non-standard ports such as the MQTT ports that AWS uses. I suggest you try an unfiltered network connection to see if that helps.

    If you really wanted to be sure, you could run the AWS python SDK on a PC that's connected to the same network and see if that also runs into network issues:

    https://github.com/aws/aws-iot-device-sdk-python

    I suggest you try running your CC3220 project on another known-good network first though.

    Regards,

    Michael

  • Thank you so much Michael.

    Tested this on my home wifi and i worked with no issues. 

    Appreciate all the help