The Positive Rail
  • Blog
  • About
  • Contact

The $2.00 stereo audio codec/mixers: TI LM29451, Maxim MAX9867 and Freescale SGTL5000

8/14/2014

2 Comments

 
In the last generation of the Tabata Timer I added an audio pass-through circuit so that someone could plug it into their existing stereo system and have the timer signals mixed into their music, and digital volume control using a MCP4013 digital potentiometer.   

I made some mistakes . My active ground mixer circuit is single ended so it clips the negative side of the input signal, resulting in horrible distortion.  Because I tried to split the timer mono output into two channels without using buffers, I'm getting leakage across channels.  My headphone detection circuit triggered the NMI interrupt.  But the digital pot works like a charm.  

These problems are fixable.  But I still worry about power, cost and performance.  The low power op-amps I'm using in my mixer circuit are expensive (averaging near $4.00) and I'll need more of them to solve the leakage problem.  I'm also not sure how they will do driving headphones - typical practice is to use big capacitors for headphone outputs and a proper headphone amplifier, and I don't know how my circuit will perform there.  The discrete components also take up a lot of board real estate and also begin to add to the cost (e.g. the digital potentiometer is ~$0.40).  

I get the sense this problem has been solved before....like, in every cellphone and MP3 player out there...and so I look online and find the world of inexpensive audio codec/mixer chips.  
My requirements are simple:
  1. Low-power stereo line-level audio pass-through so someone could leave the device plugged into their system all of the time without draining the battery too much.  In general, low power with ability to shut off parts when not needed.
  2. Headphone/line output so it behaves just like a cellphone/mp3 player
  3. Line input/mixer with volume control so that the loudness of the alerts/sounds
  4. Inexpensive - less than $4-5 total cost (as that was what my current circuit was costing me)
Picture
I started my search ad-hoc, browsing individual datasheets and googling for audio mixers.  It turned up a lot of Texas Instruments chips which seemed to have the features that I wanted, and these are called audio codec (for 'coder/decoder', I assume).  On the left is a table of the manufacturers in the 'Audio Codec' section of Octopart:

Audio codecs include:
  • Line in and microphone (digital and analog) inputs
  • Digital inputs with DACs (generally I2S but a bunch of others as well)
  • Mixing/passthrough/volume circuitry
  • DSP circuitry (for equalization, usually)
  • Line out/headphone/speaker outputs

The ones I'm concerned with here are aimed at the cellphone/portable music player market and so also have smaller footprint, power management features (e.g. being able to turn on/shut off analog and digital sections) and lower price points.

A glance at TI's website reveals a bewildering array of chips aimed at many verticals and price points.  A designer can find a super-simple phone voice/speaker/earpiece (~$3.00 in quantity) to low power stereo chips with mic inputs and amplifiers aimed at cellphones (~$5.00) to 6-8 channel input/output chip ($7.10) designed for home theater and automotive.   The variations tend to be around
  • Number of inputs - many have multiple microphones and line level inputs, stereo and mono
  • Speaker amplifier/no speaker amplifier, headphone amplifier ('capless' design seems to be a big deal)
  • High-end vs low end digital chains (e.g. 24 bit audio/192KHz with a lot of DSP).
Many of the other manufacturers (Analog Devices, Cirrus, IDT) also offer codecs - but many of these seemed to be concentrated in the higher end of the market, with prices from $6-$20, and a smaller supplier base - so I'll neglect them.  Below I'll look at the Maxim and Freescale lines.  Please let me know if there are other significant families out there!

I also noticed non-codec chips that met my design criteria.  In the Stereo Audio Subsystem portion of TI's site there are also chips without digital inputs (e.g. mainly mixing) and lower price points - e.g. the LM49251 (~$1.57 in quantity).  This seems to be an older design inherited from National Semiconductor and widely available from many suppliers.


I initially went with the TI LM49251 since I already had DAC worked out and mainly needed a low power analog bypass, volume control and mixer - it also included speaker output and a microphone/bias circuit.  After figuring out the wiring and building a schematic with it, I was disappointed to find, however, that is it only available in 0.5mm BGA - which would require 3mil traces on the PCB, beyond the capabilities of the cheap/quick fab services I was using.

Picture
The LM49251 includes microphone/bias, line in, I2C control
speaker, headphone, and headphone detect.
It is -not- a codec, as it does not have a DAC section.
After some more searching/filtering on Octopart, a couple of low end codec families popped up - also with basic line-in/mixing/headphone amp low power circuitry, simple digital input sections.  They also include capacitorless heaphone outputs and onboard PLLs to generate audio clocks from any clock source, and are available in QFN-style packages from several distributors.
  • Maxim MAX98XXX.  The MAX9867/MAX9880 ($1.30-1.70) - are stereo low power codecs with line/mic in, DAC, and headphone outputs.   Distinguishing features are ability to support two digital microphones, an auxiliary ADC to measure battery voltage and jack detection. The sibling MAX980XX chips include Class D speaker amplifiers.
  • Freescale SGTL5000 (also $1.30-1.70) - does not include the digital microphones, auxiliary ADC or jack detection.  Has a lower analog pass-through current, however (3.4mA vs 5mA).
Without doing too much more research, I ended up using the Freescale chip, if just because the analog pass-through was a bit lower and I didn't spend as much time as I should have researching the Maxim offering in favor of getting a design of some sort out the door.  Though, I have the sense that battery and jack-detection features are going to be useful.  Thankfully, the chips are similar enough that switching should be pretty easy, with most of the reprogramming in the control interface. 
Picture
The Freescale STGL5000 includes line in, mic in, I2S DAC,
an audio clock-generating PLL, headphone and line out
After incorporating the chip into the design, I had a smaller board (1.6x1.6 inches, down about a square inch) and lowered the cost of the audio subsystem by about ~$0.50.  Not that much of an absolute cost savings.  But more importantly, now I have an industry-standard audio subsystem with things like the DAC filtering, headphone amplifier, jack detection all worked out.  And I've learned a little about audio codec chips!  
2 Comments
Mick
1/26/2015 07:22:03 pm

Fascinating. I want to use the sgtl5000 as a simple dac, fed by a USB device, which ends up with I2S.
Will it work?! Got any design?!
Begging for support,
Michael

Reply
Frederick Soo link
1/28/2015 07:43:14 am

yes, this will work! I don't have a specific design for it, but basically you need to find an MCU that has a USB interface as well as I2S (e.g. the LK26 series does). You'll need to get a USB driver for the MCU, figure out how to read your stream from it into a buffer, and then play the buffer out the I2S. Hope this helps!

Reply



Leave a Reply.

    What is this about?

    Embedded systems, nascent markets and minimalist product development

    Archives

    September 2014
    August 2014
    July 2014
    June 2014

    Categories

    All

    RSS Feed