Close

Testing Amazon FreeRTOS

A project log for FIMble

Concept of a plug-and-play IoT food monitoring system. It aims to reduce food wastage at consumer and distributor level

zst123zst123 06/20/2020 at 12:530 Comments

After doing some research, I think the best experience will be to use Cypress’ Amazon FreeRTOS. I tried looking into mbed OS but the documentation for this board is not clear and it seems it doesn’t have an easy way to import into ModusToolbox.

As a start, I read the Cypress Official Start Guide Getting Started with Amazon FreeRTOS and PSoC62 + 43xxx.

(1) AWS IAM Account

Firstly, I created an AWS account and then logged in as root.

After this, we need to create an IAM user account which is used to assign permissions for our IoT device to access later.

I followed this blog post where he shows step by step photos on how to setup

After that, followed this guide to add FreeRTOS permissions.

From the guide above, make sure you download all the account files. We will use them in the next part. I ended up with these files:

  1. cypress-psoc_accessKeys.csv
  2. cypress-psoc_certificate.pem
  3. cypress-psoc_codecommit_credentials.csv
  4. cypress-psoc_privatekey.pem

(2) AWS IoT Core

To configure later, need to install AWC CLI tool. Follow this guide.

mkdir aws_cli
cd aws_cli
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

 Then we need to configure AWS

Now, from the account files, use cypress-psoc_accessKeys.csv here.

$ aws configure
AWS Access Key ID [None]:     <<Use cypress-psoc_accessKeys.csv>>
AWS Secret Access Key [None]: <<Use cypress-psoc_accessKeys.csv>>
Default region name [None]: ap-southeast-1 <<Choose the server closest to me>>
Default output format [None]:  <<I left this blank>>

And after configuring check the endpoint. 

$ aws iot describe-endpoint
{
    "endpointAddress": "a2cgpzvh8vmm38.iot.ap-southeast-1.amazonaws.com"
}

Next, we need to register the board

After done, we can finally see the board in the console (Manage > Things)


(3) Cypress AWS FreeRTOS

Clone the Cypress AWS FreeRTOS repo into your workspace

In ModusToolbox IDE.

Configure MQTT and your WiFi settings:

Program the board and the connection should be shown on the activity page.

I faced a problem where a lot of sematic problems appear but it compiles successfully.

We actually need to disable some settings in Code Analysis (according to ModusToolbox user guide):

Note
While debugging, you may see various errors in your code (main.cpp file), such as "function ‘printf’ could not be resolved." These are likely not real errors. They are caused by the import of the make file into Eclipse. 

To turn these errors off, go to Project > Properties > C/C++ > Code Analysis, and disable "Potential Programming Problems" and "Syntax and Semantic Errors.

In my next post, I will modify the demo program to do my own application.

Discussions