Setting up I2S sound output

A project log for Onion Omega Hi-Fi Dock

I'm building Onion Omega dock that should deliver Hi-Fi audio via PCM5102 I2S DAC

andrey.malyshenkoandrey.malyshenko 07/09/2020 at 22:160 Comments

I pretty much followed the official tutorial

Only pitfall is that you need to use firmware build before b195. I used b193 to be more specific. Full list of old builds can be found here, and instruction on how to flash custom firmware is here.

Issue with later versions is that at some point I2S was disabled in favor of PWM working on the same pins. 

As soon as you have proper firmware installed you need to issue following commands

# install necessary packages
opkg update
opkg install alsa-utils mpg123
# enable I2S
omega2-ctrl gpiomux set i2s i2s

Verify that souncard is present

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AudioI2S [Audio-I2S], device 0: ralink-i2s-HiFi HiFi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 Presense of this device doesn't imply that souncard is working, it will bang I2S pins even if they hang in the air. But to have the sound device listed is a good sign.

Next you test audio with any audio file or stream, I used my local stream here

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
	version 1.22.3; written and copyright by Michael Hipp and others
	free software (LGPL) without any warranty but with best wishes

Playing MPEG stream 1 of 1: fg ...
ICY-NAME: Fabio & Grooverider

MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo

ICY-META: StreamTitle='ÿþR - ÿþF';

Voila, we have a sound!


- I want to build  latest firmware version with I2S support enabled

- I found board hanging on wifi initialisation. I soldered 100uF cap to power pins directly and the issue went away. Now i need to  adjust PCB design to have decoupling caps closer to Onion board.

- Today found an article on separating digital and analog grounds, need to try that as well:)