"IoT Made Easy!"
Devices: | PIC32CXBZ2 | WBZ45x | ATtiny3217 Xplained Pro |
Features: | BLE | TOUCH | E-PAPER |
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
- Hardware Setup
- Software Setup
- Harmony MCC Configuration
- ATtiny3217 Touch Application Code
- Board Programming
- Run the demo
- Related applications
This application demonstrates the multi-link & multi-role capability of PIC32CXBZ2/WBZ45x device. The PIC32CXBZ2/WBZ45x device allows 6 simultaneous BLE connections.
In this Demo, 'WBZ451 Multi-Role device' act as a central device on startup and scan for BLE Sensor devices nearby. The 'WBZ451 Multi-Role device' initiates connections to 5 BLE Sensor devices. The 'WBZ451 Multi-Role device' also act a Peripheral device and advertise as a BLE sensor device. The MBD App scans and connect to 'WBZ451 Multi-Role device' and the RGB LED's on all connected devices can be controlled by MBD App.
The WBZ451 Multi-Role demo application also features a touch interface and a E-Paper Display using through ATtiny3217 Xplained Pro - T10 Xplained Pro kit and E-Paper Bundle 2 . The Temperature data received from BLE Sensor devices are displayed on the E-Paper Display.
TOOLS | QUANTITY |
---|---|
PIC32CX-BZ2 and WBZ451 Curiosity Development Board | 6 |
E-Paper Bundle 2 | 1 |
ATtiny3217 Xplained Pro | 1 |
T10 Xplained Pro Extension Kit | 1 |
Smart Phone (Android / Apple® iPhone) | 1 |
- Connect the E-Paper Bundle 2 with the WBZ451 CURIOSITY BOARD using the below table.
WBZ451 | E-PAPER | Description | WBZ451 | E-PAPER | Description |
---|---|---|---|---|---|
AN | 15(BSY) | BUSY | PWM | 16(D/C) | Data/Command |
RST | 2(RST) | RESET | INT | NC | NC |
CS | 3(CS) | CHIP SELECT | RX | NC | NC |
SCK | 4(SCK) | SPI CLOCK | TX | NC | NC |
MISO | NC | NC | SCL | NC | NC |
MOSI | 6(MOSI) | SERIAL DATA INPUT | SDA | NC | NC |
3.3V | 7(3.3V) | POWER SUPPLY | 5V | NC | NC |
GND | 8(GND) | GROUND | GND | 9(GND) | GROUND |
Note: PIN 15 (BSY) of E-PAPER should be connected with AN of WBZ451 !! |
---|
- Connect T10 Extension header 3 (EXT3) to ATtiny3217 Xplained Pro Extension Header 1 (EXT1).
- Connect the External 3 header of ATtiny3217 Xplained Pro touch interface with the WBZ451 Curiosity board using jumper wires as shown in the table below.
ATtiny3217 Xplained Pro+T10 Xplained Pro | Description | WBZ451 | Description |
---|---|---|---|
PB3 | UART-RX | PA13(SDA) | Sercom2-UART-TX |
PB2 | UART-TX | PA14(SCL) | Sercom2-UART-RX |
3.0V IN | Power supply | 3V | Power supply |
GND | Ground | GND | Ground |
Note: Make sure to have common GND! |
---|
-
- Version: 6.05
- XC32 Compiler v4.10
- MPLAB® Code Configurator v5.1.17
- PIC32CX-BZ_DFP v1.0.116
- MCC Harmony
- csp version: v3.14.0
- core version: v3.11.1
- wireless_pic32cxbz_wbz: v1.1.0
- wireless_ble: v1.0.0
- wireless_system_pic32cxbz_wbz: v1.1.0
- dev_packs: v3.14.0
- wolfssl version: v4.7.0
- crypto version: v3.7.6
- CMSIS-FreeRTOS: v10.4.6
-
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 - This application is built by using BLE Sensor with with ATTINY3217 Touch Application as the building block. The project graph of the BLE Sensor Multi-Link Multi-Role Demo application is shown below.
Step 2 - In MCC harmony project graph, Add the SERCOM1 component under Libraries->Harmony->Peripherals->SERCOM->SERCOM1. select SERCOM1 and add "SPI" satisfiers by right click on the "⬦" near SPI to add the SPI component which will prompt an Auto-activation for "core"&"FreeRTOS" component, give yes to add the component and configure SERCOM1 and SPI as shown below.
Step 3 - In MCC harmony project graph, Update Transparent profile from device resources under Libraries->Harmony->wireless->drivers->BLE->Profiles and configure as shown below.
Step 4 - In MCC harmony project graph, select system and configure as shown below.
Step 5 - In project graph, go to Plugins->Pin configurations->Pin settings and set the pin configuration as shown below.
- Use these PIN Names while configuring.
CLICK_EINK_BUNDLE_CS
CLICK_EINK_BUNDLE_DC
CLICK_EINK_BUNDLE_RST
CLICK_EINK_BUNDLE_BSY
Step 6 - Generate the code.
Step 7 - Copy the folder click_routines(which contains the eink_bundle.h, eink_bundle_font.h, eink_bundle_image.h, eink_bundle.c, eink_bundle_font.c, eink_bundle_image.c) to the folder firmware/src under your MPLAB Harmony v3 application project and add the Header (eink_bundle.h, eink_bundle_font.h, eink_bundle_image.h) and Source file (eink_bundle.c, eink_bundle_font.c, eink_bundle_image.c).
- In the project explorer, Right click on folder Header Files and add a sub folder click_routines by selecting “Add Existing Items from Folders…”
- Click on “Add Folder…” button.
- Select the “click_routines” folder and select “Files of Types” as Header Files.
- Click on “Add” button to add the selected folder.
- The eink bundle header files gets added to your project.
- In the project explorer, Right click on folder Source Files and add a sub folder click_routines by selecting “Add Existing Items from Folders…”.
- Click on “Add Folder…” button
- Select the “click_routines” folder and select “Files of Types” as Source Files.
- Click on “Add” button to add the selected folder
- The eink bundle source files gets added to your project.
- The click_routines folder contain an C source file eink_bundle.c. You could use eink_bundle.c as a reference to add E-Paper display functionality to your application.
Step 8 - In "app_user_edits.c", make sure the below code line is commented and make changes as mentioned in TODO section
- "#error User action required - manually edit files as described here".
Step 9 - Replace the app.c, app_ble_sesnor.c, app_ble_conn_handler.c, app_ble_conn_handler.h, app_trpc.c, app_trpc.h, app_ble.c, app_ble_handler.c and app.h file.
Note | This application repository should be cloned/downloaded to perform the following steps. |
---|---|
Path | The application folder can be found in the following link |
Step 10 - Clean and build the project. To run the project, select "Make and program device" button.
- Follow the steps provided under program the precompiled hex file section to program the ATtiny3217 Xplained Pro and T10 Xplained Pro interface.
- To create the Atmel Start project from scratch follow steps provided in this link.
The application hex files can be found by navigating to the following paths:
- "PIC32CXBZ2_WBZ45x_BLE_SENSOR_Multi-Role/hex/ble_sensor_multirole.X.production.signed.unified.hex"
- "PIC32CXBZ2_WBZ45x_BLE_SENSOR_Multi-Role/hex/ATiny3217_T10.hex"
Program five WBZ451 boards with BLE Sensor Application. The application hex files can be found by navigating to the following paths:
- "wireless_apps_pic32cxbz2_wbz45/apps/ble/advanced_applications/ble_sensor/precompiled_hex/ble_sensor.X.production.signed.unified_timerbased.hex"
Note: Ensure that all the WBZ451 Curiosity boards have unique BLE MAC Address. If not, program the boards with unique BLE MAC Address. |
---|
Follow the steps provided in the link to program the precompiled hex file using MPLABX IPE to program the pre-compiled hex image.
The application folders can be found by navigating to the following paths:
- "PIC32CXBZ2_WBZ45x_BLE_SENSOR_Multi-Role/tree/main/ble_sensor_multirole/firmware/ble_sensor_multirole.X"
- "PIC32CXBZ2_WBZ45x_BLE_SENSOR_Multi-Role/tree/main/ATTiny3217_T10"
Follow the steps provided in the link to Build and program the application.
- After programming the board, the expected application behavior is shown in the below video.
- On Startup the WBZ451 Device will scan for nearby BLE Sensor devices and initiates connection with them. During scanning, the user LED will blink at every 500ms.
- To switch the device between Advertising and Scanning, press the user button. During Advertising the user LED will blink at every 1000ms.
- The E-Paper Display will show the temperature of all the connected devices every 60 seconds.