ploopyco / headphones

A set of 3D-printed headphones, alongside a DAC/amp/EQ board powered by a Raspberry Pico.
833 stars 43 forks source link

Fix the LRCK signal which was reversing the channels. #14

Closed george-norton closed 1 year ago

george-norton commented 1 year ago

Fix the LRCK signal which caused reversed channels after my previous PR.

For reference, the clocking for the old data format is here: image And the new data format is here: image

The old volume code had a side effect of shifting the 16bit values to the top end of the 32bit word which is written to I2S. I was a bit surprised to see the maximum volume of 0x7FFF, which shifts the data into bits 30-15 rather than 31-16. I assumed this generated the BCK pulse before the first bit is written, but now I see that is not the case. I suspect this was just an error. As a result this fix adds a small, but useful increase in the max volume.