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:
- cypress-psoc_accessKeys.csv
- cypress-psoc_certificate.pem
- cypress-psoc_codecommit_credentials.csv
- 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
- git clone --recurse-submodules https://github.com/cypresssemiconductorco/amazon-freertos.git --branch 201910-MTBAFR1951
In ModusToolbox IDE.
- Import the demo projects: File > Import > General > Existing Projects into Workspace
- Choose the demo for your board: ~/ModusToolbox/workspace_rtos/amazon-freertos/projects/cypress/CY8CKIT_062_WIFI_BT/mtb/aws_demos
- Build and check no errors: Project > Build All
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
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.