Lab 7- Debugging and Testing the IoT MPLAB® Harmony Application
Introduction
This lab training focuses on debugging, testing, and validating the IoT thermostat application on the SAM9X75 Curiosity Wireless Kit , ensuring reliable operation in a real-world embedded environment. Using the MPLAB® PICkit™ 5 debugger in conjunction with MPLAB X IDE and associated debug tools, developers can set breakpoints, step through code, monitor variables, and inspect peripheral registers in real-time. This stage also involves testing wireless communication (Wi-Fi® and RNBD), verifying MQTT message flow, and evaluating the performance and responsiveness of the embedded Wizard–based GUI. Effective debugging and validation are critical to ensure the system behaves predictably under various runtime conditions.
Debugging Application Project on MPLAB® X IDE
You can debug either a project you have created or one that is available on GitHub.
To debug a project from GitHub, start by cloning the repository using the following Git command:
After cloning the repository, follow the steps below to proceed with debugging.
Open the project in MPLAB X IDE.
In the Projects pane, right-click on the project and select Properties from the menu. The Projects Properties dialog box opens.
Ensure SAM9X75D2G is selected as hardware tool to program/debug the application.
In the Connected Hardware Tool drop-down menu, select the PICkit 5 debug probe and click the Apply button.
In the Categories pane, select PICkit 5.
In the Option categories drop down box, select Communications.
Select the Interface as JTAG.
In the Categories pane, select Bootstrap.
Observe that Use bootstrap is selected and the pre-compiled version of the at91bootstrap.elf is selected. (The pre-complied at91bootstrap.elf can be found in the project directory of the downloaded project).
Click the Apply and OK buttons.
Build the project.
Click on the Debug Project icon on the toolbar.
The project will build with debugging parameters. Load the application binary to the SAM9X75-Curiosity, and halt at main. Once the build is complete and the application binary is loaded into the target, the toolbar expands to show additional debugging icons.
Click the Continue, Step In or Step Out buttons to debug the project.
Observe the debug messages displayed on the console:
If you stop a debug session you must press the Reset button on the SAMA9X75-Curiosity to initiate the boot process before launching another debug session.
MPLAB X IDE does not create the .bin file by default. So, we need to use post build commands to generate the .bin file.
Go to Project Properties > Building. Enable the Execute this line after build option and insert the following command.
Build the project. The bin file output can be found in the following path: <your_project>.X\dist\..\production\
To test the MPLAB Harmony IoT application, click Continue on the debug window and follow the steps 9-15 here.
Summary
In this training, you have learned how to debug an MPLAB Harmony v3 IoT application example using MPLAB X IDE on the SAM9X75 Curiosity Wireless Kit.
What’s Next?
- SAM9X75 Curiosity Wireless Kit-Based IoT Thermostat Application
- Lab 1 - How to Create an MPLABX IDE Project
- Lab 2 - How to Integrate Temperature Sensor to an MPLAB X IDE Project
- Lab 3 - How to Integrate RNBD Module to an MPLAB X IDE to Establish Bluetooth® Communication
- Lab 4 - How to Integrate M.2 Wi-Fi® Module to an MPLAB X IDE Project to Establish Wi-Fi Communication
- Lab 5 - How to Integrate MQTT to an MPLAB X IDE Project to Publish and Subscribe Data to/from a Cloud Broker
- Lab 6 - How to integrate Embedded Wizard-Generated Code with MPLAB X IDE Project
- Lab 8 - Running the Pre-built MPLAB Harmony IoT Application from the SD Card