1.2.2 Building and Running on PIC32MZEF Curiosity 2.0 + WINC1500
Downloading and Building the Application
To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repo or download as zip file. This content can also be download using content manager by following these instructions.
Path of the application within the repository is apps/led_shadow_client_ecc/.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
firmware/pic32mz_ef_curiosity_v2_winc1500.X | MPLABX Project for PIC32MZEF Curiosity 2.0 board |
Provisioning the device for AWS account access
- Refer to Getting Started guide for setting up the AWS account based on your hardware configuration.
- With the completion of the above steps, the user would have got aws_clientcredential.h and aws_clientcredentialkeys.h, this may be used for running the demos.
Setting Up PIC32MZEF Curiosity 2.0 Board
- Connect the Debug USB port on the board to the computer using a micro USB cable.
- Connect the ATECC608A Trust in XC32 Header (2) / mikroBUS slot 2.
- Connect the LAN8720PHY daughter card in the PHY slot.
- Connect the WINC1500 Xplained Pro in J501 extension.
Building the Application
- Open the application project firmware/pic32mz_ef_curiosity_v2_winc1500.X in the IDE.
- Use the aws_clientcredential.h and aws_clientcredentialkeys.h obtained from provisioning the device to aws account.
- Enter the WIFI credentials in aws_clientcredential.h if not entered already.
- Build and program the application using the IDE.
Running the Application
- Ensure Wifi router is connected to internet before turning on the board.
- If above step is successful then the LED0 on the board would turn ON/OFF once.
- Open the Terminal application (Ex.:Tera Term) on the computer.
- Configure the serial port settings as follows:
- Baud : 115200
- Data : 8 Bits
- Parity : None
- Stop : 1 Bit
- Flow Control : None
- Login to your AWS amazon account.
From the Services menu (upper left), click (or search for) IoT Core and open it. This will open the Aws IoT page as shown below.
- From the menu on the left, Click
“Manage” and then Click “Things”. This will display all the things managed by
your AWS account in the right pane.
In the right pane, click the “Things” item, which represents your device.
- The THING Name and Shadow ARN are masked for security reasons. Click on the “Shadow” item in the right pane. This will display the device shadow page.
- Build and Program the application
using the MPLAB X IDE. The device will toggle one LED and now a shadow document
will be created in the Device’s Shadow page.
The Shadow state document is JSON formatted file representing the device’s state, in this example the LED status is depicted as device’s status.
- The JSON variable “powerOn” indicates the LED state of the board and Shadow state depicts the current state of the device.
- The user can modify the Shadow state till the connection is alive by click on the Edit button in the Shadow Document and changing the “powerOn” state.
- Change the power On value to ‘1’
and click on the Save Button, this will turn LED0 “ON”. Changing the value to 0
will turn LED0 off. Similarly it follows below truth table.
S.No LED2 LED1 LED0 powerOn (Value) Remarks 1 OFF OFF OFF 0 All LED OFF 2 OFF OFF ON 1 LED0 ON 3 OFF ON OFF 2 LED1 ON 4 OFF ON ON 3 LED0 and LED1 ON 5 ON OFF OFF 4 LED2 ON 6 ON OFF ON 5 LED0 and LED2 ON 7 ON ON OFF 6 LED1 and LED2 ON 8 ON ON ON 7 LED0, LED1 and LED2 ON