Some projects need a lot of audio I/O. Maybe you’re doing positional audio sound effects (using the 8-tap delay effect) where ordinary stereo or even 5 channel “surround” isn’t enough? Maybe you’re making the ultimate Eurorack synthesizer module? Or you just want a lot of signals, because you can!
Here’s a board for the Cirrus Logic CS42448 chip, which provides 6 inputs and 8 outputs. All are high quality audio, and all work simultaneously.
TDM Data Interface
Normally digital audio is communicated between chips using I2S protocol (which is different than I2C, despite the similar acronym). Two I2S streams can be used for quad channel, but to really step up to more channels, you need TDM protocol.
TDM, which stands for Time Division Multiplexing, communicates a frame of 256 data bits. For 44.1 kHz, this means the bit clock must be 11.3 MHz. Only 4 signals are used, one to transmit all 256 bits and another to receive all 256, a frame sync signal the marks where each 256 bit frame begins, and of course the 11.3 MHz clock.
Here is the TDM waveform documented by Cirrus Logic for the CS42448 chip.
Actual TDM Signals
When viewed on an oscilloscope, here is how the TDM signal actually appears:
During this test, the code below was running. The output from Teensy is the blue trace. It sends a 16 bit guitar synthesis to CS42448 AOUT1 & AOUT2. Because the CS42448 outputs are 32 bits, but the audio is only 16 bits you can see the lower 16 bits are always zero. Most of the rest of the output is zeros, except this example also brings in AIN1 and sends its top 16 bits to AOUT5 and its lower 16 bits to AOUT6.
Of course, the green trace is the data being received from the CS42448. All 6 inputs were left unconnected. Even through the channel slots of 32 bits, the CS42448 only produces 24 bits of data, and its lower 8-9 bits are mostly random noise. This PCB uses only the simplest single-ended input circuit. The better opamp-based differential circuit documented in the CS42448 could be expected to improve performance.
TDM support has recently been added to the Teensy Audio Library. It’s accessed by creating AudioInputTDM and AudioOutputTDM objects.
Each AudioInputTDM creates 16 simultaneous inputs. Like all communication in the Teensy Audio Library, the data is 16 bits wide. 16 of these channels gives access to all 256 incoming TDM bits. For CS42448, only channels 0, 2, 4, 6, 8 & 10 would be really useful.
Likewise, each AudioOutputTDM object can accept 16 simultaneous 16 bit audio streams, to fully control all 256 bits of the TDM output frame. For CS42448, only the 8 even numbered channels are useful.
You might think sustained 11.3 Mbit/sec communication would be difficult on a microcontroller, but it turns out Teensy's digital audio port with FIFO and its DMA engine make this quite easy and efficient. Yes, really!
Development of the audio software support is being discussed on this forum thread. If you make one of these boards, please join the conversation!
Parts Placement Diagram
Bill Of Materials
1 CS42448, Codec Chip 598-1033-ND 1 CAT811T, Reset Chip CAT811TTBI-GT3OSCT-ND 7 Connector, audio CP1-3525N-ND 7 Resistor, 150 ohm, 603 311-150HRCT-ND 8 Resistor, 560 ohm, 603 RMCF0603FT560RCT-ND 2 Resistor, 2.2K ohm, 603 311-2.20KHRCT-ND 8 Resistor, 10K ohm, 603 311-10.0KHRCT-ND 7 Resistor, 100K ohm, 603 311-100KHRCT-ND 14 Capacitor, 2.7nF, NP0, 805 445-7508-1-ND 4 Capacitor, 10nF, X7R, 603 490-1512-1-ND 7 Capacitor, 0.1uF, X7R, 603 490-1524-1-ND 14 Capacitor, 4.7uF, X5R, 805 1276-6463-1-ND 7 Capacitor, 10uF, X5R, 805 399-4925-1-ND 1 Capacitor, 22uF, X5R, 805 490-1719-1-ND 1 Capacitor, 100uF, X6T, 1206 490-10525-1-ND 1 Inductor, Ferrite Bead, 805 490-1054-1-ND 1 Circuit Board oshpark.com/shared_projects/2Yj6rFaW 1 Teensy 3.2, 3.5 or 3.6 www.pjrc.com/store/teensy32.html 2 Socket, 14x1 www.pjrc.com/store/socket_14x1.html 2 Header, 14x1 www.pjrc.com/store/header_14x1.html 1 Heatsink (optional: CS42448 runs hot)