USB Component  Version 6.15.0
MDK Middleware for USB Device and Host Communication
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
USB Device Audio

The Audio Device Class (ADC) is used to send or receive audio, voice, and other sound-related functionality. This example demonstrates a USB Audio Device attached to the USB Host Computer to provide this capability.

The following picture shows an exemplary connection of the development board and the USB Host Computer. Using the USB connection, the development board will play sound using its on-board speaker:

adc_dev_example_setup.png

The Abstract.txt file contained in the Documentation group of the Project window gives you more information on the general setup and the available I/O on the development board.

Build the "USB Device Audio" Project

Open the example project in MDK. The ┬ÁVision Project window should display a similar project structure:

usb_adc_example_proj_window.png
Typical Project Structure of a USB Device Audio Example

Source Files

  • Audio.c contains the main C function that initializes the board hardware and the USB Device Component.
  • The file USBD_User_ADC_0.c is an adapted code template that implements all necessary functions. Refer to ADC: Audio Device Class for details about these template functions.

If you are using RTOS other than CMSIS-RTOS2 RTX5 for your project please make sure to satisfy USB Device Resource Requirements.

You may now build and download the example project to the evaluation board using the ┬ÁVision commands:

  • Project –> Build target (F7)
  • Flash   –> Download (F8)

After these steps, the project should start executing on your evaluation kit. In case of errors, refer to the Evaluation Board User's Guide for configuration information.

Using the "USB Device Audio" Project

Hardware Setup

The setup of the Evaluation Board hardware is described in the Abstract.txt file.

  • Verify all jumper settings on the target hardware.
  • Use a USB cable to connect your development board to the Host PC and power up your board.
  • The Welcome to the Found New Hardware Wizard appears. Installation of the driver is described in detail in the Abstract.txt file.
  • If detected correctly, you should be able to see the following message:
adc_install_ok.png
Installation succeeded

PC Software

Use any PC software that is capable of playing audio. Normally, the device that has been connected last will play the audio data. If you do not hear any sound coming from the on-board speaker, check your system settings.