Close

It's alive pt.2 : for real!

A project log for HiFi audio codec module

A very small HiFi audio CODEC module

michele-perlaMichele Perla 12/25/2015 at 23:190 Comments

Hey there,

I had the time (thank you, Christmas holidays) to check thoroughly the issues I had in my previous update.

Let's start with the software issues:

I could not understand why the codec would not output anything even if I double checked the registers' configuration parameters until I put a function that reads their values AFTER I performed my I2C write operations: everything would read as 0 (zero). That was the moment when I grabbed my logic anaylizer and attached it to the I2C bus and found out the truth: I performed an out-of-bounds write when trying to write the Power Management register, meaning that every other operation performed on the bus after that one would not go well. In particular, when I was trying to write that register I put the CODEC I2C address instead of the Power Management register in the function (which is out of bounds).

Solved that, I noticed that my reads were off, that's because the CODEC keeps a counter of the last accessed register and would therefore return data from the last used address+1 and then wrap around to address 0; to fix that I just put a dummy write to the last register before reading the configuration.

This in turn lead to the discovery of another silly issue: I overwritten the Power Management register with the Mode Control register, therefore I was not turning on the power for the DAC and ADC. Damn copy+paste!


As soon as I fixed these, I got signals on the scope, but they were off....

Let's pass onto the hardware issues:

I ran the SineOutTest example you can find on Github to check if I got two sinewaves on the outputs, and they were there indeed! Only thing is that the left channel one was very low (like in "50 mV p-p VS 2.5 V p-p" low). I thought I misplaced the two resistors on the output; to check that I run a SPICE simulation of the output circuit w/ the inverted resistors and I had the same readings. I turned on the soldering station, grabbed some tweezers, and took them off the board, then I soldered them but it was still off... eventually I broke one of the SMD resistors and I therefore proceeded in hacking in a standard through-hole resistor from the output DC-blocking cap to the ROUT pin. The signals are now fine.

I also had shorted the input pins, but some solder wick solved that easily.

All in all, it now works as intented, here's the proof

This video shows the board running the SineOut test while attached to the scope......while this one shows the board running the sine test connected to a speaker, and then running the passthrough test, passing the signal received from my PC's line output (through a USB Audio interface) to a speaker.

I had a great time doing this, I actually always wanted to brew my very own HiFi Audio CODEC Module, and this was the perfect excuse to do so! I can't wait to do more and more stuff with this!

In fact, the reason why I put AVDD/AGND signals on the analog in/out connector is because I could piggyback expansion boards, here's a couple ideas:

Thanks @alpha_ninja for setting the #The Square Inch Project up, it was really fun to participate in this contest and it was really stimulating! You made me productive as hell.

Cheers,

Mick

Discussions