USB Audio Speaker (with RTOS) Tutorial: Step 2

Step 2: Overload the state machine by adding a time-consuming application to the project

There could be real-time situations that entail adding additional functionality to an existing application. In the case of a USB speaker, one of the desired capabilities to be added is the ability to provide a graphics equalizer display support. To add the graphics equalizer support in a cooperative multitasking implementation, you may need to ensure the bandwidth of CPU usage is appropriate for every task (System Tasks, USB Speaker Application Task and Display Task). Otherwise, the functionality of the application won't provide the desired performance. For example, if the display task consumes more than a few milliseconds for rendering complex graphics display, a listener to the USB speaker would experience noise artifacts. This is because the application would now be sending delayed streaming of the audio data to the codec. The delay caused by the display task would cause no data to be written into the codec within the acceptable time for the listener to experience quality audio. This causes listeners to experience noise artifacts.

For the scope of this application, we are not integrating the graphics library. Instead, we are introducing a delay task, which creates the situation explained above.

Step 2.1: Configure MHC to add new application task

Step 2.2: Generate Harmony code

Step 2.3: Review generated source files

Step 2.4: Add time-consuming application code to the project

Step 2.5: Build and program the modified “USB Audio Speaker” application

Step 2.6: Detect and Set up the “USB Audio Speaker” on your PC

Step 2.7: Verify the performance



Next Step >
© 2018 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.