I2S Microphone on Radxa Zero 3W

Hi everyone,

I’m building an IoT device that requires camera & microphone using the Radxa Zero 3W. Here the additional hardware components:

  • Camera: Raspberry Pi Camera V2 via CSI interface
  • Microphone: INMP441 MEMS via GPIO pins

The camera works fine after following the official guide and enabling the overlay.

However I’m having trouble with the microphone. I’m pretty new to audio stuff so please highlight any stupid stuff I’m doing or writing here :grin:.

Here is how I connected the INMP441 microphone to the Radxa using the official pinout documentation as reference:

.

The microphone did not show up in the Input devices nor was I able to record audio with the arecord command.

Then I tried looking for I2S overlays via rsetup, but didn’t find anything. I tried looking at the device-tree using:
dtc -I fs /sys/firmware/devicetree/base | grep i2s

According to the output i2s@fe40000 has status='okay' but i2s@fe410000, i2s@fe420000 and i2s@f430000 are all disabled. Do I need to enable them somehow? Any other suggestions?

Additional information:

  • OS: Debian Bullseye B6
  • Kernel release: 5.10.160-26-rk356x
  • aplay --list-devices
    **** List of PLAYBACK Hardware Devices ****
    card 0: rockchiphdmi0 [rockchip-hdmi0], device 0: fe400000.i2s-i2s-hifi i2s-hifi-0 [ fe400000.i2s-i2s-hifi i2s-hifi-0]
    Subdevices: 0/1
    Subdevice #0: subdevice #0

Any help is appreciated! Thank you,

Yannick

From look of it that is the I2s for the hdmi and in use (rockchiphdmi0).
The gpio i2s are listed here https://docs.radxa.com/en/zero/zero3/hardware-design/hardware-interface

I’m having a similar issue as the OP. Device doesn’t show up at all. The pinout that the OP listed are the correct pins according to the link you posted.

Any thoughts?:thinking:

Yeah I2S1,2,3 have gpio but likely all he has enabled is the hdmi I2S0 dts

I’ve managed to get i2s3 working both ways on Radxa Zero 3E running Armbian 24.5.1 (6.1.43-vendor-rk35xx) with this overlay:

radxa-zero3-i2s3-experiments.dts
/dts-v1/; 
/plugin/;

/ {
	compatible = "rockchip,rk3568";

	fragment@0 {
		target = <&i2s3_2ch>;
		__overlay__ {
			rockchip,clk-trcm = <1>;
			pinctrl-names = "default";
			pinctrl-0 = <&i2s3m0_sclk
				     &i2s3m0_lrck
				     &i2s3m0_sdi
				     &i2s3m0_sdo>;
			status = "okay";
		};
	};

	fragment@1 {
		target-path = "/";
		__overlay__ {
			sound {
				status = "okay";
				compatible = "simple-audio-card";
				simple-audio-card,name = "test";
				simple-audio-card,format="i2s";

				simple-audio-card,bitclock-master = <&cpu_dai>;
				simple-audio-card,frame-master = <&cpu_dai>;
				simple-audio-card,mclk-fs = <256>;

				cpu_dai: simple-audio-card,cpu {
					sound-dai = <&i2s3_2ch>;
				};

				codec_dai: simple-audio-card,codec {
					sound-dai = <&i2s3_out>;
				};

			};

			i2s3_out: i2s3-out {
				#sound-dai-cells = <0>;
				compatible = "rockchip,dummy-codec";
				status = "okay";
			};
		};
	};
};

It enables i2s3-m0 and creates a sound card which uses it.
Do sudo armbian-add-overlay radxa-zero3-i2s3-experiments.dts and reboot and the sound card should appear and work. At least my UDA1334A and INMP441 work.

It is my first overlay and my first message here so hi everyone:)

1 Like

Hi, how did you wired uda1334A?

Hello! I guess it was like this (can’t check, it works in a remote house):
(Radxa -> UDA1334A)
I2S3_LRCK_M0 (pin 35) -> WSEL (WS, pin 2 of the ic)
I2S3_SCLK_M0 (pin 12) -> BCLK (BCK, pin 1)
I2S3_SDO_M0 (pin 40) -> DIN (DATAI, pin 3)
Did not use master clock (SCLK) or any other digital inputs of UDA1334A.
To be clear, I used an Adafruit-like devboard from Aliexpress.

I connected my INMP 441 according to the scheme above. Added the dts file. How can I tell if the microphone is working? The recording is going on, but the wav file is silent.

rock@radxa-zero3:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: rockchiphdmi0 [rockchip-hdmi0], device 0: fe400000.i2s-i2s-hifi i2s-hifi-0 [fe400000.i2s-i2s-hifi i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: test [test], device 0: fe430000.i2s-dummy_codec i2s3-out-0 [fe430000.i2s-dummy_codec i2s3-out-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

It is pretty quiet (I’d prefer to call it good dynamic range:)), try to make loud sounds right into the mic or normalize the recorded file in an audio editor to check if it actually records someting. I have to boost levels to +20…24dB in post to hear quiet sounds.

Also, arecord makes weird audio files for PC playback if using 24-bit samples (seems it aligns samples to 24-bit, [1 byte, 2 byte, 3 byte], [1 byte…] and PC wants 32-bit aligning, like [0x00 byte, 1 byte, 2 byte, 3 byte], [0x00 byte…]), 16-bit works great. I got good 16-bit 16000Hz and 44100Hz records at least.

I still get an empty wav file. Even when I hit the table with the microphone. I connected an oscilloscope and sometimes I see a signal on the SCK pin when I turn on recording. The other pins are silent. I think there is something wrong with the dtbo file.
after installing the dbto file, I have this list of overlays
image