"IoT Made Easy!"
Devices: | PIC32CXBZ2 | WBZ45x |
Features: | NFC | 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
- Hardware Setup
- Software Setup
- Harmony MCC Configuration
- Board Programming
- Run the demo
This application demonstrates the use of an NFC 4 Click interfaced via SPI which Emulates the BLE Records for Static Handover BLE pairing. The "Static Handover" aspect refers to the use of preconfigured or static data in NFC tags. These tags contain information about the BLE device, such as its Bluetooth service UUID (Universally Unique Identifier) and other necessary data. NFC Static Handover BLE pairing simplifies the user experience by eliminating the need for users to search for and manually select devices from a list of available Bluetooth devices. It also enhances security by ensuring that devices only connect to intended partners, as the NFC tag contains specific information for secure pairing.
TOOLS | QUANTITY |
---|---|
PIC32CX-BZ2 and WBZ451 Curiosity Development Board | 1 |
NFC 4 Click | 1 |
- Connect the NFC 4 Click Board to the Mikroe header of WBZ451 CURIOSITY DEVELOPMENT BOARD using the below table.
WBZ451 | NFC 4 Click | Description | WBZ451 | NFC 4 Click | Description | |
---|---|---|---|---|---|---|
AN | NC | NC | PWM | NC | NC | |
RST | NC | NC | INT | 15(IRQ) | INTERRUPT | |
CS | 3(CS) | CHIP SELECT | RX | NC | NC | |
SCK | 4(SCK) | SPI CLOCK | TX | NC | NC | |
MISO | 5(MISO) | MASTER IN SLAVE OUT | SCL | NC | NC | |
MOSI | 6(MOSI) | MASTER OUT SLAVE IN | SDA | NC | NC | |
3.3V | 7(3.3V) | POWER SUPPLY | 5V | NC | NC | |
GND | 8 (GND) | GROUND | GND | GND | GROUND |
-
- Version: 6.10
- XC32 Compiler v4.10
- MPLAB® Code Configurator v5.2.1
- PIC32CX-BZ_DFP v1.1.218
- MCC Harmony
- csp version: v3.17.0
- core version: v3.13.0
- CMSIS-FreeRTOS: v10.4.6
- wireless_pic32cxbz_wbz: v1.1.0
- dev_packs: v3.17.0
- wolfssl version: v4.7.0
- crypto version: v3.7.6
- 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 - The project graph for this Demo application is shown below.
Step 3 - In MCC harmony project graph, Add the BLE Stack from device resources under Libraries->Harmony->wireless->drivers->BLE and will prompt an Auto-activation for "Device_Support","PDS_SubSystem","NVM","Cryptographic","wolfcrypt Library" component, give yes to add the component and give yes to Auto-connect.
- In Device_Support add satisfiers by right click on the "⬦" in Device_Support->RTC to add the RTC component.
- Configure the BLE Stack as Shown below.
Step 4 - 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 5 - In MCC harmony project graph, select wolfCrypt Library and configure as mentioned below.
Step 6 - In MCC harmony project graph, Add CONSOLE from Device Resources under Libraries->Harmony->System Services to add the "CONSOLE" component as shown below.
- To add satisfiers as shown above right click on the "⬦" in CONSOLE->UART and add the satisfier "SERCOM0" to add the component. Then select the SERCOM0 to configure as shown below.
Step 7 - In MCC harmony project graph, select system and configure as mentioned below.
Step 8 - In MCC harmony project graph, select Core and verify the mentioned below.
Step 9 - In MCC harmony project graph, select FreeRTOS and configure as mentioned below.
Step 10 - In MCC harmony project graph, Add EIC from Device Resources under Libraries->Harmony->Peripherals to add the "EIC" component and configure as shown below.
Step 11 - In MCC harmony project graph, Add TIME from Device Resources under Libraries->Harmony->System Services to add the "TIME" component and configure as shown below.
Step 12 - In MCC harmony project graph, Add the Device Information Service from device resources under Libraries->Harmony->wireless->drivers->BLE->Services to add the "Device Information Service" component and configure as shown below.
Step 13 - In project graph, go to Plugins->Pin configurations->Pin settings and set the pin configuration as shown below.
- Use these PIN Names while configuring.
USER_LED
CLICK_NFC_CS
CLICK_NFC_IRQ
USER_BUTTON
Step 14 - Generate the code.
Step 15 - From the unzipped folder copy the folder nfc4_click for adding the Header and Source files from RFAL and NDEF.
- In the project explorer, Right click on folder Header Files and select “Add Existing Items from Folders…” to add the header files and do the same for Source Files folder to add source files.
Step 16 - Change the following Code as givien below.
- In your MPLAB Harmony v3 based application go to "firmware\src\app_user_edits.c", make sure the below code line is commented.
//#error User action required - manually edit files as described here.
-
In your MPLAB application copy and paste the entire code from the mention file with link given below.
-
In your MPLAB application add the following code in the mention file with link given below.
-
- Add the following code
extern TaskHandle_t xISR_APP_Tasks;
-
- Add the following code
bool SYS_TIME_TimerPeriodHasExpired(SYS_TIME_HANDLE handle) { SYS_TIME_TIMER_OBJ* tmr = NULL; bool status = false; if (SYS_TIME_ResourceLock() == false) { return status; } tmr = SYS_TIME_GetTimerObject(handle); if(tmr != NULL) { status = tmr->tmrElapsedFlag; /* After the application reads the status, clear it. */ tmr->tmrElapsedFlag = false; } else { status=true; } (void) SYS_TIME_ResourceUnlock(); return status; }
-
Step 17 - Clean and build the project. To run the project, select "Make and program device" button.
Step 18 - The Application Serial logs can be viewed in TERA TERM COM PORT.
NOTE | Use the reference links given below to know more about the hardware and software application |
---|
-
Bluetooth® Secure Simple Pairing Using NFC has the NDEF message format for the Simplified Tag Format which is implimented in this application as mentioned below.
- The Precompiled hex file is given 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.
The application folder can be found by navigating to the following path:
- "firmware/WBZ451_NFC_SH_BLE.X"
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.