制造商零件编号 PCM2906CDB
IC STEREO AUD CODEC W/USB 28SSOP
Texas Instruments
License: None ADCs Amplifiers DACs Headphone / Audio Cables USB Cables
Background
I recently built a new small-form-factor PC, and it's been working great so far! However, one gripe is that since the case was designed to be as small as possible, there is no audio jack. While this is not ideal, it served as the perfect opportunity for me to look into a project I've been thinking about for a long time: a USB-based audio interface. A good place to start when thinking about projects like these are real-life products. There are many USB headsets out there, so let's investigate.
How do USB headsets work?
If you think about how USB (Universal Serial Bus) works and then about how headphones work, it might get a little confusing: Isn't USB a digital interface, whereas audio (stereo for example) is an analog interface? Doesn't this mean we have to find a way to bridge them? This, in fact, is where all of the complexity lies. Here's a (very) simplified block diagram describing how the process goes:
The host, likely your PC, will engage in communications with the USB device, over that bus. A "USB Device" is any peripheral that connects to a host device over a USB connection -- think keyboards, mice, video cameras, printers, or in our case, headsets, or headphones. Upon connection to the host, the USB device will "introduce itself" to the host, importantly, what device class it is. This process is called Enumeration. Speaking on a lower level, a USB device can be implemented in a multitude of ways -- think ASICs (Application Specific Integrated Circuits) or MCUs (Microcontrollers). For instance, a wide variety of the MCUs from the STM32 families have a USB device peripheral.
The USB specification defines a dedicated USB Audio Class, which details how analog audio is represented in digital USB packets. Once the device receives these packets, it needs a way to turn the digital packets into analog audio. This can be done with a DAC (Digital-Analog Converter). Interfacing the DAC highly depends on the device. It can be internal or external, it can connect over SPI, I2S, I2C, etc. Note, for the mic input, the same thing goes, just in the opposite direction using an ADC (Analog-digital-converter).
What are some potential solutions?
The very first thing I thought of was to use a microcontroller, in my case an STM32. They usually have all the interfaces we'd need: USB device, internal DACs, and ADCs, I2S (Inter-Integrated Circuit Sound) if we want to use an external DAC, etc. However, the more I thought about it, the more unappealing it sounded. At the very least, you'd have to write firmware to:
- Configure the USB Audio Device
- Configure the DAC / ADC interface
- either internal or over some protocol (I2S, SPI, etc.)
- Likely configure a DMA (Direct Memory Access) stream between a USB buffer and the DAC
- Make sure that the Host and USB device are in sync
- Essentially, the USB Device can't "consume" the Host data too quickly or too slowly -- this will cause glitches in your audio stream.
- If you're interested in this process, look into the different types of USB Audio modes there are (Adaptive and Asynchronous).
That last task especially requires a good amount of reading of the USB Audio specification. See Section 5.10.4.2 of the USB Specification and Section 3.7.2.2 of the Audio Device Class specification for more info.
If only there were a chip that could do this all for us...
Enter: Texas Instruments' PCM2906C
Luckily for us, TI has an entire selection of Audio USB Converters, the PCM29xx series! We want a bus-powered application, meaning that the USB host will supply all the power needed for the interface. This is opposed to a self-powered application, which means that we'd have to supply the power with some other interface (battery, barrel jack, etc.).
Bus-power simplifies stuff on our side, but with that simplification comes some limitations -- we can only work with 5V (The standard USB voltage rail). If we want to have an amplifier with a higher voltage level, we have to either self-power or boost the 5 volts up somehow. This will be a topic for another day.
This lands us on the PCM2906C. Reading the datasheet, we can see the following features:
- Fully integrated USB Audio Stereo Codec
- Uses USB 1.1 as a USB Audio Class
- USB is backward compatible, so this will work even though USB 1.1 is... ancient.
- This will also greatly simplify PCB Layout, as the requirements listed by USB 1.1 are far, far simpler to implement.
- 16-bit DAC/ADC
- DAC Sampling rate options: 32, 44.1, and 48 kHz
- ADC Sampling rate: 8, 11.025, 16, 22.05, 32, 44.1, and 48 kHz
- Also includes digital S/PDIF interface
- USB Adaptive Mode for audio output, Asynchronous for input
- Includes a HID (Human Interface Device) class function
- Volume and mute controls
All of this in one chip, no firmware required! Best of all, it's still in production and available for purchase at DigiKey!
Conclusion
Now that we've found a part that will do what we want, join me for part 2 where we'll explore how the PCM2906C works, design a PCB-based prototype for our USB Audio Interface using KiCad, and test it in the lab!