Debugging I2S audio

Today I spent several hours looking for a hardware problem of the HiFiBerry DAC. I had a quick look at the I2S line and the power supply – everything seemed to be ok. After some hours testing I noticed, the the sound output was working with FLAC files, but not with WAV files. WTF? At least it was clear now, that I should look for a software problem, not a hardware problem.

Here is a picture of the BCLK and LRCLK lines when playing back the FLAC file:
i2s-32

And this is the playback of the WAV file:
i2s-20

Can you see the difference? In the second scope picture you can see, that the driver only creates 20 clock cycles for the left and the right channel, in the first case  there are 32. Because the DAC supports only BCLK=64xLRCLK, it does not create any output in the second example.

Therefore, when debugging I2S circuits, not only have a look if there is a signal on all lines, but also check, that the clock frequencies are correct.

2 thoughts on “Debugging I2S audio

  1. Justin Eltoft

    Hi,
    Did you have to do anything special to get bck and lrck to be about 3.3V peak to peak as I think it looks here on your scope plots? I’m testing my rpi (same rigol DS2072 actually) and I get 500mV peak to peak on lrck (and it’s at 43.48kH which seems odd? why not 44.1?)

    I’ve loaded the image from squeezeplug.de and set it up to use hifiberry dac as the output to enable this i2s, btw.

    Justin

    Reply
  2. Daniel Post author

    Nothing special to do. All GPIOs should have a full 0/3.3V swing. 43.48kHz is most likely a rounding error from the oscilloscope.

    Regards
    Daniel

    Reply

Leave a Reply