PDA

View Full Version : [queued] kxmx_kaugummi - A CS42448 Breakout Board



recursinging
01-03-2020, 08:16 AM
The Cirrus Logic CS42448 [datasheet (https://statics.cirrus.com/pubs/proDatasheet/CS42448_F5.pdf)] is a 6 input, 8 output audio codec supported by the Teensy Audio library (https://www.pjrc.com/teensy/gui/?info=AudioControlCS42448) using TDM (https://www.pjrc.com/teensy/gui/?info=AudioInputTDM) signalling (https://www.pjrc.com/teensy/gui/?info=AudioOutputTDM). Although there is a board design already available (https://oshpark.com/shared_projects/2Yj6rFaW) for this codec, I was interested in getting it to work with my Eurorack modular synth gear. This requires scaling the input and output voltage ranges differently than the existing board does, and I wanted to see how well this audio codec (which is designed for AC signals) can deal with DC.

This motivated me to create a breakout board which simply gives breadboard access to the differential input and output pins of the codec. There is a version for the Teensy 3.5/6 (https://easyeda.com/recursinging/kxmx_kaugummi_3.5-6) which I've built and tested, and a version for the Teensy 4.0 (https://easyeda.com/recursinging/kxmx_kaugummi_4.0), which I've not yet built. I decided on a form factor which extends beyond the Teensy lengthwise (hence the chewing gum):

18621

This allows the breakout to fit in a breadboard, and if the Teensy is mounted using stackable headers, access to all of the side Teensy pins as well. Here is the Teensy 3.6 version:

18622

To test the outputs, I configured eight sine objects (https://www.pjrc.com/teensy/gui/?info=AudioSynthWaveformSine) to output at 1kHz to all eight TDM channels using the Audio Library GUI tool. I measured all 8 differential outputs and got the expected result, as documented in the datasheet.

18623

To test the inputs, I simply routed the TDM input directly to the TDM outputs (1-6) using the Audio Library GUI tool, I then used my function generator to produce a differential sine wave at 1kHz, biased to 2.43V (the value I measured at pin VQ) and applied it to the inputs.

18625

I then attached my scope to the corresponding outputs...

18624

...and verified the sine wave was indeed being passed through from input to output.

18626

A quick spectral analysis of the passed-through signal shows a reasonable noise floor and no noticeable distortion (@10kHz).

18627

The projects for the (Teensy 3.5/6 (https://easyeda.com/recursinging/kxmx_kaugummi_3.5-6)) and (Teensy 4.0 (https://easyeda.com/recursinging/kxmx_kaugummi_4.0)) are open source and available under the CC-BY-NC-SA 3.0 to make yourself and modify if you feel so inclined. I made an effort to select well stocked parts from LCSC, so it should be possible to have the boards made by JLCPCB and order the BOM from LCSC for under 20$ shipped (excluding the Teensy and the codec of course). Hope someone can make use of this!

wcalvert
01-28-2020, 03:25 PM
Would you be able to comment on the usability with DC-ish signals, let's say under 5Hz? Looking closer at the datasheet, I see there is a high pass filter on the ADCs which can be disabled, but it doesn't look like the output filters can be disabled.

recursinging
01-29-2020, 06:30 PM
Signals 5Hz and under are definitely attenuated on the ADC side. I haven't found the time to extend the API of the control_cs42448 object in the audio library to manipulate those additional registers, which will be necessary to disable the ADC high pass filters.

I didn't see any particular mention of high pass filters on the DAC side in the data sheet, how did you come to that conclusion?

So far, I've only tested low frequency/DC signals from input to output, ie. ADC in, through the Audio library, and DAC out. It's hard to say from that test whether the attenuation I saw comes from the ADC high pass filters, DAC high pass filters, or both. If I get a chance, I could try and output a synthesized low frequency or DC signal to see if the DACs attenuate it at all. I'll update here when I get a chance to sit down and test that.

wcalvert
01-29-2020, 06:56 PM
On page 17 of the datasheet (https://www.mouser.com/datasheet/2/76/CS42448_F5-1141475.pdf) it mentions "Frequency Response 10 Hz to 20 kHz" and gives some attenuation values, which made me think the onboard DAC output filters are high pass filters with the cutoff frequency set less than 10Hz. Admittedly, that is a guess... because I didn't see the datasheet say it explicitly.

Anyway, I would be interested to see any additional data that you collect about the DAC's capability with DC.

pfzzz
01-30-2020, 02:24 PM
can this be like a homemade expert sleepers audio interface ?

wcalvert
01-30-2020, 02:26 PM
Not without significant upgrades to the Teensy Audio library. It can only handle stereo, not multichannel.

recursinging
02-07-2020, 09:20 AM
Just a quick update, I checked for the presence of high pass filters on the output of the codec, there are none. I was able to synthesize low frequency to DC signals and output them without a problem. I also disabled the ADCs high pass filters and was able to pass DC signals through the Audio library without a problem.

Green trace = input
Yellow trace = output

18979

I also disabled the "single ended mode" registers for two reasons:

1.) Single ended mode applies a 6dB digital gain.
2.) Things get wonky if input voltage approaches full scale. According to the datasheet: "For single-ended inputs, the analog input level must remain at or below full scale to avoid wraparound of the resulting ADC codes." which explains this.

Disabling the high pass filters and the single ended inputs caused the codec to behave according to the data sheet with DC signals. I wasn't able to test how much DC error is present, that task is for another day.

wcalvert
02-07-2020, 02:41 PM
That is really promising, thank you for taking the time to share the data. Great job.

lucian_dusk
02-09-2020, 09:53 AM
fantastic work and thanks for sharing.
do you mind outlining how you disabled the HP filters in control_cs42448?
also - did the DC signals pass with single-ended inputs below the full-scale input levels? were the problems specifically as they approached maximum levels, and is that something that could be optimized with a lower-gain input amplifier?
i'm planning a six-input board for modular levels and it seems like a shame to double the parts count on the inputs to generate differential signals : (
following your project and curious how the T4.0 works! thanks!

lucian_dusk
02-09-2020, 09:58 AM
also - has it been alright to use the inverted VQ as a bias for inputs? e.g. have you noticed problems with this as of yet?

recursinging
02-10-2020, 08:47 AM
You can disable the high pass filters by altering the default config struct at register 0x05 (https://github.com/PaulStoffregen/Audio/blob/master/control_cs42448.cpp#L89) to be 0xDC instead of 0x1C. Setting it to 0xC0 disables the single ended flags as well.

This is just a temporary workaround of course, as manipulating these registers should be exposed as methods.

I did not attempt to pass DC signals in single ended mode with a single ended input. I assume this would possible by driving the negative leg of the differential input to the common mode.

When in single ended mode, the ADC overflow occurs a bit below full scale, perhaps 6dB below (which would be weird...). When accurately measured, it should definitely be possible to scale the gain of an input stage to accommodate. on the other hand, the overflow itself works like a digital wave folder. which might be desirable depending on how it actually sounds.

I assume you mention inverted VQ in reference to the input stage I posted in another thread. In simulation this seemed to work, I did not test it, so, caveat emptor. I'm also working on a 6x8 Eurorack module (in 4hp with the coming Teensy 4.1 if possible), but after experimenting with the codec I decided to interface with it in differential mode because it behaves more predictably. I've got a low part count input and output stage simulated. I'm no EE but it seems to behave well under the ideal conditions of a simulation (I've not yet breadboarded them). Here is what I have so far:

19013

This circuit scales 20VPP to the codec full scale input, and the full scale output back to 20VPP. The input stage will require either a buffered VQ, or VA/2 for the bias. The part count is about as low as I could get it per channel in differential mode. The input stage has a single pole filter which should cover what the datasheet recommends, The output has a two pole filter. Here is a plot of the cutoff/slope:

19014

This circuit is not optimal as it contains no protection from overdriven signals, ESD, or other transients, but I'm willing to risk it to keep the cost/complexity down.

I don't have high hopes that the codec will handle DC signals very accurately, it is an audio codec after all. I wouldn't expect V/Oct tracking without multi-point calibration. That being said, there are a myriad of DC/LF use cases that don't require V/Oct accuracy, and the DSP capabilities of the 1062 are better than almost anything else Eurorack at the moment.