"IoT Made Easy!"
Devices: | PIC32CXBZ2 | WBZ45x |
Features: | ZIGBEE | BLE |
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 demonstrates the multiprotocol functionality of the PIC32CXBZ2 device / WBZ451 module. Here a Zigbee BLE Bridge application is demonstrated using PIC32CXBZ2 / WBZ451 device that functions as both a BLE and a Zigbee CI device simultaneously. In this application, the user can connect a smartphone to a Zigbee network via a BLE connection created by the WBZ451 device. In order to this, the Zigbee console commands have been mapped to the BLE Transparent UART Service. With the help of console commands, the user can allow new devices to join the Zigbee network as well as monitor and control the Zigbee network.
Tip | Go through the overview for understanding few key Zigbee 3.0 protocol concepts |
---|
TOOLS | QUANTITY |
---|---|
PIC32CX-BZ2 and WBZ451 Curiosity Development Board | 3 |
-
- Version: 6.05
- XC32 Compiler v4.10
- MPLAB® Code Configurator v5.1.17
- PIC32CX-BZ_DFP v1.0.107
- MCC Harmony
- csp version: v3.13.1
- core version: v3.11.1
- CMSIS-FreeRTOS: v10.4.6
- dev_packs: v3.13.0
- wolfssl version: v4.7.0
- crypto version: v3.7.6
- wireless_pic32cxbz_wbz: v1.1.0
- wireless_zigbee: v5.0.0
- wireless_ble: v1.0.0
-
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.
- In Device resources, go to wireless->drivers->zigbee->Device types and select Combined Interface. Accept Dependencies or satisfiers, select "Yes". The Combined Interface configuration is depicted as follows.
To make the device as a Zigbee Coordinator, do not select "Act as bridge" option in the configuration options.
-
Add UART components needed for console logs and commands. Right click on the "⬦" in Zigbee console and add the satisfier and in the same way add SERCOM0 to the USART console.
-
The SERCOM0 UART configuration is depicted as follows.
- From Device resources, go to Wireless->Drivers->BLE and select BLE STACK. Accept Dependencies or satisfiers, select "Yes".The configuration is depicted as follows.
- From Device resources, go to Wireless->Drivers->BLE->Profiles and select TRANSPARENT Profile. Accept Dependencies or satisfiers. The configuration is depicted as follows.
- From Device resources, go to Wireless->Drivers->BLE-> Services and select TRANSPARENT Service. Accept Dependencies or satisfiers.
- From project graph, go to Plugins->PIN configuration and configure as follows.
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. |
---|---|
Path | firmware/src |
- Copy the "app_ble" folder, "app.c" and "app.h" which can be found by navigating to the following path: "...\firmware\src"
- Paste the folder 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.
- Extended Light and Multisensor application folders will be available in this link.
- Follow the steps provided in the above mentioned link to program the board.
-
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.
- In this application, manual commissioning is used to create a Zigbee network.
- The Zigbee CI and BLE transparent UART application starts advertising and we can establish a BLE Connection using MBD app.
- The user can control the Zigbee network with his Mobile phone connected to Zigbee CI device via BLE Link
- To trigger the commissioning procedures manually, the user has to issue the following console commands on BLE UART in MBD app as given below:
Step 1 - Network Formation – “invokeCommissioning 4 0”
- If the device is a router or a coordinator it forms the network.
Step 2 - Network Steering – “invokeCommissioning 2 0”
- The device starts to search for a network to join.
Step 3 - SetFBRole 0 - this command to be given on application endpoint acts as target.
Step 4 - Finding & Binding - “invokeCommissioning 8 0”
- This command shall be given for any the devices which needs to be bound for clusters.
Step 5- Reset the other Zigbee devices to join into this network. Use "resetToFN" command on the console to reset the other Zigbee devices.
- Once the network is established Extended light and Multisensor devices will start reporting their attribute values to Combined interface as shown in the video.
- The Extended Light can be switched ON or OFF by issuing an onOff command(To get the network address, use getNetworkAddress command on your extended light device) from the CI as shown below.
onOff -s 0x78ca 0x23 -on
The user can also use "Commissioning on startup" on the Combined Interface device to create a Zigbee network. The procedure to commission a Zigbee network is discussed in detail in this link.