Audio Output Host example

Document created by jorge_plascencia Employee on Apr 25, 2016Last modified by jorge_plascencia Employee on Apr 27, 2016
Version 3Show Document
  • View in full screen mode

Description

This example implements an audio interface class host mode device that enumerates an audio interface class device (USB speakers) and sends samples to the device. The samples are created by a simple square wave generator in a timer ISR and shipped out the streaming isochronous output pipe when a button is pressed on the board.

 

Getting started

This example can be built and debugged using two compiler tool chains. Visit http://www.lpcware.com/content/project/nxpusblib/build-it to learn how to setup and configure these tool chains to build this example.

 

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.

 

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_AudioOutputHost

Configure MCU
  right click on the Example_AudioOutputHost 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_AudioOutputHost

MCU

LPC1850  / Hitex

LPC18xx_HITEX

LPC18xx

LPC18xx_Host

LPC18xx

LPC1850


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_AudioOutputHost

BSP

CDL

nxpUSBlib_Host

Example_AudioOutputHost

LPC1850  / Hitex

HITEX1800

LPC18xx

LPC18xx_Host

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
Plug USB speakers into the type A receptacle marked X10
Connect a 9-pin serial cable into the receptacle marked UART X1. Connect the other end of this cable into a PC running a terminal program.
To power the board:
  Connect the type-B end of a powered USB cable into the receptacle marked X13
  or
  Supply 5v to the DC connector labeled X14

 

LPC18xx_HITEX (LPC1850 Hitex Evaluation Board)  newer A3 design

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

 

PC configuration

Use a PC running Windows XP, Vista or 7 to display runtime diagnostics that can be viewed with a terminal emulation program like Teraterm or Hyperterm. The baud rate in these programs should be set to 9600.

 

Build and debug the example


LPCXpresso IDE

In the project explorer window of the IDE right click on the Example_AudioOutputHost 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

When the example is first run the terminal window will display:
Audio Output Host Demo running.

 

When the USB speakers are plugged in the terminal window will display:
Audio Device Enumerated.

 

When the button is pressed on the board the USB speakers will produce a loud tone. When the button is not pressed the USB speakers will be silent.

 

When the USB speakers are unplugged the terminal window will display:
Device Unattached.

 

Attachments

    Outcomes