USB Audio Speaker (with RTOS) Tutorial: Step 5


< Back to Lab Start

Step 5: Verify Application Performance

Congratulations! You are ready to DEBUG Main_Debug_Project.png the application!

1

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

2

Connect a headphone to the HP Out connecter on the Multimedia Expansion Board II (MEB II).

3

Before you start the debugger, you may want to set breakpoints in the application files app.c and app1.c to verify that important stages of the application are executed successfully.

4

You may put a breakpoint in the APP_PROCESS_DATA state of APP_Tasks function in app.c, which indicates that USB Speaker is configured successfully and the application is now ready to receive an audio data stream and audio control commands.

image_100.png

5

You may put a breakpoint in the APP1_Delay function in the application file app1.c, which indicates the second application's task is performing the delay functionality, when data received from USB is processed by USB Speaker application task.

Breakpoint2.png

6

Debug your application! Click the Debug Main Project Main_Debug_Project.png icon.

7

Open your favorite track and hit the play button on the player. Verify that the application goes through the breakpoints previously set.

8

At this point, remove all breakpoints and hit the stop button on the player. Reset and run the application.

9

Open your favorite track and hit the play button on the player. You should be able to hear the audio track played on your RTOS based USB audio speaker!

Verify the Performance

You should not be able to hear any noise artifacts (static, distortion, clicks or pops) while playing the selected audio track.

 Results

You should be able to play audio tracks on a PC, with the MEB II acting as a FreeRTOS-based USB speaker. You should also be able to mute/unmute and increase/decrease the volume of the audio speaker, and hear audio without any distortion. Additionaly, you should be able to observe LED1 (D3 on MEB II) toggling at regular intervals along with the audio played on MEB II.

 Analysis

In this exercise, you have demonstrated the performance impact of using a FreeRTOS-based USB speaker over a cooperative multitasking-based USB speaker. The application was designed around two application tasks (USB Speaker and Delay Tasks). Higher CPU bandwidth of Delay Task affects the performance of USB Speaker application. You have integrated FreeRTOS and re-configured the codec, USB Library, TIMER System Service, etc., into the application to ensure the drivers are properly configured to work with the RTOS. You have fine-tuned the USB Speaker application task to provide better performance when used with FreeRTOS.

 Conclusions

This tutorial demonstrated the need for a FreeRTOS-based application when the cooperative multitasking-based application no longer works. It also showed how easily and quickly you can add FreeRTOS into your existing cooperative multitasking-based application using MHC. As a next step, you may extend the application by adding graphics equalizer support using MHC and MHGC.

© 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.