No sound card detected for Opi zero 2w

Anything I can test so far?

Hello Arrafart

What would you test ?

Anything necessary :grin:

Reinstalling from fresh or adding functions. Jack output. Pin connections. Happy to help. Otherwise I guess I should wait for update?

hello
Jack output and pin connections have already been described here above in the post, for the audio part everything is implemented in the dtb file which is read at startup, I have not found another solution to add audio functions with a dtbo file

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

@Totof
The topic came up again. In the meantime, the kernel is mainline Linux 6.12 with two large patches from Armbian, which add and enable (nearly) everything you added in your device tree:

The only thing that is missing is these ahub0 nodes, as the patch only adds ahub1 nodes. Are these for two different audio HATs?

The overlay you posted last seems to add and enable only these: No sound card detected for Opi zero 2w - #60 by Totof
So I guess this is now all that is needed?

With a script:

# Create the directory for user overlays
mkdir -p /boot/overlay-user
cd /boot/overlay-user
# Create the overlay source file
cat << '_EOF_' > i2s0-audio-hat.dts
/dts-v1/;
/plugin/;
/ {
	compatible = "allwinner,sun50i-h618";
	fragment@0 {
		target = <&pio>;
		__overlay__ {
			ahub_daudio0_pins_a: ahub_daudio0@0 {
				pins = "PI0", "PI1", "PI2";
				function = "i2s0";
				drive-strength = <0x14>;
				bias-disable;
			};
			ahub_daudio0_pins_b: ahub_daudio0@1 {
				pins = "PI3";
				function = "i2s0_dout0";
				drive-strength = <0x14>;
				bias-disable;
			};
			ahub_daudio0_pins_c: ahub_daudio0@2 {
				pins = "PI4";
				function = "i2s0_din0";
				drive-strength = <0x14>;
				bias-disable;
			};
			ahub_daudio0_pins_d: ahub_daudio0_sleep {
				pins = "PI0", "PI1", "PI2", "PI3", "PI4";
				function = "gpio_in";
				drive-strength = <0x14>;
				bias-disable;
			};
		};
	};
	fragment@1 {
		target-path = "/soc";
		__overlay__ {
			ahub0_plat: ahub0_plat {
				#sound-dai-cells = <0>;
				compatible = "allwinner,sunxi-snd-plat-ahub";
				apb_num = <0>; /* for dma port 3 */
				dmas = <&dma 3>, <&dma 3>;
				dma-names = "tx", "rx";
				playback_cma = <128>;
				capture_cma = <128>;
				tx_fifo_size = <128>;
				rx_fifo_size = <128>;
				pinctrl-names = "default", "sleep";
				pinctrl_used;
				pinctrl-0 = <&ahub_daudio0_pins_a>, <&ahub_daudio0_pins_b>, <&ahub_daudio0_pins_c>;
				pinctrl-1 = <&ahub_daudio0_pins_d>;
				status = "okay";
			};
			ahub0_mach: ahub0_mach {
				compatible = "allwinner,sunxi-snd-mach";
				soundcard-mach,name = "ahubi2s0";
				soundcard-mach,format = "i2s";
				status = "okay";

				soundcard-mach,cpu {
					sound-dai = <&ahub0_plat>;
				};

				soundcard-mach,codec {
				};
			};
		};
	};
};
_EOF_
# Install the device tree compiler
apt install device-tree-compiler
# Compile the overlay binary file
dtc -I dts -O dtb -o i2s0-audio-hat.dtbo -@ i2s0-audio-hat.dts
# Enable the user overlay via U-Boot environment file
G_CONFIG_INJECT 'user_overlays=' 'user_overlays=i2s0-audio-hat' /boot/dietpiEnv.txt

@Arrafar also for you to test.

However, this is for this extension board. HDMI audio via onboard mini-HDMI port I would assume works OOTB, all the nodes are present and enabled with recent kernel. @ZjemCiKolege with the default device tree that comes with the recent kernel, which audio devices show up when running aplay -l?

Aplay - l = device_list:274: no sound cards found…

Dietpi-config: USB audio DAC (any) being listed with the clean install.

Still not added the tree

In your case, this is as well such a HAT with audio jack, or onboard HDMI audio?

Can you show kernel logs:

dmesg

Hello MichaIng

Y try the new version 9.13 OOTB and just my Minidsp connected with USB appears
the sound on jack,HDMI don’t work , no sound on the Hat via i2s0 too

I try your script later and tell you

The actual screenshoot

1 Like

It seems quite difficult to use I2S in general, and the PCM5102A in particular, on the Orange Pi. I have tried many overlays but none of them worked. Currently, there is only one overlay that can be used, but it only works with kernel version 5.4.125 (I2S on pi zero 2w · Issue #8 · mamin27/H616-mangopi · GitHub). However, this kernel is quite old and lacks many essential features. For example, I can’t use FluidSynth with ALSA because of the following error:

orangepi@orangepizero2w:~$ ALSA lib seq_hw.c:466:(snd_seq_hw_open) open /dev/snd/seq failed: No such file or directory

I have also tried various distributions like DietPi, Debian, and Armbian, but none of them worked.

Btw, it shouldn’t make a difference, but I adjusted the compatibility property in the overlay above to compatible = "allwinner,sun50i-h618";, which better matches the 2W.

Everything needs to be correctly defined and configured in the device tree. Mainline Linux device tree lacks a lot of nodes, especially for such expansion boards. Armbian patches much inside, but only for I2S1 expansion board it seems, not I2S0. Hence above overlay, which configures I2S0 pins and adds the related ahub0 nodes.

Thanks for the link. The overlays posted there at the end match mine above.

Hello sangto2906

I use everyday my orangepi zero 2w (or my orangepi CM4 with i2S0 and a PCM5102 now) with custom DTB file

But the only way that succeed until now is to apply staticaly a dtbo file to my dtb file

The script don’t work

Y try later

Hi Totof
About three days ago, I replaced the sun50i-h618-orangepi-zero2w.dtb file with the one mentioned above and was able to see several sound cards, except for the PCM5102A. However, when I tried replacing it again today, the system failed to boot. I’m still using the same DTB file and the same DietPi version. Do you have any working configuration or any alternative method besides using the PCM5102A (but not USB audio)?

Oh, I missed the installation of the device tree compiler (added now):

apt install device-tree-compiler

Or is there a mistake in the overlay? Should match the one you posted above.

Hello MichaIng

I try with installing the device-tree-compiler with no more success, my OPI zero 2w boot under Dietpi 9.13.2, all update and upgrade but no sound card with the standart dtb file, except my Minidsp via USB
with my custom file everything work also i2s0

I change the dtb file for test with the line “fdtfile=allwinner/sun50i-h618-orangepi-zero2w.dtb” in the file dietpiEnv.txt
with “fdtfile=allwinner/sun50i-h618-orangepi-zero2w-essai.dtb”

A capture of my folder /boot/dtb/allwinner

Hello sangto2906

My configuration is a normal install of Dietpi for OPI zero 2w
with in the dtb directory my custom dtb file
see under , download it and remove the extension “.txt”

In the file /boot/dietpiEnv.txt i have a line at the end of the file
“fdtfile=allwinner/sun50i-h618-orangepi-zero2w-essai.dtb”

My custom file
sun50i-h618-orangepi-zero2w-essai.dtb.txt (39,6 Ko)

Did you compile the overlay with the device tree compiler, with the commands above? No sound card detected for Opi zero 2w - #67 by MichaIng

Without the device tree compiler, the second last step failed, so the overlay was not compiled.

Oh, that’s wonderful—it worked for me! Thank you so much for your help. I spent four days trying to figure it out until your assistance came along. Once again, thank you and I truly appreciate your support.

1 Like