3.3 BLE Virtual Sniffer
This document explains how to use the MPLAB Code Configurator(MCC) framework to add BLE Virtual Sniffer system service component for capturing the BLE HCI packets and feed it to the sniffer tool for debugging purposes.
Introduction
The BLE Virtual Sniffer uses BLE LOG middleware available as part of the BLE Stack (BLE stack
dependency) for restructuring of the HCI protocol packets. The BLE Virtual Sniffer
has dependency of UART (to Output the HCI packet) which can be satisfied through
Harmony SERCOM Plib (UART).
Hardware Requirement
Tool | Qty |
---|---|
WBZ451Curiosity Board | 1 |
Micro USB cable | 1 |
SDK Setup
Software Requirement
Developing an Application with BLE SNIFFER component using MPLAB Code Configurator(MCC)
This section describes the steps required by a user to integrate and use the BLE
Virtual Sniffer component into any application.
Note: It is
recommended that new users of MPLAB Code Configurator go through the overview of MCC. For more details on how to add/remove different
components like peripheral support and other wireless functionality, go to MPLAB® Code Configurator (MCC).
- Create a new MCC Harmony Project. For more details on creating a new MCC Harmony project, refer to 2.5 Creating a New MCC Harmony Project.
- Ensure that wireless_system_pic32cxbz_wbz repo is available locally in the H3 repo environment.
- Open MCC. The Wireless System Service components will be displayed . In Device Resources, click Wireless and select System Services from the drop down. The following image illustrates the steps.
-
Drag BLE SNIFFER component from Device Resources to project graph area and accept all Dependencies or satisfiers(auto-activation components), select "Yes".
-
BLE SNIFFER will automatically enable the BLE LOG FEATURE(Enable BLE Log option) inside Ble stack as shown in the figure.
-
Connect the BLE SNIFFER with one of instances of SERCOM to satisfy the "UART" dependency of BLE SNIFFER.
-
Ensure that the Transmit pinout and Receive pinout settings are configured properly inside SERCOM plib configuration options as shown in the figure.Note: Refer device data sheet for pin and pad configurations.
- Generate the code. For more details, refer to 14.2 MPLAB Code Configurator(MCC) Code Generation .
-
After generating the program source from MCC interface by clicking Generate Code, the BLE LOG application service can be found in the following project directories.
- Compile and Run the project in WBZ45x device.
Capturing and Parsing the HCI Sniffer Packets through Microchip BLE Sniffer Tool
- Ensure to install the Wireless Protocol Suite.
- Open the WPS installed location and copy the
following files as illustrated in the figure.
-
liveimport and LiveImportAPI.dll (available inside Executables->core as part of WPS installation).
- Microchip_BLE_Sniffer_Tool (available in the link in software section).
-
- Open command prompt from the WPS installed location and run Microchip_BLE_Sniffer_Tool using the following command Microchip_BLE_Virtual_Sniffer_Tool.exe <"com_port"> <"Baud_Rate"> (eg: Microchip_BLE_Virtual_Sniffer_Tool 23 921600) as illustrated in the following figure.
- Open WPS tool and virtual sniffing data capture option in the Startup page and select Start record as illustrated in the following figure.
-
Reset the WBZ451 device and the captured packet will appear in WPS Tool and the total number HCI packets captured will be displayed in the Microchip_BLE_Sniffer_Tool command prompt as illustrated in the figure.