FPGA and SoC are key components of the Internet of Things (IoT) and its industrial partner the Industrial Internet of Things (IIoT). This is especially true for system on modules like the MicroZed which can be used for both development and the final product.
In this blog, we are going to look at how we can use the AWS FreeRTOS to connect our MicroZed to the AWS IoT.
The first stage in this journey is to start with a AWS account. Once we have an AWS account, we can sign in to the AWS IoT console. It is within this console that we are going to access the software example we will use and configure out IoT end point.
First, let’s grab the software — we can do this by clicking on the software option on the left hand menu.
Clicking on the software menu will present us with several possible options. For this example, we want to click on the option to configuring the Amazon FreeRTOS device software.
This option will provide us a list of predefined example applications for a range of devices. For this application, select the “Connect to AWS IoT — Xilinx.”
This will download a ZIP file which we need to extract. When we do this be careful to ensure the path length is less than 255 characters if you are using Windows.
The next stage is to create the end point. You can find the name of this from the settings menu also on the left-hand menu.
Once we have the end point created, the next step is to create a thing. We can do this from the manage menu.
From there, register a single AWS IoT thing.
As we register it, we can define its name and create the necessary security certificates and keys.
Be sure to download the certificates, as we will need these later. Once this is completed, you will see the IoT thing we just created.
We are now ready to start working with the software.
For starters, we need to add in the end point name and the name of the IoT thing we just created. We add this into file:
We also need to generate the keys required to access our AWS IoT system, in a format that can be used in the C application. This is achieved using the certificate configuration tool — the tool is run in a web browser and can be found under the directory:
Run the CertificateConfigurator.html
Within the tool, select the necessary files and generate the AWS_Clientcreddnetial_keys.h file.
Save this file to the following directory:
If you are prompted to overwrite the file, please allow this:
Back in our AWS IoT console, the next step is to set up a subscription. We can do this using the test menu.
Subscribe to freertos/demo/echo
The next step is to Open Xilinx SDK, and select the workspace located at:
However, when this opens you will see no projects. To see them we need to import the projects.
Select File->Import and from within the dialog select General, choose Existing Projects into Workspace.
Select the root directory to be AmazonFreeRTOS and you will see the four projects which can be imported.
Before we can build the project, though, we need to set a string substitution to the root directory of our project.
We can now perform a clean of the project and rebuild the project. There should be no errors.
Once we have the ELF file, we can set up a debug application and download the ELF to the MicroZed and run the application.
When the application is running, we can see the progress in a terminal window over the USB UART.
We can also confirm that our AWS IoT is receiving connections and publishing messages.
We can do this on the monitor menu — the results of which for this application can be seen below.
We are now able to communicate between our MicroZed and the AWS IoT, can start adding more functionality to our application.
See My FPGA / SoC Projects: Adam Taylor on Hackster.io
Get the Code: ATaylorCEngFIET (Adam Taylor)
Access the MicroZed Chronicles Archives with over 250 articles on the Zynq / Zynq MpSoC updated weekly at MicroZed Chronicles.