Connecting a Raspberry Pi and an ADAU1701 DSP

It looks like a simple task – connect the Raspberry Pi with an external ADAU1701 DSP chip. Both features an I2S interface – just connect it. However, it is not that easy. The ADAU1701 can only work as a slave device on the I2S input. Why not just using the Raspberry Pi as the master? This also won’t work, because the Raspberry Pi can create the BCLK and LRCLK signal, but not a 256xFs master clock signal that is needed by the ADAU1701. Using a local master clock on the ADAU1701 and the I2S clock from the Raspberry Pi will also not work, because both clocks have to be synchronous. Looks like a bit more complexity is needed.

We use the following setup: An external frequency generator creates the 12.288 MHz master clock and a synchronous 3.072 MHz BCLK signal. This BCLK signal will be the master clock for the I2S output of the Raspberry Pi. From this clock signal, the Raspberry Pi creates the 48 kHz LRCLK signal. Why are we not creating this clock externally? Because we have only a 2 channel signal generator available in the lab. This needs some tweaking in the sound card driver.

The ingredients of this test setup are

  • Rigol DG4062 signal generator
  • Raspberry Pi
  • MiniDSP (our own DSP board is not ready yet)
  • Lab power supply

For measurements I use a Rigol DS2072 DSO and a Intronix Logicport Logic analyzer. That’s a lot of equipment to connect two simple devices:

raspberry-dsp-tests

I had serious trouble to get this setup running. The reason for this was a simple mistake: I switched BCLK and LRCLK. But during debugging I had another idea. The output of the ADAU1701 is an I2S master. That means it can be used also as the master clock for the input. With this setup – output BCLK and LRCLK connected to input BCLK and LRCLK, there is no need for an external clock source. The ADAU1701 can create all the necessary clocks with the onboard resonator. This will simplify our DSP project a lot.

Finally when everything worked, it looked like this on the oscilloscope: a nice analog output from the ADAU1701.
adau1701-out

13 thoughts on “Connecting a Raspberry Pi and an ADAU1701 DSP

  1. pasdesignal

    Love it! Keep up the great work. Nice clear photos too. We should get working together and help solve the same problems. Maybe do a version of my audio board with this chip or similar…
    Shannon.

    Reply
  2. Tue Sørensen Dissing

    Sounds great!
    So you ended up with not having to generate any clock signal?

    I am new to all this, but from what I can read on the miniDSP spec’s it should be able to operate “in master mode” and you should be able to rely on the crystal on that board.
    Is that what you ended up doing?

    My goal is to build the following, but I have close to no experiance with digital boards or DSP’s for that matter:
    Rapsberry Pi -> miniDSP (via I2S) -> miniDIGI (via I2S)

    Reply
    1. matuschd Post author

      Hi Tue, basically this is what I ended up with. However on the MiniDSP you have to connect the clocks from the output and the clocks from the input. Using the MiniDSP in that way works, however it is a bit complicated. If you want to use a DSP with the Raspberry have a look at our HiFiBerry DSP project. It is still in development, but there will be a prototype in the near future.

      Reply
  3. Tue Sørensen Dissing

    Thanks for the reply! (not scared away yet :-)

    The HifiBerry seems like a cool project. The easier Raspberry support the better :-)
    Will it handle 24bit/96kHz or just 48kHz as the miniDSP? And what about sample rate conversion? Just learned that this is/can be a big concern – not sure I want to do this in software.

    One of the big reasons for wanting to utilize the miniDSP are the fact that it plays (nicely?) together with REW – http://www.hometheatershack.com/roomeq/ – and makes is farely easy to create and load room correction filters based on actual measurements.

    Tue

    Reply
  4. matuschd Post author

    Hi Tue,

    the HiFiBerry DSP light will not do any sample rate conversions. You can run it at 48kHz or 96kHz or even 192kHz. However, that higher the sample rate the less computing you can do. Getting the filters configured by REW should not be a big problem. It is a simply a file conversion issue. REW simply create biquad filters, that will be written to the DSP. Note that with 96kHz you can run only half as much filters as with 48kHz.
    There is also a project for a larger DSP that can do sample rate conversions. But lets do step after step and start with the small one first ;-)
    The cool thing about my DSP project is, that the software is open source. That means you can import filters from whatever format you like. I will provide a Python framework where everybody can plug in his own code.

    Daniel

    Reply
  5. Tue Sørensen Dissing

    Yes open source software rocks!

    Sounds pretty much dead on what I’m looking for, assuming that I can utilize my own DAC (via I2S as there’s no SP/DIF out).

    And regards to the sample rate it should not be a big deal, as most source material is in 44,1kHz anyway.
    So when are the HifiBerry shipping ;-)

    Reply
  6. matuschd Post author

    Hi Tue,

    the first prototype will not have an I2S output, but we might incorporate it in later version. I’m still looking for people helping in the prototyping testing and/or software development. The HiFiBerry DSP light (2 inputs, 4 outputs) might be available in the first quarter of next year.

    Regards
    Daniel

    Reply
  7. Remco

    Hey,

    I’d be more than happy to help. In fact, I am thinking of designing a RPi – DSP – mch DAC board myself but reading your website I can’t help but feel you are already 3/4 there :)

    Do get in touch if you would like my cooperation. I can do HW / SW / DSP and am not far away from you, in fact I come across Switzerland quite often :)

    Reply
  8. Thomas (Marathoni)

    Hello, great article, and exactly what could help me to improve my actual solution using xbmc on windows and feed the audio data analog into my DSP. I was looking to drive minidsp input digitally / I2S to improve the noise floor. Can you publish the connection diagram using the raspberry PI and Minidsp realizing the I2S Input connection ? Many thanks, Thomas

    Reply
  9. Richard12011

    Great news, I want to connect my raspberry over I2S to minisdsp but struggle the same issues. Would be great if you can publish schematics of above test. I understand the need of clocksignals to the input of the ADAU1701, but do not understand how to connect the output of the Raspberry to the ADAU1701. How will the data be synchronysed?

    Reply
  10. Richard

    Thx for this article. I want to connect my RaspB to the minidsp over I2S. Can you provide wiring diagram how you did connect your set up? Would be very helpful because I’m not sure how to wire RaspB to miniDsp. Is it ok to wire only the Data and ground to miniDSP when the Mclck and LRclck are wired from the output to input miniDsp?

    Reply
  11. jh

    Hello

    Which Linux did you run on the raspberry pi and how did you configure the bclk and lrclk?
    Where did you configure this signals as slave or master?
    thanks for answer.
    best regards
    jh

    Reply
    1. Fabian

      I would also like to know how to conigure this exactly. From my understanding Only data and ground have to be connected from rpi to miniDSP. But which software/cofiguration do I have to use on rpi?

      Reply

Leave a Reply