Audio Output Device example

Document created by jorge_plascencia Employee on Apr 25, 2016Last modified by Diana Torres on Apr 26, 2016
Version 2Show Document
  • View in full screen mode

Description

This example implements an audio interface class device mode device that enumerates as audio device (USB speakers) and sends the samples sent to it from the host to the audio circuitry on the board.

 

Compiler build configurations

The software that makes up this example is designed to run on many different development boards. Therefore the compiler must be configured to build an image that is targeted to the development board you are using. This section explains how to set these build configurations for each of the supported compilers.

NOTE: read the Design notes section below if you are running this example on a part that supports high speed controllers.

 

LPCXpresso IDE

 

Configure projects

  right click on the BSP project in the project explorer window
  click Build Configurations->Set Active->(see configuration in table below)
  repeat these steps with the CDL, nxpUSBlib, and Example_AudioOutputDevice

 

Configure MCU

  right click on the Example_AudioOutputDevice project in the project explorer window
  click Properties->C/C++ Build->MCU settings->(see configuration in table below)

 

Configure the indexer

   click Window->Preferences->C/C++->Indexer->Use active build configuration

BSP

CDL

nxpUSBlib

Example_AudioOutputDevice

MCU

LPC1850  / Hitex

LPC18xx_HITEX

LPC18xx

LPC18xx_Device

LPC18xx

LPC1850

LPC4330  / Xplorer

LPC4330_Xplorer

LPC18xx

LPC18xx_Device

LPC18xx

LPC4330

LPC4350  / Element14

LPC1435_ELEMENT14

LPC18xx

LPC18xx_Device

LPC18xx

LPC4350


NOTE:
The LPC18xx CDL is used with boards that hold LPC43xx parts. This is done because the LPC43xx CDL is currently experimental. The LPC18xx USB library is used because both parts share the same controller.

 

Keil uVision 4 IDE


Configure a Batch Build

 

  click on Project->Batch Build...
  expand the BSP project to display a list of project targets
  select the project target by checking the appropriate checkbox (see target list in table below)
  repeat these steps with the CDL, nxpUSBlib_Device, and Example_AudioOutputDevice

BSP

CDL

nxpUSBlib_Device

Example_AudioOutputDevice

LPC1850  / Hitex

HITEX1800

LPC18xx

LPC18xx_Device

HITEX1800

 

Board connections and configurations

 

LPC18xx_HITEX (LPC1850 Hitex Evaluation Board)  older A2 design

schematic ./BSP/schematics/HITEX_SCM_LPC1850EVA-A2-2.pdf

 

Connect the JTAG to the 20 pin receptacle marked X4 JTAG
Connect the type-B end of a USB cable to the receptacle marked X2. Plug the type-A end of this cable into a PC
Connect the mini-phono plug on a pair of headphones to the receptacle marked HP

 

LPC18xx_HITEX (LPC1850 Hitex Evaluation Board)  newer A4 design

schematic ./BSP/schematics/HITEX_Final_LPC1850EVA-A3.pdf

LPC4330_Xplorer (NGX Xplorer Evaluation Board with LPC4330)


Connect the JTAG to the 10 pin receptacle marked J2
Connect the micro-b end of a USB cable to the receptacle marked USB0. Plug the type-A end of this cable into a PC
Connect the mini-phono plug on a pair of headphones to the receptacle marked J5

LPC1435_ELEMENT14 (Element 14 gaming board with LPC4350)


Connect the JTAG to the 10 pin receptacle marked J6
Connect one end of a type-A to type-A USB cable to the receptacle marked USB0. Plug the other end of this cable into a PC
Connect the mini-phono plug on a pair of headphones to the receptacle marked J1

PC configuration

Use a PC running Windows XP, Vista or 7
Connect the type-A end of the USB cable that is connected to the board into one of the USB receptacles on the PC

Build and debug the example


LPCXpresso IDE

In the project explorer window of the IDE right click on the Example_AudioOutputDevice project and select Debug As->C/C++ MCU Application
In the main window of the IDE click Run->Resume to start running the application

 

Keil uVision 4 IDE

In the Batch Build window, select the project targets as described in Compiler Build Configurations and then click Build
In the main window of the IDE click Debug->Start/Stop Debug Session click Debug->Run

 

How this example runs and what to look for


On the PC select Control Panel->Hardware and Sound->Sound
When the example is first run a new entry in the Sound dialog box will appear titled Speakers and have a description that reads "4-nxpUSBlib Audio Out Demo". Below this description should be the word Ready.

 

To test the audio output click on this entry in the Sound dialog box. Then click on the Configure button to bring up the Speaker Setup dialog box. In this box press the Test button. Sound should be played through the left side of your headphones first, then the right side.

Design notes


This example is designed to run only at full speed. The nxpUSBlib runs the USB controllers on the LPC18xx and LPC43xx parts at high speed by default. This default must be changed to run this example properly on these parts. To do this, change the value of the definition USB_FORCED_FULLSPEED in the file libraries/nxpusblib/nxpUSBlibConfig.h to 1

Attachments

    Outcomes