Step 6: Debug Your Application
Last modified by Microchip on 2024/02/06 09:20
Congratulations! You’re done! You are ready to debug your application!
Before we program and run our application, we need to program the microSD card with the WAV audio files. Go to the dev_files folder of this exercise and copy a few sample WAV files to the microSD card.
Insert the microSD card into the microSD card slot (J8) on the MEB II.
Before you start the debugger, you may want to set a breakpoint in the application file in app_sdcard_audio_task.c to verify that the important stages of the application (like the opening of the CODEC driver and mounting of the file system on the SD card) were executed successfully.
Put a breakpoint in the APP_SDCARD_AUDIO_PLAYER_STATE_TRACK_CHANGE state that will indicate that an audio track is complete and the next track will be selected for playing.
Debug your application! Click the Debug Main Project icon.
Single step (by clicking F7) and observe the flow of control in the application state machine.
Put a breakpoint in the buffer event handler. Hitting the breakpoint in the event handler indicates that the last submitted buffer is transferred to the CODEC.
Remove all breakpoints and click F5 to allow the application to run.
Connect a headphone to the HP Out connector on the MEB II and you should hear the audio track being played.
You may load more WAV audio files by switching to the USB SD card reader mode (by pressing the switch S1 on the MEB II). After loading, switch back to the player mode and you should hear the newly added audio tracks to the SD card.