AT90USBxxx USB Host Audio Sample applicaton
Use of this program is subject to Atmel's End User License Agreement.
Please read file LICENSE.TXT for copyright notice.
This embedded application source code illustrates how to implement a simple USB host application with basic Audio microphone support.
To use the application, the SK525 should be configured to be self powered (see STK525 hardware manual).
The application uses host operating mode of the STK525. In host mode, the USB can be connected (with a mini A connector attached to the mini AB STK525 receptacle) to a standard USB Audio microphone device (or another STK525 running device Audio Device application). The USB configuration requires only an ISOCHRONOUS IN PIPE more the default Control endpoint.
As illustrated in the figure bellow, the application entry point is located is the main.c file. The main function first performs the initialization of a scheduler module and then runs it in an infinite loop. The scheduler is a simple infinite loop calling all its tasks defined in the conf_scheduler.h file. No real time schedule is performed, when a task ends, the scheduler calls the next task defined in the configuration file (conf_scheduler.h).
The application is based on two different tasks:
- The usb_task (usb_task.c associated source file), is the task performing the USB low level enumeration process in device mode or host mode.
- The host_audio_task is active allows to initialize a connected Audio microphone device and manage streaming : As soon as the device is enumerated, the IN PIPE that serve to stream transmission is unfreezed, and a new sample frame is get back from the device. The application is set for a 8kHz 16 bits PCM coding, so frames contains 8 words (16 bytes) A timer triggers an interrupt every 120µs (see "host_audio_task.c" for more details), to constantly update the analog output with a new sample.
The Digital-to-Analog converter can be built like user wants (external D/A converter, PWM, R-2R ladder). This demonstration package uses R-2R ladder to avoid synchronisation mismatches between PWM frequency and ouput updating rate. The 8 bits R-2R ladder used is connected on the PORTA. As explained in the "host_audio_task.c" file, the "void DAC_SendPort(U8 data_dac)" function can be adapted to a solution other than R-2R ladder D/A converter.
First the basic schematic of a R-2R ladder. The resistors value can be changed, but still respecting the 1:2 ratio. If this schematic is used, the DAC_OUT label must be defined to PORT_A_RIGHT in "host_audio_task.h" file.
And then, another solution that is more easy to implement directly on the EXPAND0 connector of a STK525 board. If this schematic is used, the DAC_OUT label must be defined to PORT_A_CPLX in "host_audio_task.h" file.
Generated on Fri Oct 31 15:19:18 2008 for ATMEL by
1.5.3