I decided to do this project because I had been playing with PJRC's own audio board, but a lot of people on the forums had been asking about higher quality audio, and I thought it sounded like a fun design challenge.
I started the design by choosing the audio codec. The best one that I could find for a moderate price and in a package conducive to hand soldering (ie, no QFN, BGA, etc) was the Cirrus CS4272.
The CS4272 is a really high quality codec. It can do sample rates up to 192kHz at a bit depth of 24 bits. It's banner specs are a THD+N of -100dB and a dynamic range of -114dB. It is an ideal choice for a professional quality sound board.
One issue with the CS4272 is that it doesn't include the analog input and output buffers that are commonly integrated into lower quality audio codecs. This necessitates a lot of additional external circuitry that must be carefully designed to avoid compromising the audio quality of the codec itself.
Another big design constraint was to keep the Teensy side of the board fully isolated from the codec to prevent ground loops when audio equipment is connected to the device.
Here's a quick design overview:
- Power supplies:
- There is a switch mode supply to generate +5.7V for the LDOs
- Can accept +3V to +7V (designed for 4xAA batteries or USB power)
- There are 2 LDOs to generate the final, clean +3.3V digital, and +5V analog supplies
- There is a lot of filtering between the switching supply and LDOs to minimize noise on the final supply lines
- There is a switch mode supply to generate +5.7V for the LDOs
- Digital interface
- The Teensy is connected to the CS4272 through a pair of digital isolator ICs
- 2 interfaces
- I2C for control
- I2S for data
- and a reset pin (GPIO on teensy)
- The isolators have ~50 ohm source and receiver impedance, so there are source terminations added to the codec outputs
- Codec
- CS4272
- 24.576MHz crystal
- Allows CS4272 to be I2S interface master
- Minimize interface jitter
- Audio output buffers
- THS4521 fully differential opamp (really good specs)
- 3rd order bessel filter
- <0.5dB rolloff to 20kHz
- MFB topology
- Fully differential output
- Capacitively coupled with 100uF electrolytic caps
- Audio input buffers
- THS4521 fully differential opamps
- Topology optimized for driving 2.7nF input capacitor
- Input impedance is somewhat low at 1k Ohm
- Impedances optimized for THS4521 performance
- Could increase impedances, but worse noise, distortion
- Fully differential inputs
- Capacitively coupled with 100uF electrolytic caps
The testing I've done so far shows that the board is performing very well. I don't have any test equipment or audio gear that's good enough to do real testing, so I've been looping back the board's outputs to its inputs, and measuring the performance that way. The only downside is that there is no way to separate the output response from the input response, but the individual responses should be better than the overall loopback response.
Here are some plots of the testing results, along with the measured performance specs:
THD+N of left channel loopback measured at -98.6dB
Dynamic range of left channel loopback is 107dB
~130dB of isolation between left and right channels
Flatness better than 0.5dB 20Hz to 20kHz (48kHz sample rate)
Frequency response with 192kHz sample rate (-6dB rolloff at 65kHz)
Update 6-7-15: Ran a 48kHz THD+N test using the output and input single-ended. Results look pretty good, the THD+N degraded <5dB:
Design and build thread at Teensy forums: Forum Link
I see you are putting the overlay for this project into the Raspbian distribution and that it is available for testing via rpi-update. Keep up the good work and keep us posted!