TI CC3220 with Amazon FreeRTOS

You can check the latest version of tutorial and code in Github

AWS IoT

  • Amazon has the broadest and deepest portfolio of IoT services
  • AWS IoT [Link]

AmazonFreeRTOS

  • An operating system for microcontrollers that makes small, low-power edge devices easy to program, deploy, secure, connect, and manage
  • AmazonFreeRTOS is based on the FreeRTOS kernel
  • Extends it with software libraries that make it easy to securely connect your small, low-power devices to AWS cloud services like AWS IoT Core or to more powerful edge devices running AWS Greengrass.
  • Amazon FreeRTOS architecture is shown here

TI CC3220 with Amazon FreeRTOS

  • Amazon tutorial: [Getting Started with the Texas Instruments CC3220SF-LAUNCHXL]
  • Amazon FreeRTOS supports two IDEs for the TI CC3220SF-LAUNCHXL development kit: Code Composer Studio and IAR Embedded Workbench. In this tutorial, we will use Code Composer Studio.
  • Step1: Install Code Composer Studio
  • Step2: Install the SimpleLinkCC3220 SDK
  • Step3: Install Uniflash from http://www.ti.com/tool/UNIFLASH
    • CCS Uniflashis a standalone tool used to program on-chip flash memory on TI MCUs. 
    • Uniflash has a GUI, command line, and scripting interface.

Step4: Install the Latest Service Pack

  • On your TI CC3220SF-LAUNCHXL, place the SOP jumper on the middle set of pins (position = 1) and reset the board.
  • StartUniflash, and from the list of configurations, choose CC3220SF-LAUNCHXL. Choose Start Image Creator.
  • Choose New Project
  • On the Start new project page, enter a name for your project. For Device Type, choose CC3220SF. For Device Mode, choose Develop, and then choose Create Project
  • Disconnect your serial terminal (if previously connected) and on the right side of the Uniflashapplication window, choose Connect.
  • From the left column, choose Service Pack.
  • Choose Browse, and then navigate to where you installed the CC3220SF SimpleLinkSDK. The service pack is located atti\simplelink_cc32xx_sdk_VERSION\tools\cc32xx_tools\servicepack-cc3x20\sp_VERSION.bin
  • Click the burn button then choose Program Image (Create & Program) to install the service pack.

Step5: Download Amazon FreeRTOS

  • Browse to the AWS IoT console
    https://console.aws.amazon.com/iotv2/
  • In the navigation pane, choose Software.
  • Under AmazonFreeRTOSDevice Software, choose Configure download.
  • Under Software Configurations, find Connect to AWS IoT- TI, and then
    • If you are using Code Composer Studio, choose Download.
    • Unzip the downloaded file to your hard drive. When unzipped, you have a directory named AmazonFreeRTOS.

Step6: AWS Account and Permissions

  • In the search box, enter AmazonFreeRTOSFullAccess, choose it from the list, and then choose Next: Review.
  • Choose Add permissions
  • Attach the AWSIoTFullAccesspolicy to your IAM user

Step7: Create an AWS IoT policy

  • Add the following statements
  • Review the final policy document (with all the previous statements)

Step8: To create an IoT thing, private key, and certificate for your device

  • In the navigation pane, choose Manage, and then choose Things.
  • Choose Create a single thing.
  • On the Add your device to the thing registry page, enter a name for your thing, and then choose Next.
  • On the Add a certificate for your thing page, under One-click certificate creation, choose Create certificate
  • Choose One-click certificate creation
  • Download your private key and certificate by choosing the Download links for each
  • Choose Activate to activate your certificate
  • Download Root CA
  • Make sure your Root CA file is not empty
  • In the IoT console, choose Attach a policy to attach a policy to your certificate that grants your device access to AWS IoT operations
  • Click Register Thing

Step9: configure your AWS IoT endpoint

  • Browse to the AWS IoT console
  • In the navigation pane, choose Settings
  • The AWS IoT endpoint is displayed in Endpoint. It should look like <1234567890123>-ats.iot.<us-east-1>.amazonaws.com
  • open AWS downloaded <BASE_FOLDER>\demos\common\include\aws_clientcredential.h and specify values for the following #define constants:
    • clientcredentialMQTT_BROKER_ENDPOINT Your AWS IoT endpoint: a53l6idwvzofq-ats.iot.us-west-2.amazonaws.com
    • •clientcredentialIOT_THING_NAME The AWS IoT thing name of your board: FreeRTOS-TICC3220a
  • Open the aws_clientcredential.h file
  • Specify values for the following #define constants:
    • clientcredentialWIFI_SSID The SSID for your Wi-Fi network
    • clientcredentialWIFI_PASSWORD The password for your Wi-Fi network
    • clientcredentialWIFI_SECURITY The security type of your Wi-Fi network
  • AmazonFreeRTOSis a C language project, and the certificate and private key must be specially formatted to be added to the project
  • open <BASE_FOLDER>\tools\certificate_configuration\CertificateConfigurator.html
    • Under Certificate PEM file, choose the <ID>-certificate.pem.crt that you downloaded from the AWS IoT console
    • Under Private Key PEM file, choose the <ID>-private.pem.key that you downloaded from the AWS IoT console
    • Choose Generate and save aws_clientcredential_keys.h, and then save the file in <BASE_FOLDER>\demos\common\include. This overwrites the existing file in the directory

Step10: Build and Run Amazon FreeRTOSSamples

  • Open TI Code Composer, import Amazon FreeRTOS project
  • You will see the following project architecture

Step11: Final test

  • AWS IoT Console, In the navigation pane, choose Test to open the MQTT client. In Subscription topic, enter freertos/demos/echo, and then choose Subscribe to topic
  • In TI CC3220 board
    • Make sure the Sense On Power (SOP) jumper on your Texas Instruments CC3220SF-LAUNCHXL is in position 0
    • Use a USB cable to connect your Texas Instruments CC3220SF-LAUNCHXL to your computer
    • From Project, choose Build Project to make sure the project compiles without errors or warnings
    • In TI Code Composer, from Run, choose Debug
    • When the debugger stops at the breakpoint in main(), go to the Run menu, and choose Resume
  • In AWS IoT Console, you will see the data has been received by the AWS IoT subscription
  • Open terminal, you will see the following results

Leave a Reply

Your email address will not be published. Required fields are marked *