Step 6: Debug Your Application

Last modified by Microchip on 2024/01/26 19:10

Congratulations! You’re done. You are ready to debug your third application.

Before you program and run the application, delete the tone.txt file on the micro SD card. You will load the tone.txt file using the newly added SD card reader functionality.

Make sure that the micro SD card is inserted into the micro SD card slot (J8) on the MEB II.

Connect a USB cable from the micro USB connector (J4) on the PIC32MZEF Starter Kit board to the PC.

Connect a headphone to the HP Out connector on the MEB II.

Before you start the debugger, you may want to set a breakpoint in the application file in app_button_press_task.c to verify that the application reads the button press and switches to the appropriate mode.

Set breakpoints

Debug your application! Click the Debug Main Project debug project icon icon.

The application boots in the SD card Player mode. You will not be able to hear the tone as the tone.txt file was already deleted from the micro SD card.

Next, you will load the tone.txt file to the SD card from the PC. Press the switch S1 on the MEB II. Verify that the breakpoint is hit and the application mode is changed to SD card Reader mode.

Remove all breakpoints, press the F5 key and allow the application to run.

Wait for the PC to enumerate the USB MSD. Verify that the device appears as a Removable Storage Device. On a Windows® machine, do this by clicking on the My Computer (or Computer) icon. Click on the drive and copy the tone.txt file.

New PC USB device

Once the tone.txt file is copied, press the S1 button to go back to Player mode. Plug your earphones in and you should be able to listen to the tone!

Back to Top