This project is continuation of Onion music server project of mine. Main motivation is improve sound quality and get rid of some Onion wierd issues that i have no skills nor time to solve. Project unique is i2s connection application for OrangePi Zero board that have no I2S soldered out by vendor. Also i see this as good example of working with cheap alternatives to raspberry boards - as you will see something that you would expect to work out of the box - will take a lot of your time in fact to make it work. As this is not finished, i don't have fancy pictures of finished project, but i need to put it down now or never.
Kidding, but for comparison i really did started with that and configured everything i would like to have from this project on '5$' raspberry zero. So here it is
What is missing on that images is external usb ethernet card and amp that was used in previous project. In fact i will reuse amp setup in every following configuration since amp part is equally compatible with onion, raspberrypi or orangepi configuration. Green relay module will be described later, but is essentially same relay module that i've used in prev project. But back to topic.
we need to configure system service, that is when pulseaudio is run with --system switch. Then it will load config from system.pa. Therefore we will edit this one
sudo nano /etc/pulse/system.pa
change this line to allow local usage for every user
we will need to enable I2S and configure card but lucky enough our card is compatible with hifiberry-dac hat, so we only need to enable appropriate DT layer.
sudo nano /boot/config.txt
Edit those lines (last one is commented - not necessary but i prefer to have only one card for simplicity)
3) last step is to configure relay module. and i will describe it in next instruction since it is exactly the same as for OrangePI. And this project is actualy for latter one, so let's leave something for it.
Next step is actually start adopting this basic setup to OrangePI Zero.
2
Step #1 - Connect I2S Sabre sound card
I started working with OrangePI Zero for the sake of price and simplicity. And immediately were struck by the fact that vendor forgot to solder I2S on the board header. In early versions this was solvable by soldering couple of resistors on the board (more details here) but in my revision this possibility was removed. Technicaly speaking the probem is that PA20/PCM0_DOUT pin is used by vendor to enable and disable WIFI module and not available for my use anymore.
This is from early version schematics, but since newer is not published i will work with this one
So what i will do - i will solder out wifi power switch completely (and lose it forever, since i don't need it, but there is also an option also to enable it permanently) and add wire to unit's solder pad.
We are looking for tsot-5 element
And we will find it near wifi chip
(sorry, forgot to make 'before' photo, so this is soldered out state). Pad #3 is where we should solder PA20 header and pad #5 we should solder to +5V to enable wifi permanenty. In my case i skip last part.
Then other connections will look like this:
So far that's it, relay module will be covered later.
Next step is configure Sound Card in Armbian.
3
Step #3 - Configure I2S sound card
Since Armbian 5.30 it switched to device tree to setup device perepherials. Along with this change somehow a lot of features lost their support, therefore it is not as straightforward to enable I2S.
I prepeared github repo to do it quickly
So first get it from github
git clone https://github.com/anabolyc/pcm5102a-for-armbian-orangepi-zero
cd pcm5102a-for-armbian-orangepi-zero
We need to add user overlays to enable I2S (disabled by default) and enable sound card on that port
sudo armbian-add-overlay i2s-sound.dts
this will compile overlay script, put compiled file under /boot/overlay-user and add to /boot/armbianEnv.txt line
user_overlays=i2s-sound
You need to reboot to changes to take effect, but this will not work just yet. Problem is we are referencing to pcm5102a kernel module there, and this one is not included to armbian for some reason. Therefore we will build it on the same board using current kernel sources. So please check if you have build symlink
$ ls -al /lib/modules/$(uname -r)/build
lrwxrwxrwx 1 root root 36 Nov 17 13:42 /lib/modules/4.14.78-sunxi/build -> /usr/src/linux-headers-4.14.81-sunxi
Iif it is missing - just create it manually be running
Note: this will work even if card is not connected, board will output to appropriate pins and it doesn't really care if someone listens or not. So now lets check if audio will produce
speaker-test -t sine -f 2500 -c 2
And finally i can hear beeping sound in both speakers. Hooray!
How to make install serial uart MIDI library from this sample library MIDI "rpidmx512/platform_midi.h at master · vanvught/rpidmx512 · GitHub" https://github.com/vanvught/rpidmx512/blob/master/lib-midi/src/h3/platform_midi.h
As far as I can tell, this is bare metal implementation, which is no help in linux environment. I would try to find something operating in linux space.
Hi I am bit new on these HW changes on OrangePI I have enabled I2S and it is working well. thanks a lot. But I need enable WIFI. I tried connect +5V to pad #5 but it is still not working. iwconfig is not detecting activated wifi.
sudo iwconfig lo no wireless extensions.
eth0 no wireless extensions.
by this image https://cdn.hackaday.io/images/8096121542489447571.26bab65dbaef86aeaac02c40e6e46378
There is also connected pin #4 FB which have bypass function but I have no idea how to connect that.
nmcli dev status DEVICE TYPE STATE CONNECTION eth0 ethernet unmanaged -- lo loopback unmanaged -- volumio@terasa:~$ nmcli radio wifi enabled volumio@terasa:~$ nmcli radio WIFI-HW WIFI WWAN-HW WWAN enabled enabled enabled enabled
Sorry for late reply. Sometimes I'm not notified for some reason. Originally I've made a mistake saying you can have WiFi on by pulling EN pin. Actually this IC is power source for wifi unit, FB stands for feedback pin, it is measuring and adjusting output voltage. When IC is out, no power will go to the Wifi. Ideally we need to find and desolder R69, but it probably has different designation on the v1.5 board that I have.
How to make install serial uart MIDI library from this sample library MIDI "rpidmx512/platform_midi.h at master · vanvught/rpidmx512 · GitHub" https://github.com/vanvught/rpidmx512/blob/master/lib-midi/src/h3/platform_midi.h