nano Pi Neo DAC with I2S connection

Hi,
with nano Pi Neo
DAC with I2S connection
I want to use it with DietPi’s Squeezelite.
How can I turn on I2S?

did you tried to activate I2C

dietpi-config > 4 : Advanced Options > I2C state

Hi,

“I2C status” is not displayed in the “Advanced options” item

MichaIng
can you have a look pls. I don’t have that much experiance with nano Pi Neo

I’m sorry, what is “pls”?

I ask the developer to have a look. No action on your side.

pls = abbreviation for please

OK, thank you

Edit /boot/armbianEnv.txt and add i2c0 to the line starting with overlays=. i2c1 and i2c2 are generally also available for that SoC, but not sure about pros/cons aside of different default GPIO pins they use.

More info and options for available device tree overlays can be found in:

/boot/dtb/overlay/README.sun8i-h3-overlays

Thank you MichaIng.
I want to run “NanoHat PCM5102A”, so isn’t it I2S instead of I2C?

https://wiki.friendlyarm.com/wiki/index.php/NanoHat_PCM5102A

Does DietPI not support I2S? :cry:

Ah sorry, of course I2S. We had a similar question with Odroid C2 and their HiFi Shield I2S DACs. To be true, I’m not sure whether I2S works OOTB with the Armbian kernels.

Okay, searched through the forum, and indeed I2S needs to be enabled and setup for the HAT via device tree overlay first. Just in case if something fails, you have a change to access the drive externally and edit /boot/armbianEnv.txt, right?

Also please verify first that the following exists:

ls -l /proc/device-tree/soc/i2s@1c22000

If so, try the following, at best copy and paste the whole code block into your PuTTY SSH console via right mouse click:

mkdir -p /boot/overlay-user
dtc -I dts -O dtb -o /boot/overlay-user/pcm5102a.dtbo <<< '/dts-v1/;
/plugin/;
/ {
	compatible = "allwinner,sun8i-h3";
	fragment@0 {
		target-path = "/soc/i2s@1c22000";
		__overlay__ {
			status = "okay";
		};
	};
	fragment@1 { 
		target-path = "/"; 
		__overlay__ { 
			pcm5102a: pcm5102a {
				#sound-dai-cells = <0>;
				compatible = "ti,pcm5102a";
				pcm510x,format = "i2s";
			};
		};
 	};
	fragment@2 {
		target = <&i2s0>;
		__overlay__ {
			status = "okay";
			pinctrl-0 = <&i2s0_pins>;
			sound-dai = <&pcm5102a>;
			pinctrl-names = "default";
		};
	};
	fragment@3 {
		target-path = "/";
		__overlay__ {
			sound_i2s {
				compatible = "simple-audio-card";
				simple-audio-card,name = "I2S-master";
				simple-audio-card,mclk-fs = <256>;
				simple-audio-card,format = "i2s";
				status = "okay";
				simple-audio-card,cpu {
					sound-dai = <&i2s0>;
				};
				simple-audio-card,codec {
					sound-dai = <&pcm5102a>;
				};
			};
		};
	};
};'
G_CONFIG_INJECT 'user_overlays=' 'user_overlays=pcm5102a' /boot/armbianEnv.txt

Then reboot and show the output of aplay -l.

Thank you, MichaelIng

I’m trying it now, but I’m getting an error and it’s not progressing.

-bash: dtc: command not found

there is no need to do screen prints. You should be fine to copy the output from SSH terminal directly

You are missing dtc command, which is part of device-tree-compiler package. Try following and run the script again.

apt install device-tree-compiler

Ah, good to know that its not a dependency of something else, like on RPi. So when implementing this as feature we need to install it, or pre-install on images with device tree overlay support :thinking:.

I got an error when I ran the script.

Ah sorry, wrong path:

G_CONFIG_INJECT 'user_overlays=' 'user_overlays=pcm5102a' /boot/armbianEnv.txt

The other commands do not need to be repeated.

thank you very much!!
I confirmed the playback of 48kHz / 24bit FLAC with squeezelite. :slight_smile:
However, it seems that the high resolution sound source (96kHz) cannot be played.

pls try to copy your output directly from SSH terminal and avoid doing screen prints. Thx for understanding.

Awesome that it generally works now. I’ll forward to Armbian and add this as a fixed sound card selection for Allwinner H3 SBCs with Armbian mainline kernel.

I’ll ask about the issue with 96 kHz. It should btw work when you select the sound card + enable the auto conversion ALSA plugin via dietpi-config and use the “default” playback device with Squeezelite. ALSA then converts the audio stream automatically to a supported format when required. Not awesome when the hardware actually supports higher rates, but at least playback should then work until we found a way to fix it. It may be even an issue with the underlying kernel driver, not sure.

Could you do another check to find the symbol for the I2S path:

for i in /proc/device-tree/__symbols__/*
do
[[ $(<$i) == '/soc/i2s@1c22000' ]] && echo "$i"
done

I’m ignorant, but how do you use the script below?

for i in /proc/device-tree/__symbols__/*
do
[[ $(<$i) == '/soc/i2s@1c22000' ]] && echo "$i"
done

By the way, even if I specified the max bit rate with the -r command of squeezelite, 96kHz was not output.