8 8
Da Alchemist

tutorial I2S on Orange Pi H3

Recommended Posts

First of all, it was introduced in the forum (http://www.diyaudio.com/forums/pc-based/285427-i2s-connection-orange-dac.html) that made it possible to listen to high reso music on i2S output on OrangePi PC It was done. It was a report that introduced Logitech Media Server (LMS) + Squeezelite to OrangePi PC. That image was perfect.

However, the Volumio that was introduced later on another forum (http: //www.orangepi....wthread&tid=191) was incomplete and did not work.

Share this post


Link to post
Share on other sites

Hi, we've designed Volumio to be easily ported to other platforms. You can see our build scripts here:

 

https://github.com/volumio/Build

 

You can take inspiration from the build script for Odroid for example:

https://github.com/volumio/Build/blob/master/scripts/odroidc1config.sh

https://github.com/volumio/Build/blob/master/scripts/odroidc1image.sh

 

Simply copy them as orangepiconfig.sh and orangepiimage.sh and modify them accordingly, once done add the references to :

https://github.com/volumio/Build/blob/master/build.sh

 

If you need some assistance, jump on our forum where we can give assistance if needed https://volumio.org/forum/

 

Let me know how it goes 

Share this post


Link to post
Share on other sites

Hi, we've designed Volumio to be easily ported to other platforms.

 

And by using Armbian as build system and adding a simple 'add volumio' function to customize-image.sh (when it's not about RPi) Volumio would run on ~40 SBC already. Please read through:

At least that's one of my goals contributing to Armbian project: Stop re-inventing the wheel again and again.

Share this post


Link to post
Share on other sites

And by using Armbian as build system and adding a simple 'add volumio' function to customize-image.sh (when it's not about RPi) Volumio would run on ~40 SBC already. Please read through:

At least that's one of my goals contributing to Armbian project: Stop re-inventing the wheel again and again.

I agree with you on the principle: there is lot of effort going into lots of distro, if they were focused only on one sure we'll have a really fine tuned system. Unfortunately with Volumio we use a very peculiar mounting mechanism (squashfs + overlayfs) and we based the whole partitioning on that. I fear that just an override script won't be enough to customize armbian enough. In any case I'll give a try.

I understand you are against reinventing the wheel, and I agree on this, but some practical reasons and peculiarity of all distros are a showstopper for a "universal" OS, IMHO

 

Share this post


Link to post
Share on other sites

Does somebody know what changes I have to make in the source files for daudio0 to configure the SBS as I2S slave?

I have a codec that must be an I2S master.

With RPI one could change the CBS and/or CFS lines to lines to CBM and/or CFM to go from RPI-master to RPI-slave in the dummy codec.

On cubieboard could one change in the script.bin something like I2S_slave =1

I tried some of those changes to my nanopi neo without any luck.

Hope someone  can help me with this.

Thanks in advance.

Share this post


Link to post
Share on other sites

Thanks guys, this worked perfectly on my NanoPi NEO H3 board.  I hope you don't mind if I cite this thread in my list for building a network MPD player out of the little board?

 

I can verify that for both the PCM5102A and the onboard H3 audio hardware, I had to set " format          "*:32:2" " for MPD to have equal volume across my 16 and 24 bit source material.

Share this post


Link to post
Share on other sites
On ‎14‎.‎02‎.‎2017 at 0:16 AM, HEAudio said:

Does somebody know what changes I have to make in the source files for daudio0 to configure the SBS as I2S slave?

I have a codec that must be an I2S master.

I subscribe to HEAudio question. I found, that  one must set

daudio_master = 1   //SND_SOC_DAIFMT_CBM_CFM(codec clk & FRM master)

rather than

daudio_master = 4   //SND_SOC_DAIFMT_CBS_CFS(codec clk & FRM slave)

in section [pcm0] of fex-file, compile and copy to /boot/bin.

I also tried of those changes to my nanopi neo without any luck.

Legacy Debian Jessie 3.4.113 Image does not support this parameter? What image for nanopi neo support this one?

Thanks in advance.

Share this post


Link to post
Share on other sites

Ok nice that someone else than me seems to be interested to get I2S slave mode working.

In my opinion it is the only way to have a chance to get hi end audio from those devices.

I tried the changes you suggested for a time ago and failed that was the reason I sent my question here.

But I never thought that it could be the version of debian that didn't supported that.

So I have the same question as you What version supports those settings?

 

Share this post


Link to post
Share on other sites
3 hours ago, Georgios Fevgidis said:

What version supports those settings?

Fex settings are related to legacy kernel and do not depend on anything above (which distro used or made by whom). It might be possible that FA kernel is slightly different than Armbian's legacy kernel (other patches applied, they have an I2S HAT now and there was a commit related to that few weeks ago) but without any information it's hard to tell what's going on.

Share this post


Link to post
Share on other sites

Well I've spend few hours and now I am stuck...

 

I've bought a 5102A card and connected with I2S on an Orange Pi One.  Everything is ok as far I can understand (sudo speaker-test -twav -c2 -Dhw:1 produces sound on the output), but I cannot use the card with squeezelite (https://github.com/ralph-irving/squeezelite).

 

Well I use a fresh Armbian Debian Jessie:

  ___                               ____  _    ___             
 / _ \ _ __ __ _ _ __   __ _  ___  |  _ \(_)  / _ \ _ __   ___ 
| | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | | | | '_ \ / _ \
| |_| | | | (_| | | | | (_| |  __/ |  __/| | | |_| | | | |  __/
 \___/|_|  \__,_|_| |_|\__, |\___| |_|   |_|  \___/|_| |_|\___|
                       |___/                                   

Welcome to ARMBIAN 5.25 stable Debian GNU/Linux 8 (jessie) 3.4.113-sun8i   
System load:   0.45             Up time:       25 sec
Memory usage:  20 % of 494Mb    IP:            192.168.1.140
CPU temp:      46°C           
Usage of /:    39% of 3.5G  


1/ I can see the card:

 

cat /proc/asound/cards
0 [audiocodec ]: audiocodec - audiocodec
audiocodec
1 [snddaudio ]: snddaudio - snddaudio
snddaudio
2 [sndhdmi ]: sndhdmi - sndhdmi
sndhdmi



2/ I can really see it :

 

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

 

squeezelite is seeing the snddaudio card:

sudo /usr/bin/squeezelite-armv6hf -l
Output devices:
  null                           - Discard all samples (playback) or generate zero samples (capture)
  default:CARD=audiocodec        - audiocodec,  - Default Audio Device
  sysdefault:CARD=audiocodec     - audiocodec,  - Default Audio Device
  dmix:CARD=audiocodec,DEV=0     - audiocodec,  - Direct sample mixing device
  dsnoop:CARD=audiocodec,DEV=0   - audiocodec,  - Direct sample snooping device
  hw:CARD=audiocodec,DEV=0       - audiocodec,  - Direct hardware device without any conversions
  plughw:CARD=audiocodec,DEV=0   - audiocodec,  - Hardware device with all software conversions
  default:CARD=snddaudio         - snddaudio,  - Default Audio Device
  sysdefault:CARD=snddaudio      - snddaudio,  - Default Audio Device
  dmix:CARD=snddaudio,DEV=0      - snddaudio,  - Direct sample mixing device
  dsnoop:CARD=snddaudio,DEV=0    - snddaudio,  - Direct sample snooping device
  hw:CARD=snddaudio,DEV=0        - snddaudio,  - Direct hardware device without any conversions
  plughw:CARD=snddaudio,DEV=0    - snddaudio,  - Hardware device with all software conversions
  default:CARD=sndhdmi           - sndhdmi,  - Default Audio Device
  sysdefault:CARD=sndhdmi        - sndhdmi,  - Default Audio Device
  dmix:CARD=sndhdmi,DEV=0        - sndhdmi,  - Direct sample mixing device
  dsnoop:CARD=sndhdmi,DEV=0      - sndhdmi,  - Direct sample snooping device
  hw:CARD=sndhdmi,DEV=0          - sndhdmi,  - Direct hardware device without any conversions
  plughw:CARD=sndhdmi,DEV=0      - sndhdmi,  - Hardware device with all software conversions
  default:CARD=DAC               - USB AUDIO    DAC, USB Audio - Default Audio Device
  sysdefault:CARD=DAC            - USB AUDIO    DAC, USB Audio - Default Audio Device
  front:CARD=DAC,DEV=0           - USB AUDIO    DAC, USB Audio - Front speakers
  surround21:CARD=DAC,DEV=0      - USB AUDIO    DAC, USB Audio - 2.1 Surround output to Front and Subwoofer speakers
  surround40:CARD=DAC,DEV=0      - USB AUDIO    DAC, USB Audio - 4.0 Surround output to Front and Rear speakers
  surround41:CARD=DAC,DEV=0      - USB AUDIO    DAC, USB Audio - 4.1 Surround output to Front, Rear and Subwoofer speakers
  surround50:CARD=DAC,DEV=0      - USB AUDIO    DAC, USB Audio - 5.0 Surround output to Front, Center and Rear speakers
  surround51:CARD=DAC,DEV=0      - USB AUDIO    DAC, USB Audio - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
  surround71:CARD=DAC,DEV=0      - USB AUDIO    DAC, USB Audio - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
  iec958:CARD=DAC,DEV=0          - USB AUDIO    DAC, USB Audio - IEC958 (S/PDIF) Digital Audio Output
  dmix:CARD=DAC,DEV=0            - USB AUDIO    DAC, USB Audio - Direct sample mixing device
  dsnoop:CARD=DAC,DEV=0          - USB AUDIO    DAC, USB Audio - Direct sample snooping device
  hw:CARD=DAC,DEV=0              - USB AUDIO    DAC, USB Audio - Direct hardware device without any conversions
  plughw:CARD=DAC,DEV=0          - USB AUDIO    DAC, USB Audio - Hardware device with all software conversions

 

note: I have connected an USB PCM 2704 seen as USB Audio



3/ I can hear it:
 

sudo speaker-test -twav -c2 -Dhw:1




But I cannot understand what I have to do to be able to use it with squeezelite:

 

When I use the USB DAC it is working with the following line:

 

sudo /usr/bin/squeezelite-armv6hf -o front:CARD=DAC,DEV=0 -s 127.0.0.1

Trying with the I2S card, I cannot understand why it is not working:

 

sudo /usr/bin/squeezelite-armv6hf -o default:CARD=snddaudio,DEV=0 -s 127.0.0.1
[14:25:12.853752] test_open:277 playback open error: No such file or directory
[14:25:12.854570] output_init_common:382 unable to open output device


Well I am stuck here, please could you help? Thanks in advance.

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Hi All,

 

On new revision of Orange Pi Zero (512M) board, chinsee engineers changed the PCB by removed the R66/R69 resistors (PA20 / Wifi power logical pull up).

As I measured on board the PA20 line can be accessed on pin of XR819 power supply LDO (5V/1.8V). The U58 IC pin3 (marked on photo) should be elevate from PCB and should pull up to 3.3V logical "1" level.

The PA20 line for I2S data out is accessed from pcb pin. Good luck!

OrangePiZerov1.4_PCB_for_I2S.png

Share this post


Link to post
Share on other sites

PCB revision is v1.4, LDO IC maybe U56 (not so good readable). PA20 logical levels can be test with the following:

echo "20" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio20/direction
echo "1" > /sys/class/gpio/gpio20/value
and
echo "0" > /sys/class/gpio/gpio20/value

 

Share this post


Link to post
Share on other sites

Good luck ! This part isn't easy to find in bulk, none on eBay or AliExpress ...

 

EDIT : Oh ! instead of searching PST73118BETV like schematic says, TI has some TPS73118, some on eBay.

 

Lucky Guy ! I found that MCP1824 on AliExpress in abundance, and it seems to be pin compatible, some sellers offer them at $4 for lot of 10.

Share this post


Link to post
Share on other sites

Yes the PST73118BETV is hard to find... 

I was able to  find the datasheet and to turn on the regulator i just need to connect the pin 3 to the pin 1, and will stay always on.

 

Thanks Martinayotte, you saved me with that one! 

Share this post


Link to post
Share on other sites

Hi All,

 

I have some issues with my ES9023 DAC and my OrangePi PC Plus. 

I bought the same DAC as shown in the very first post of this topic.  I followed all the steps explained here for the configuration. Eventually I had everything set up, I was supposed to hear sound from the DAC, but there was only a white noise.

I tried also giving external +5V DC supply to the DAC, it didn't help. Then once suddenly it started to working, I could play audio through the DAC, but the next time it was again noise only.

 

After spending many hours and hours investigating finally I understood what's happening.  After power up the system, to be able to hear audio from the DAC I have to switch the DAC +5 V supply ON and OFF many times.  Most of the times after powering it on, there is only noise. But after 10..20 power ON/OFF cycles (depending my luck) suddenly it switches on without any noise, and in this case it is working perfectly until the next power off.

 

Is this a normal operation of this kind of DAC? Did anyone experienced similar problems? Is there a solution to overcome this issue and make it working straight after the first power on?

Or may be my DAC defected? Shall I try to buy a new one?

 

I ordered mine from this link:

DAC Sabre ES9023 Analog I2S 24 Bit 192 KHz Decoder Board For Raspberry Pi

 

Share this post


Link to post
Share on other sites
8 8