Step 6: Test Application

Troubleshooting your code's run-time behavior has never been easier. MPLAB® Data Visualizer is a free debugging tool that graphically displays run-time variables in an embedded application. Available as a plugin for MPLAB X Integrated Development Environment (IDE) or a stand-alone debugging tool, it can receive data from various sources such as the Embedded Debugger Data Gateway Interface (DGI) and COM ports. You can also track your application's run-time behavior using a terminal or graph.

We’ll use MPLAB Data Visualizer to display messages from the software and verify it is functioning correctly. If you have a microSD card reader, we’ll show you how to verify the file contents as well.

Step 6.1 - Open and configure Data Visualizer


Open Data Visualizer by clicking on the DV icon in MPLAB X IDE.



Close the extra display windows, they won’t be used. Only the Terminal Display is needed.


Step 6.2 - Select displayed parameters


Select Send to Terminal for the appropriate communication channel.

Note: The correct communication channel number will likely be different than what is shown here.



Select the same communication channel for the Input Source.


Step 6.3 - Verify the correct operation


Insert the microSD card into the MIKROE microSD Click Board.


Press the Play button in MPLAB X IDE. The project will build, program, and run.


Upon success, the Data Visualizer Terminal window will display the following messages:


If you have a microSD card reader, you can verify the file contents by opening TEST.TXT.


The TEST.TXT file contents will match the data shown previously in the Data Visualizer Terminal window output:


Note: It is recommended to eject the SD card prior to removing it from the computer.


Step 6.4 – Results

You observed the application create, write, read and close a text file on a microSD card. This information is displayed on MPLAB Data Visualizer via the MCP2221 Breakout Module using a MIKROE microSD card Click Board.

Step 6.5 – Analysis

You have successfully created a microSD application using MPLAB Code Configurator (MCC) and the Microchip File System Library. Your application used all the fundamental elements that go into building a real-time microSD application to write and read data. This application determines if the card is present, registers the file system object to the FAT File System module, creates and opens a new file (TEST.TXT), writes a data string, reads it back then finally closed the file and unmounts the drive. You configured the FAT and SD Card MCC libraries. You set up UART1 to interface with the MCP2221A USB to UART module to display metering data via MPLAB Data Visualizer. Finally, you also configured GPIO for the microSD card interface.

Step 6.6 – Conclusions

This tutorial provided you with training for configuring the Microchip File System Library using MPLAB X IDE and MCC. As a next step, you can create your own application to suit your needs. You can also investigate the Application Programming Interfaces (APIs) available in the FatFs – Generic FAT Filesystem Module to add functionality to your own application. Ultimately, if you were to use another MCU supported by MCC, you can explore a similar solution. Note that the pin configuration would change since the MCU resources will be different.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.