The definitive MIDI controller | This is not rocket science

Codec woes

Note to self: read datasheets carefully. I managed to mix up the codec clock multipliers, and ended up running the codecs at twice the rated speed. Weird effects ensued. Oops.

Here’s a picture of the sample clock (yellow) and frame clock (blue) generated by the CS4271 if you pass it an MCLK twice as fast as the maximum it can handle. The signal bandwidth is limited by the scope probes, but what’s that tick there…?
Too fast clock on CS4271

So, Huhta noticed first that the clock was too fast, and after reading the codec datasheet once more very, very, very carefully, it was obvious that the only way to go was to reconfigure the clock rate multiplier of the master codec via its serial control port. In stand-alone mode it simply couldn’t handle the 24.576 MHz clock I was feeding it. The slave needed no extra reconfiguration, it could pick up the new SCLK and synchronize itself with that. So then I only needed a serial port…

Serial port wired up on the bottom

I was in a hurry (and lazy as always) when originally routing the board, and since I thought the codecs would run in stand-alone mode, I didn’t bother routing the control port pins. And now I would need them. But I was lucky after all, as there was still a nice place on the board where I could solder the necessary wires to the codec, replacing the resistors that would configure it in stand-alone mode. The problem with that was that the pads in question were on the bottom side of the board, and the MCU, where the wires would go, was on the top… There was nothing I could use for passing through the board but connectors for other peripherals… Except for the ISP port of the microcontroller! So there we go.

After a bit of hacking… Saw wave!

Below the FFT of a trivial saw at 10 kHz; for some reason the waveform turns into mush (due to high frequency noise and codec’s lowpass filters perhaps?), but the spectrum analysis still has a nice quiet spot above 48 kHz. The aliased components of the waveform are clearly visible. The sample rate of the signal is 96 kHz. There’s still hope!


Big thanks to Zephod for borrowing the oscilloscope and Huhta for pointing out the root cause of all this!

Leave a Reply

Your email address will not be published. Required fields are marked *