"IoT Made Easy!"
Devices: | PIC32CXBZ2 | WBZ45x |
Features: | OpenThread |
THE SOFTWARE ARE PROVIDED "AS IS" AND GIVE A PATH FOR SELF-SUPPORT AND SELF-MAINTENANCE. This repository contains example code intended to help accelerate client product development.
For additional Microchip repos, see: https://github.com/Microchip-MPLAB-Harmony
Checkout the Technical support portal to access our knowledge base, community forums or submit support ticket requests.
- Introduction
- Bill of materials
- Software Setup
- Harmony MCC Configuration
- Board Programming
- Run the demo
This application enables the users to create a Full Thread Device to control on-board RGB LED. Thread RGB Light receives the On/Off and HSV value from the Thread co-processor device once it has joined the thread network. On-board RGB LED is set to corresponding the On/Off and HSV values using multiple PWM signals. Also the current status is reported periodically to Thread co-processor device.
Tip | Go through the overview for understanding few key Thread protocol concepts |
---|
TOOLS | QUANTITY |
---|---|
PIC32CX-BZ2 and WBZ451 Curiosity Development Board | 1 |
-
- Version: 6.20
- XC32 Compiler v4.40
- MPLAB® Code Configurator v5.5.0
- PIC32CX-BZ_DFP v1.0.107
- MCC Harmony
- csp version: v3.18.5
- core version: v3.13.4
- bsp version: v3.18.0
- CMSIS-FreeRTOS: v11.1.0
- dev_packs: v3.18.1
- wolfssl version: v5.4.0
- crypto version: v3.8.1
- wireless_pic32cxbz_wbz: v1.3.0
- wireless_15_4_phy version: v1.2.0
- wireless_thread: v1.1.1
- openthread version : thread-reference-20230706
-
Any Serial Terminal application like TERA TERM terminal application
Tip | New users of MPLAB Code Configurator are recommended to go through the overview |
---|
Step 1 - Connect the WBZ451 CURIOSITY BOARD to the device/system using a micro-USB cable.
Step 2 - Create a new MCC Harmony project.
Step 3 - The "MCC - Harmony Project Graph" below depicts the harmony components utilized in this project.
-
From Device Resources, go to Libraries->Harmony->Board Support Packages and add WBZ451 Curiosity BSP.
-
From Device Resources, go to Libraries->Harmony->Wireless->Drivers->Thread and add Thread Stack. Click "Yes" on all the Pop-ups to add the link the dependencies.
-
Ensure the configuration of Thread Stack is as below.
- Ensure the configuration of FreeRTOS is as below. Total heap size should be 61440.
-
In FreeRTOS configuration options, go to RTOS Configurations->Include components and make sure xTaskAbortDelay is selected.
-
From Device Resources, go to Libraries->Harmony->System Services and add CONSOLE. Ensure the below configuration.
- Right Click on UART of CONSOLE and add SERCOM0 as below. Ensure the configurations.
- Modify the System Configuration as below.
- From Device Resources, go to Libraries->Harmony->Peripherals->TC add TC2 and TC3. Ensure the below configuration.
- In Plugins->Clock Configuration, ensure the below configurations.
- In Plugins->Pin Configuration, ensure the below configurations for RB0, RB3 and RB5 pins.
Step 4 - Generate the code.
Step 5 - In "app_user_edits.c", make sure the below code line is commented
- "#error User action required - manually edit files as described here".
Step 6 - Copy the mentioned files from this repository by navigating to the location mentioned below and paste it your project folder.
Note | This application repository should be cloned/downloaded to perform the following steps. |
---|
- Copy "Thread_demo.c" and "Thread_demo.h" files available in "...firmware\src"
- Paste the files under source files in your project folder (...\firmware\src).
Step 7 - Add the files in MPLAB X IDE to your project by following the steps mentioned below.
- In Projects section, right click on Source files to add the ".c" file and Header files to add the ".h" file.
- Select "Add existing item".
- Select Add and browse the location of the mentioned files(...\firmware\src).
- Make sure the "Files of type" is "C Source files" while adding ".c" files and "Header files" while adding ".h" files.
- Select the folder and click "add".
Step 6 - Copy the mentioned files from this repository by navigating to the location mentioned below and paste it your project folder.
Note | This application repository should be cloned/downloaded to perform the following steps. |
---|
- Copy "app.c" and "app.h" files available in "...firmware\src"
- Paste the files under source files in your project folder (...\firmware\src).
Step 7 - Clean and build the project. To run the project, select "Make and program device" button.
The application hex file can be found in the hex folder.
Follow the steps provided in the link to program the precompiled hex file using MPLABX IPE to program the pre-compiled hex image.
Follow the steps provided in the link to Build and program the application.
- Once the gateway device is powered on the RGB Light will join the network. The status of the RGB light will be periodically reported to Thread Co-Processor. Thread Co-Processor can control the status of RGB like On/Off and HSV using commands explained in Thread co-processor device.
Below prints can be seen in Thread co-processor device.