I2S soundcard overlay

Hi all,

Im trying to get this i2s card to work with the rock pi E.

https://www.audiophonics.fr/en/devices-hifi-audio-adc/adc-analog-to-digital-converter-wm8782-i2s-24bit-192khz-p-13351.html

The i2s card is the master in my setup.

I’m running Debian.

Can anybody point me in the right direction as to how the overlay needs to look like ?
Thanks !

Hi,dfull89

Which image do you use, and what is the specific kernel version.

use

2021.01.26

rockpie_debian_buster_server_arm64_20210126_0056-gpt.img

  • Kernel version: 4.4.194-17-rockchip-g07288d4ebac7
  • U-Boot version: 2019.10-11661-g46695f4700

You can try this overlay

/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3328";

	fragment@0 {
		target-path = "/";
		__overlay__ {
			sound {
				compatible = "simple-audio-card";
				simple-audio-card,format = "i2s";
				simple-audio-card,mclk-fs = <256>;
				simple-audio-card,name = "rockchip-rk3328";
				simple-audio-card,bitclock-master = <&sound_master>;
				simple-audio-card,frame-master = <&sound_master>;

				simple-audio-card,cpu {
					sound-dai = <&i2s1>;
				};
				sound_master:simple-audio-card,codec {
					sound-dai = <&codec>;
				};

			};
		};
	};

	fragment@1 {
		target = <&i2s1>;
		__overlay__ {
			pinctrl-names = "default";
			pinctrl-0 = <&i2s1_mclk
						 &i2s1_sclk
						 &i2s1_lrcktx
						 &i2s1_lrckrx
						 &i2s1_sdi>;
		};
	};

	
};

is this for vendor kernel or armbian kernel?

1.Write the content of the message to the rk3328-simple-audio-card.dts file
2.Convert dts to dtbo
3.Add rk3328-simple-audio-card to the /boot/uEnv.txt file
4.reboot

i2s didn’t work, and the original 3.5 output became unavailable

1 Like

Can you post your dts source file and dmesg records?

dmesg.log & rk3328-simple-audio-card.dts

I2S1 is connected to ACODEC, so may not be able to make it work in two places at the same time

ALSA device list:
570 [ 2.684313] #0: rockchip-rk3328
571 [ 2.684316] #1: rockchip,hdmi

I saw the sound card in the log, so you can try the arecord command and specify the correct audio format for recording. Make sure

LRCK->I2S1_LRCK_RX
BCLK ->I2S1_SCLK

is connected correctly and the clock is present.

1.Excuse me, do you mean that I2S is set to two places?
How to modify the settings in the official IMG?
2.For the COLCK part, if I set ROCK PI E as MASTER, then LRCK and BCLK should be sent by ROCK PI E. Do I need to do any additional connections? For example, do I need to provide the frequency of MCLK externally?
3. speaker-test -D "hw:0,0" -c2
is error,

speaker-test 1.1.8
Playback device is hw:0,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 131072
Period size range from 64 to 65536
Using max buffer size 131072
Periods = 4
was set period_size = 32768
was set buffer_size = 131072
0 - Front Left
1 - Front Right
Write error: -5,Input/output error
xrun_recovery failed: -5,Input/output error
Transfer failed: Input/output error

  1. What I mean is that i2s1 is internally connected to the acodec, and then the acodec is output to the earphones, so if you use the overlay provided above, your earphones will not work.
  2. If you use ROCK PI E as the master, the above overlay needs to be modified. As long as your audio module is working normally, MCLK is not necessary. Connecting the two together may cause noise problems due to the slight difference in the clock.
  3. The overlay configured above uses the rock pie as a slave, and your audio module needs to provide BCLK and LRCK, taking 48KHZ input as an example. Try it with

arecord -D hw:0,0 -r 48000 -c 2 -f S32_LE -t wav test.wav
hw:0,0 means card 0 device 0

Excuse me, can you provide the i2s of rock pie as the master configuration file?

this overlay is working fine on Armbian

This topic is killing me. I have already spent 2 days trying to making it work, with absolute no luck.

My intention is to use the rk3308 as an i2s master connected to the pcm1809 ADC. This adc doesn’t require mlck as far as I know, and it doesn’t use any i2c. It’s a pretty simple ADC. (I managed to have it working in the past with raspberry pi 4, 3 and maybe even radxa zero 3w.

I was expecting that the Rock Pi audio features will make it work out of the box, but that’s not the case.

I have tried so many different things but nothing works.

I am using the latest Radxa Debian.

If I understand correctly, I can only use the i2s0 for i2s because the i2s1 is connected to the lineout of the board. Also, the only i2s exposed pins are “I2S0_8CH” related.

To sum up I need i2s0 for input, as a master (the pcm1809 is the slave). I only need one channel, it’s a mono input, but if two are required, I could manage.

I have tried writing overlays with no luck. So far these are my takes:

  • In theory I could have both i2s0 and i2s1 working in parallel, right?
  • It means, enabling “ i2s_8ch_0 = “/i2s@ff300000” “, by setting it to okay
  • for safety, I disabled “ i2s_8ch_2 = “/i2s@ff320000”
  • acodec-sound handles the audio internal codec, so probably I shouldn’t touch it. od maybe disable it?
  • “sound“ node is what actually connects the DAI with the codec.

But still no luck. I will appreciate if someone can give me some clue