Da Alchemist Posted February 29, 2016 Share Posted February 29, 2016 tkaiser has built a new Kernel with i2s Modules. With this Kernel and some cheap DAC e.g. (http://www.ebay.de/itm/Audiophonics-I2S-DAC-ES9023-Sabre-to-Analog-24bit-192KHZ-fur-Raspberry-PI-/291573327639?hash=item43e31fe717:g:TTwAAOSw~OdVZXtm) it is possible to get good quality sound out of the Orange Pis. After installing the Kernel Two Things have to be changed in the fex File: Change Directory to boot: cd /boot Turn the script.bin to a fex-File and open it in an Editor sudo bin2fex script.bin script.fex sudo nano script.fex Now change the following Entries: [twi1] twi_used = 1 to [twi1] twi_used = 0 and [pcm0] daudio_used = 0 to [pcm0] daudio_used = 1 Save your changes and do : sudo fex2bin script.fex script.bin After a reboot your done. I do not know for what the Section [twi1] is good for, i hope nothing serious.. This connections have to be made: 5V > Pin 2 Gnd > Pin6 BCK > Pin 27 LRCK > Pin 28 Data > Pin37 (according to the Picture "giachi" has posted on the diyaudio Forum http://www.diyaudio.com/forums/pc-based/285427-i2s-connection-orange-dac.html#post4587580 see below) The second Picture is only for orientation on an Orangepi PC, the red Wire is 5V ! Be aware that the Header is rotated by 180°on the One! That´s all . Regards 4 Link to comment Share on other sites More sharing options...
tkaiser Posted February 29, 2016 Share Posted February 29, 2016 Thank you for the tutorial! A few questions/suggestions: Would be great if you could upload the picture and add it to your to post ("My Media") [x] done Please also adjust the post title so that it reads "[Tutorial] I2S on Orange Pi H3" instead [x] done This tutorial should work with all the other H3 variants also (please keep in mind that on the One the GPIO header is rotated by 180°) tw1 is used for SPI IIRC Unfortunately Pin 37 is in conflict with 1-Wire as soon as the modules are loaded (look in /etc/modules) so if you want to use both I2S and 1-Wire you have to adjust the GPIO pin used for 1-Wire in the fex file Now the question from an audio NOOB: How to proceed to use the I2S DAC instead? Which steps have then to be taken in Armbian to achieve this? Thx again! Link to comment Share on other sites More sharing options...
Da Alchemist Posted February 29, 2016 Author Share Posted February 29, 2016 Now the question from an audio NOOB: How to proceed to use the I2S DAC instead? Which steps have then to be taken in Armbian to achieve this? I do not know if i understand this question the right way. After you have connected the DAC there are three soundcards aplay -l will show us this: root@orangepipc:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC sndcodec-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: snddaudio [snddaudio], device 0: SUNXI-TDM0 snddaudio-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 In this case it is possible to access the i2s card with hw:1 or better hw:snddaudio in your audio applications. (Be aware , that you can see this three cards even when only the Modules are loaded,[pcm0] daudio_used = 1 is changed in the fex File and there is no Card connected) Regards 3 Link to comment Share on other sites More sharing options...
Lemonlemon Posted March 28, 2016 Share Posted March 28, 2016 Hi, does the H3 have MCLK output? Link to comment Share on other sites More sharing options...
Da Alchemist Posted March 29, 2016 Author Share Posted March 29, 2016 I can not answer this question exactly, but i would say no. In the Fex File PA18 (Pin28) is named MCLK. Regards Link to comment Share on other sites More sharing options...
Lemonlemon Posted March 30, 2016 Share Posted March 30, 2016 Thanks! Link to comment Share on other sites More sharing options...
pep01 Posted April 3, 2016 Share Posted April 3, 2016 Hello Can you may include support for PCM1522 driver in the upcoming release. This is for connect this dac: http://www.dx.com/es/p/pifi-digi-dac-hifi-digital-audio-card-for-raspberry-pi-b-blue-363003#.VwFLUHqIphE Thanks for your work Link to comment Share on other sites More sharing options...
Da Alchemist Posted April 3, 2016 Author Share Posted April 3, 2016 You can not use this DAC because the OPI PC is not Pin Compatible with the RPI. Regards Link to comment Share on other sites More sharing options...
Eng-Shien Wu Posted April 4, 2016 Share Posted April 4, 2016 BTW, here is an alternative source for the ES9024 DAC:http://www.banggood.com/ES9023-I2S-24-Bit-192-KHZ-Decoder-Board-For-Raspberry-PI-p-1012053.html I guess I will be back to this thread in two weeks when mine arrives. Link to comment Share on other sites More sharing options...
pep01 Posted April 4, 2016 Share Posted April 4, 2016 Hello, But I already bought the dac, the problem is solved with pin cables (12-27 BCK, 35-28 LRCK and 40-37 DOUT). My big problem is to load the driver into the kernel. Thanks a lot Link to comment Share on other sites More sharing options...
Gravelrash Posted April 4, 2016 Share Posted April 4, 2016 will the i2s functionality make it into the "legacy kernel" download / update. if not how does one obtain and use this kernel? Or is it best to wait till such time as the vanilla kernel is available? Im very new to the nuances of armbian and particularly the H3 chipset. Link to comment Share on other sites More sharing options...
tkaiser Posted April 4, 2016 Share Posted April 4, 2016 will the i2s functionality make it into the "legacy kernel" download / update. Already there starting with 5.05: https://github.com/igorpecovnik/lib/blob/master/documentation/H3_mini_faq.md With mainline/vanilla this should be no problem at all (after adjusting .dts file to use the aforementioned pins for I2S) 1 Link to comment Share on other sites More sharing options...
Gravelrash Posted April 4, 2016 Share Posted April 4, 2016 @ tkaiser thankyou Link to comment Share on other sites More sharing options...
Eng-Shien Wu Posted April 18, 2016 Share Posted April 18, 2016 My ES9024 DAC arrived earlier and I have been happily listening to music with it for the past several days. I can confirm that the instructions are correct and that the DAC works very well. The biggest challenge was soldering on female pin headers onto the wires (need small tip) and editing /boot/script.bin because I am a H3 noob (bin2fex/fex2bin). An easier option, albeit of lower sound quality (16-bit 48k), is a cm108 USB Sound DAC: http://www.banggood.com/USB-Virtual-7_1-Channel-Audio-Sound-Card-Adapter-p-938086.html It is plug-and-play on Armbian 5.05 and shows up as the third audio device (assuming you didn't edit script.bin for i2s): sudo aplay -l sudo speaker-test -twav -c2 -Dhw:2 Link to comment Share on other sites More sharing options...
Zammy Posted June 26, 2016 Share Posted June 26, 2016 Thanks Da Achemist, works perfectly with PCM5102 which has higher bitrate 32bit 384K vs 24bit 192K of ES9023. Link to comment Share on other sites More sharing options...
Ford Prefect Posted June 28, 2016 Share Posted June 28, 2016 And even cheaper http://www.ebay.com/itm/I2S-Player-PCM5102-DAC-Decoder-Assembled-Board-32-Bit-384K-Beyond-ES9023-PCM1794/321938017594?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D20131003132420%26meid%3D58c0365c234549a28b0e32264a9da0a3%26pid%3D100005%26rk%3D2%26rkt%3D6%26sd%3D272248053601 But there seems to be a clock signal missing. http://www.ti.com/lit/ds/symlink/pcm5100.pdf see page 26 may be that's the use for the jumper ? Link to comment Share on other sites More sharing options...
Da Alchemist Posted June 28, 2016 Author Share Posted June 28, 2016 There is nothing missing, you can use this card the way it comes. MCLK signal is not connected on the ES9023 Board Regards Link to comment Share on other sites More sharing options...
snowbody Posted July 11, 2016 Share Posted July 11, 2016 Thank you for the tutorial. I bought a cheap PCM5102 board (7 euro shipment included!) http://www.aliexpress.com/item/PCM5102-DAC-Decoder-I2S-Player-Assembled-Board-32Bit-384K-Beyond-ES9023-PCM1794-compatible-Raspberry-Pi/32678406932.html I can now use my orange pi as a synthesizer (zynaddsubfx) without any glitches! (external midi keyboard!) Even LMMS now works and sounds like a breeze. The standard setup of "jackd" did not work. I start jackd manually, and afterwards qjackctl. Link to comment Share on other sites More sharing options...
Ford Prefect Posted July 11, 2016 Share Posted July 11, 2016 Thanks for your feedback. Your use of the PI and this card as a synthesiser is very clever. I'm not a musician but it opens the possibility to generate low cost/high quality test signals for various electronic devices. Link to comment Share on other sites More sharing options...
snowbody Posted July 14, 2016 Share Posted July 14, 2016 In case someone would like to try music-stuff : I had no luck using the standard orangepiplus2e sound. I had good results with a 80cents(!) usbsoundcard, but really excellent results using the PCM5102 board. get "jackd" to work (jack is like an electronic patch board) : this is what worked for me (it took me some time to figure this out ) jackd -d alsa -dhw:1 -P (do not launch as root, but as the default armbian user) (hw:1 = card 1 -- this might be different for you) install qjackctl (connect readable clients to writable clients) orangepi@orangepiplus2e:~$ aplay -l**** List of PLAYBACK Hardware Devices ****card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC sndcodec-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0card 1: snddaudio [snddaudio], device 0: SUNXI-TDM0 snddaudio-0 [] Subdevices: 0/1 Subdevice #0: subdevice #0card 2: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 orangepi@orangepiplus2e:/etc$ more asound.confpcm.!default { type hw card 1}ctl.!default { type hw card 1} Link to comment Share on other sites More sharing options...
dony71 Posted July 14, 2016 Share Posted July 14, 2016 May I know what's max PCM rate supported in kernel? Does it support 384K like in Odroid C1/C2 ? (https://github.com/hardkernel/linux/blob/odroidc2-3.14.y/include/sound/pcm.h#L115) Link to comment Share on other sites More sharing options...
zador.blood.stained Posted July 15, 2016 Share Posted July 15, 2016 May I know what's max PCM rate supported in kernel? Does it support 384K like in Odroid C1/C2 ? (https://github.com/hardkernel/linux/blob/odroidc2-3.14.y/include/sound/pcm.h#L115) According to H3 datasheet maximum I2S/PCM sample rate supported by hardware is 192KHz Link to comment Share on other sites More sharing options...
Christos Posted October 11, 2016 Share Posted October 11, 2016 Was anyone successful in capture? Edit/P.S. Ok, it works, after a reboot. Link to comment Share on other sites More sharing options...
Da Alchemist Posted October 14, 2016 Author Share Posted October 14, 2016 what did you use AS I2S capture device? Link to comment Share on other sites More sharing options...
Christos Posted October 14, 2016 Share Posted October 14, 2016 I use a PCM4222 EVM. From what I seen, the current driver (daudio), is working only with 16bits capture. Though the driver itself reports via alsacap that it can work at any ramplerate 8000..192000 and at 16/24/32bits as shown in Card 1, ID `snddaudio', name `snddaudio' login as: root root@192.168.1.131's password: _ _ ____ _ _ _ | \ | | __ _ _ __ ___ | _ \(_) | \ | | ___ ___ | \| |/ _` | '_ \ / _ \| |_) | | | \| |/ _ \/ _ \ | |\ | (_| | | | | (_) | __/| | | |\ | __/ (_) | |_| \_|\__,_|_| |_|\___/|_| |_| |_| \_|\___|\___/ Welcome to ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i System load: 0.18 Up time: 3 min Memory usage: 9 % of 494Mb IP: 192.168.1.131 CPU temp: 39°C Usage of /: 11% of 15G Last login: Fri Oct 14 17:25:47 2016 from 192.168.1.6 root@nanopineo:~# alsacap/alsacap *** Scanning for playback devices *** Card 0, ID `audiocodec', name `audiocodec' Device 0, ID `SUNXI-CODEC sndcodec-0', name `', 1 subdevices (1 available) 1..2 channels, sampling rate 8000..192000 Hz Sample formats: S16_LE, S24_LE, S32_LE, S20_3LE Subdevice 0, name `subdevice #0' Card 1, ID `snddaudio', name `snddaudio' Device 0, ID `SUNXI-TDM0 snddaudio-0', name `', 1 subdevices (1 available) 1..2 channels, sampling rate 8000..192000 Hz Sample formats: S16_LE, S24_LE, S32_LE, S20_3LE Subdevice 0, name `subdevice #0' Card 2, ID `sndhdmi', name `sndhdmi' Device 0, ID `SUNXI-HDMIAUDIO sndhdmi-0', name `', 1 subdevices (1 available) 1..8 channels, sampling rate 8000..192000 Hz Sample formats: S16_LE, S24_LE, S32_LE, S20_3LE Subdevice 0, name `subdevice #0' root@nanopineo:~# There is an easy test to verify that the H3 PCM/I2S driver has a serious flaw/bug though. The PCM/I2S port as it is now setup in script.bin (working only in legacy.. still pending in vanilla..) is configuring the PCM/I2S port as master, thus it does not rely for any timing/control signal from the peripheral/codec/adc. That is good for our testing since no additional external hardware/codec/adc is required and everyone can do the test. Anyone that has any H3 board with a PCM/I2S enabled port. I do have setup the card1 as default root@nanopineo:~# cat /etc/asound.conf pcm.!default { type hw card 1 } ctl.!default { type hw card 1 } So, at first, do a 20sec capture root@nanopineo:~# arecord -t wav -c 2 -f S24_LE -r 48000 -d 20 testrec.wav Recording WAVE 'testrec.wav' : Signed 24 bit Little Endian, Rate 48000 Hz, Stereo root@nanopineo:~# You will notice, if you got a clock/timer on the other side of the screen, that this command it actually records for 40 sec!! not 20 as requested!! So, if you play the wav file you expect it to last for 40 sec.. Then do play the recorded file root@nanopineo:~# aplay testrec.wav Playing WAVE 'testrec.wav' : Signed 24 bit Little Endian, Rate 48000 Hz, Stereo root@nanopineo:~# If you see the actual time passed, it will be 20 sec played, but the inital recording lasted for 40 sec.. (gotcha) In any samplerate you try, either 8K or 96K or 192K it will give the same results if you do a capture with more than 16bits resolution, eg S24_LE or S32_LE. Capturing with 16bits resolution eg with S16_LE everything is just fine. Obviously the H3 PCM/I2S driver has a problem with capture in anything higher than 16bits resolution and needs to be rectified. Christos P.S. Even if you do not rely on the -d <seconds> parameter, but you do it manualy by starting and stopping with ctrl-C and measuring the elapsed time yourself, you will notice the same thing, the recorded file lasts always half the time you recorded for, when having more than 16bits eg S24_LE. Link to comment Share on other sites More sharing options...
dony71 Posted October 27, 2016 Share Posted October 27, 2016 can you try to change "sample_resolution = 24" in script.bin see below in details under [pcm0] https://github.com/igorpecovnik/lib/blob/master/config/fex/bananapim2plus.fex Link to comment Share on other sites More sharing options...
thk4711 Posted November 1, 2016 Share Posted November 1, 2016 First of all thank you for this tutorial. It basically did work with an ES9023 DAC. I do get sound but the volume is very low compared with the same board connected to an Rasberry Zero. Is there anything I can do to increase the volume ? Link to comment Share on other sites More sharing options...
thk4711 Posted November 2, 2016 Share Posted November 2, 2016 I found the problem myself. It looks like that that mpd is sending 24bit audio data by default over the i2s interface. Fore some reason either the kernel module or the ES9023 DAC does not correctly handle this data which is leading to the low volume on the output. If you force mpd to either generate 16bit or 32bit audio data everything is working correctly. You can do that in the mpd.conf file in the audio_output section. Here is the one I am using right now, which is forcing 32 bit 2 channel output. audio_output { type "alsa" name "My ALSA Device" device "hw:1,0" format "*:32:2" } Link to comment Share on other sites More sharing options...
msev Posted November 28, 2016 Share Posted November 28, 2016 Would such a DAC work too -> http://www.ebay.com/itm/Beyond-ES9023-PCM1794-I2S-PCM5102-DAC-Decoder-I2S-Player-Module-For-Raspberry-Pi-/131945348326?hash=item1eb88e3ce6:g:t5gAAOSwPCVX4l6L? Since it uses the same chip but looks a bit different. Link to comment Share on other sites More sharing options...
thk4711 Posted November 28, 2016 Share Posted November 28, 2016 This would work but you will have to connect several pins either to GND or 3.3V please see: http://blogimg.goo.ne.jp/user_image/70/5e/60fd0f0bbd1c93ac131f3604608bfbdb.png It would be easier to this one http://www.ebay.com/itm/PCM5102-DAC-Decoder-I2S-Player-Board-32Bit-384K-Beyond-ES9023-PCM1794-/142125650366?hash=item21175951be:g:b5sAAOSwLF1X48tC it has the same chip and you only need to connect the I2S related pins 5V and GND. Or this one (I am using it right now) http://www.ebay.com/itm/Audiophonics-DAC-Sabre-ES9023-I2S-vers-Analogique-24bit-192KHZ-ll-/301441579838?hash=item462f517b3e:g:YccAAOSwD0lUj2EL Link to comment Share on other sites More sharing options...
Recommended Posts