Connect Raspberry Pi to ADAU1701 via I2S bus
Hi,
I would like to connect the Raspberry Pi B+ or the Raspberry Pi 2 to the ADAU1701 via I2S bus. Searching on the web, I found some "guides" about this, but up to now I am not able to reproduce none of them. In particular, here https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=8496&start=400 there is the official thread about using I2S bus on Raspberry Pi. In few words, since the Raspberry Pi is not able to produce a master clock signal while ADAU1701 can do it, the only possible solution is to configure I2S as controller. Hence, in this way the ADAU creates its master clock MCLK and the LRCLK and BCLK for the Raspberry Pi and those clocks for itself. Frame Sync Freq is 48kHz (ADAU MCLK/1024) and BCLK is 3,072MHz (ADAU MCLK/16).
Pin out GPIO RPi
SDATA - pin 40 -> DATA OUT
LRCLK - pin 35 -> LRCLK IN/OUT
SCLK - pin 12 -> BCLK IN/OUT
GND - pin 39
MCLK - RPi does not provide Master Clock MCLK
In the thread they said that used the Sabre ESS901 driver and they changed the SND_SOC_DAIFMT_CBS_CFS to SND_SOC_DAIFMT_CBM_CFM, compiled kernel with modules and changed some parameter in the /etc/modules and /etc/asound.conf.
The current kernel directly supports the ADAU1701 with a driver https://github.com/raspberrypi/linux/blob/rpi-4.1.y_rebase/sound/soc/codecs/adau1701.c and the corresponding module is directly available with the kernel since SND_SOC_ADAU1701 is defined in kernel configuration and it is possible to obtain the kernel and the module via rpi-update without the need to compile kernel
I have the EVAL‐ADUSB2EBZ board that I use to program the EEPROM of a custom board with ADAU1701. The custom board works perfectly in the stand alone configuration.
What am I missing in order to obtain a working I2S interface between the Raspberry Pi and the ADAU1701? It seems that all should be ok, maybe the only thing that does not work is the driver of ADAU1701.
Please, do you have any suggestion or solution?
P.S. I already read this thread https://ez.analog.com/thread/49498
Hello Salvatore,
I don't understand when you say to configure I2S as controller. I2S is a communication standard not a device.
So you can configure the ADAU1701 to be the master for the I2S clocks. You do need to have a source for MCLK for the system.
So you are planning on using I2S which is a stereo format correct? Not multiple channel TDM?
The frequencies you mentioned for FS and BCLK are correct but you should use an MCLK that is 256xfs not 1024xFS, that would be too high of a frequency. So you need a 12.288MHz master clock source.
Then the ADAU1701 needs to be configured to send and receive data on the serial port. Will the data be only coming out of the DSP, into the DSP or both?
A schematic diagram would be helpful and list of the register settings you are planning to use for the DSP.
Thanks,
Dave T
Hi Dave,
you are right, the I2S is a bus and not a device. I did not explain well myself. I would like to say that the ADAU1701 have to be configured as controller as reported in the picture of the previous post. This is the only way since the Raspberry Pi 1 and 2 do not have MCLK. Hence, the source of MCLK is the oscillator in the ADAU1701 board that drives both the ADAU1701 and the Raspberry Pi.
Yes, at the moment I'm planning to use ADAU1701 only in stereo format not TDM.
Yes, you are right again since Frame Sync Freq is 48 kHz (ADAU MCLK/256), BCLK is 3.072 MHz (ADAU MCLK/4) and MCLK is 12.288 MHz: this is the first wrong information that I found in the post. Where have I to set these values? In which configuration files?
Yes, the data will come from Raspberry Pi into ADAU1701 via I2S bus and then from ADAU1701 toward the speakers via DAC.
You can find the schematic diagram attached to the previous post. Moreover, the pin out connection for the Raspberry Pi is the following: SDATA - pin 40 -> DATA OUT LRCLK - pin 35 -> LRCLK IN/OUT
SCLK - pin 12 -> BCLK IN/OUT
GND - pin 39
MCLK - RPi does not provide Master Clock MCLK
and the pin out connection for the ADAU1701 is: SDATA - pin 7 -> DATA IN
LRCLK - pin 10 -> LRCLK OUT
LRCLK - pin 4 -> LRCLK IN
SCLK - pin 11 -> BCLK OUT
SCLK - pin 5 -> BCLK IN
GND - pin 21
MCLK - pin 19 -> MCLK IN
Finally, the pin connection between RPi and ADAU1701 is:
SDATA - pin 40 -> DATA OUT => pin 7 -> DATA IN
LRCLK - pin 35 -> LRCLK OUT => pin 10 -> LRCLK OUT => pin 4 -> LRCLK IN
SCLK - pin 12 -> BCLK OUT => pin 11 -> BCLK OUT => pin 5 -> BCLK IN
GND - pin 39 -> GND => pin 21
Thank you
This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.
Thank you,
EZ Admin
Please log in to reply.