Jump to content


Photo

[Tutorial] I2S on Orange Pi H3


64 replies to this topic

#31 mdphoto

mdphoto

    Newbie

  • Senior Members
  • Pip
  • 1 posts

Posted 03 December 2016 - 07:28 PM

Hi,

 

I've Opi zero and Dac ES9023.

 

I've a problem I can not get a wiring. The opi Zero has 26 gpio pin, I do not find the Data PA20 some in the table of first post.

 

If you've id 

 

Thank you 

 

Sorry for my English I'm french  :)



#32 zador.blood.stained

zador.blood.stained

    Advanced Member

  • Moderators
  • 1838 posts

Posted 03 December 2016 - 07:42 PM

I've a problem I can not get a wiring. The opi Zero has 26 gpio pin, I do not find the Data PA20 some in the table of first post.

PA20 is not available on the header, it is used for controlling wireless chip power. It can only be used by soldering a wire to one of pads for resistor R69 (can be seen on the board between wireless chip and Ethernet transformer, resistor itself needs to be desoldered) and changing wireless driver configuration. 


  • lanefu likes this

Spoiler

#33 hyphop

hyphop

    Member

  • Senior Members
  • PipPip
  • 28 posts

Posted 10 December 2016 - 09:27 AM

try to use DAC ES9023 on orange pi zero

 

reconfigure  orangepizero.fex => orangepizero.bin

 


..
[twi0]
twi_used = 0
..

[pcm1]
daudio_used = 1
...
i2s_mclk = port:PA10<2><1><default><default>
i2s_bclk = port:PA11<2><1><default><default>
i2s_dout0 = port:PA12<2><1><default><default>
i2s_din = port:PA13<2><1><default><default>

connect my dac to PA10 11 12 GND +5V

 

boot kernel

root@OpenWrt:~# uname -a
Linux OpenWrt 3.4.113-sun8i #335 SMP PREEMPT Tue Nov 22 21:47:33 CET 2016 armv7l GNU/Linux

check syslog dmesg -c

looks like snddaudio detected

[    1.537136] pcm0 pcm0: pins are not configured from the driver
[    1.543797] asoc: snddaudio <-> pri_dai mapping ok
[    1.553153] asoc: sndhdmi <-> sunxi-hdmiaudio.0 mapping ok

[    1.774866] ALSA device list:
[    1.774883]   #0: snddaudio
[    1.774898]   #1: sndhdmi

check alsa devices - is ok

root@OpenWrt:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: snddaudio [snddaudio], device 0: SUNXI-TDM0 snddaudio-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

check sound

aplay -D sysdefault:CARD=snddaudio test.wav

ooops !!! not have soundonly silent ))))

 

check /sys/... for any information
 

root@OpenWrt:/sys/devices/platform/snddaudio/s_i2s1$ ls -l1
-r--r--r--    1      4096 Dec 10 07:44 codec_reg    
-r--r--r--    1      4096 Dec 10 07:44 dapm_widget    
-rw-r--r--    1      4096 Dec 10 07:44 pmdown_time
drwxr-xr-x    2         0 Dec 10 07:44 power
-rw-r--r--    1      4096 Dec 10 07:44 uevent
root@OpenWrt:/sys/devices/platform/snddaudio/s_i2s1$ grep "" *
dapm_widget:PM State: On
pmdown_time:5000

coodec_reg is empty ;(

 

who have sound please say what wrong !

 

! which codec needed ? maybe some like for odroid snd-soc-pcm5102.ko snd-soc-odroid-dac.ko

maybe need load some modules ?

 

i have loaded only

root@OpenWrt:~# lsmod
mac80211              358445  1 xradio_wlan
xradio_wlan           210530  0 

maybe try  kernel 4.9 ?

 

tnx for all



#34 zador.blood.stained

zador.blood.stained

    Advanced Member

  • Moderators
  • 1838 posts

Posted 10 December 2016 - 10:12 AM

You can only use predefined groups of pins for PCM/I2S, you can't just change

i2s_dout0 = port:PA20<2><1><default><default>

to

i2s_dout0 = port:PA10<2><1><default><default>

because you want to do so.

You can use either PA18/PA19/PA20/PA21 or PG10/PG11/PG12/PG13 for PCM_SYNC/PCM_CLK/PCM_DOUT/PCM_DIN respectively.


Spoiler

#35 hyphop

hyphop

    Member

  • Senior Members
  • PipPip
  • 28 posts

Posted 10 December 2016 - 10:59 AM

You can only use predefined groups of pins for PCM/I2S, you can't just change

....

because you want to do so.

You can use either PA18/PA19/PA20/PA21 or PG10/PG11/PG12/PG13 for PCM_SYNC/PCM_CLK/PCM_DOUT/PCM_DIN respectively.

 

ok

 

my orange_pi_zero board

have only 26 pin

                                                2x13 Header
         1     3.3V                            2     5V
         3     TWI0_SDA / PA12                 4     5V                 
         5     TWI0_SCK / PA11                 6     GND
         7     PWM1 / PA06                     8     UART1_TX / PG06
         9     GND                             10    UART1_RX / PG07
         11    UART2_RX / PA01                 12    SIM_CLK/PA_EINT7 / PA07
         13    UART2_TX / PA00                 14    GND
         15    UART2_CTS / PA03                16    TWI1-SDA / PA19
         17    3.3V                            18    TWI1-SCK / PA18
         19    SPI1_MOSI / PA15                20    GND
         21    SPI1_MISO / PA16                22    UART2_RTS / PA02
         23    SPI1_CLK / PA14                 24    SPI1_CS / PA13
         25    GND                             26    SIM_DET/PA_EINT10 / PA10  

where i can get PG10/PG11/PG12/PG13  or PA20/PA21 ?

 

tnx for reply



#36 zador.blood.stained

zador.blood.stained

    Advanced Member

  • Moderators
  • 1838 posts

Posted 10 December 2016 - 11:17 AM

Both PA20 and PG12 are used on this board - PA20 is used for wireless chip and PG12 is used for USB OTG detection. So if you really want to use I2S on this board the best option would be to unsolder R69 and use one of its pads. To power on the wireless module you'll have to either solder R66 resistor near it or solder a wire from one of R66 pads to other GPIO and change wireless driver configuration to use this GPIO.


Spoiler

#37 Christos

Christos

    Advanced Member

  • Senior Members
  • PipPipPip
  • 198 posts

Posted 10 December 2016 - 11:30 AM

Obviously Orange/Xunlong failed hard here in design

 

-> http://www.orangepi....thread&tid=2227

 

hopefully in their next versions of the boards (H2+, H5) they will rectify that.


__________________________________________________________________________________________________________________

Samsung S5P6818             AllWinner H3                      AllWinner H5       Broadcom BCM2837    AllWinner A64

.  FriendlyArm NanoPi M3    .  FriendlyArm NanoPi NEO v1.1    .  OrangePi PC2    .  RaspberryPi 3    . NanoPi A64

.  Samsung Artik710         .  OrangePi ONE                   .                  .                   .

.                           .  OrangePi PC Plus               .                  .                   .

.                           .  OrangePi PC Plus2E             .                  .                   .


#38 hyphop

hyphop

    Member

  • Senior Members
  • PipPip
  • 28 posts

Posted 10 December 2016 - 01:41 PM

Both PA20 and PG12 are used on this board - PA20 is used for wireless chip and PG12 is used for USB OTG detection. So if you really want to use I2S on this board the best option would be to unsolder R69 and use one of its pads. To power on the wireless module you'll have to either solder R66 resistor near it or solder a wire from one of R66 pads to other GPIO and change wireless driver configuration to use this GPIO.

 

tnx for hi quality answers

 

i have try clarify your solution and illustrate it before hack board )))

orange.jpg

 

cani use PA20 direct from cpu without any additional elements (from green dotted line on illustrate ) ???

 

what about R66 resistor its same R69? if i try change power on wifi from R69 ???

 

wireless driver configuration to use this GPIO? where ? which one i can i find this one? PA07 or PA10  ?

 

what need to change in fex for fix this hack?


what is it ?

[module_para]
module_power0 = port:PA20<1><default><default><0>
module_power0_vol = 1

what is it ?

[gpio_para]
gpio_used = 0
gpio_num = 2
gpio_pin_1 = port:PA07<1><default><default><0>
gpio_pin_2 = port:PA10<1><default><default><0>

tnx for all



#39 zador.blood.stained

zador.blood.stained

    Advanced Member

  • Moderators
  • 1838 posts

Posted 10 December 2016 - 01:54 PM

This is the relevant part in the schematic:

opi-zero-wifi.PNG
 
So you can either solder a resistor (or maybe a piece of wire) in place of R66 to leave U56 converter always on, or you can solder a wire between bottom (on the schematic, one closer to R69 on the board) resistor pad to any other GPIO and put this GPIO here instead of PA20:
[module_para]
module_power0 = port:PA20<1><default><default><0>

For the reference, [gpio_para] section in FEX files for H3 boards is not used since there is a proper sysfs GPIO driver


Spoiler

#40 hyphop

hyphop

    Member

  • Senior Members
  • PipPip
  • 28 posts

Posted 10 December 2016 - 05:01 PM

BIG tnx  zador.blood.stained for hi quality answers

 

if you really want to use I2S on this board the best option would be to unsolder R69

 

i have made it and i2s dac work fine , tomorrow i will try fix wifi poweron

 

i still like my tiny board ))))

 

some pics for another guys who like connect i2s dac

Attached Images

  • orange_pi_zero_i2s_dac_mod.jpg
  • orange_pi_zero_i2s_dac2.jpg
  • orange_pi_zero_i2s_dac.jpg

  • lanefu likes this

#41 hyphop

hyphop

    Member

  • Senior Members
  • PipPip
  • 28 posts

Posted 11 December 2016 - 07:05 PM

ok wifi worked fine again

 

fixed via PA02 - solder wire direct to pin

 

and fix script

 

[module_para]
module_power0 = port:PA02<1><default><default><0>
module_power0_vol = 1
 

Attached Images

  • orangepizero_i2s_dac_wifi_power_fix.jpg


#42 mcxrayca

mcxrayca

    Newbie

  • Senior Members
  • Pip
  • 1 posts

Posted 17 December 2016 - 05:26 AM

Dear sir,

 

please I don´t have experience niether linux or orange pi board, but I like start to know about this.

I need your help.

I like buy this board: 

https://www.aliexpre...760774493.html?

 

Beacause this have analog audio output and wifi, and my question are:

1) Can I configure this board how a wifi server and client? if is ok please explain to me to do it

2) Does the quality audio output is Hifi? if is ok, please explain to me how I can setup to optimal audio peformance 



#43 Igor

Igor

    Administrator

  • Administrators
  • 3078 posts

Posted 17 December 2016 - 08:07 AM

1) Can I configure this board how a wifi server and client? if is ok please explain to me to do it

2) Does the quality audio output is Hifi? if is ok, please explain to me how I can setup to optimal audio peformance 

 

If you want to attach I2S sound card on this particular board (Opi Zero) you will need to solder stuff. Get rather an Orange Pi PC+ board. It's few more extra bucks but you have analogue audio connector, I2S on header and more. On board wireless is also little better.

 

For hifi sound you need an extra board / external DAC, something like this ...


  • markbirss likes this

Donate to support Armbian. Thank you! | Use forum not private messaging | Use search before opening new topic | Enjoy!


#44 markbirss

markbirss

    Member

  • Senior Members
  • PipPip
  • 20 posts

Posted 20 December 2016 - 08:26 AM

If you want to attach I2S sound card on this particular board (Opi Zero) you will need to solder stuff. Get rather an Orange Pi PC+ board. It's few more extra bucks but you have analogue audio connector, I2S on header and more. On board wireless is also little better.

 

For hifi sound you need an extra board / external DAC, something like this ...

 

Thanks Igor, i  found these DAC boards cheaper at AliExpress  $7.21

 

https://www.aliexpre...0608.0.0.1FX0L2


  • Igor likes this

#45 starsail0r

starsail0r

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 03 January 2017 - 11:32 PM

I have followed the first message in the thread for my opi one and i can see the i2s es9023 listed on "aplay -l" output but I couldn't have any sound out of it. Can someone help me find what is wrong about it?

 

If it helps, i get this output on command,

root@orangepione:~# cat /sys/devices/platform/snddaudio/s_i2s1/dapm_widget 
PM State: Standby
 
Another user's output is State on. Could this be related to what is wrong?


#46 markbirss

markbirss

    Member

  • Senior Members
  • PipPip
  • 20 posts

Posted 05 January 2017 - 08:09 AM

 

I have followed the first message in the thread for my opi one and i can see the i2s es9023 listed on "aplay -l" output but I couldn't have any sound out of it. Can someone help me find what is wrong about it?

 

If it helps, i get this output on command,

root@orangepione:~# cat /sys/devices/platform/snddaudio/s_i2s1/dapm_widget 
PM State: Standby
 
Another user's output is State on. Could this be related to what is wrong?

 

 

Check and confirm changes to your fex file ? i also had to add these additional changes to my Nano Pi NEO to get my I2s dac working

 

[w1_para]
w1_used = 1
gpio = 20
should be
 
[w1_para]
w1_used = 0
gpio = 20


#47 eni

eni

    Newbie

  • Senior Members
  • Pip
  • 1 posts

Posted 12 January 2017 - 02:47 PM

@hyphop Do you have any detailed instructions about modifying the opi so that it supports i2s? Detailed photos would also be great, i want to try this myself, but its not 100% clear in here.Thanks a lot



#48 doherty

doherty

    Newbie

  • Senior Members
  • Pip
  • 2 posts

Posted 13 January 2017 - 01:28 AM

I can get PCM/I2S playback working on the nanopi neo air but cannot get capture to work. I only get sndhdmi when I arecord -l. 

 

Please help me with his?



#49 starsail0r

starsail0r

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 17 January 2017 - 09:26 PM

in my case, after changes in the fex file and updating script.bin, aplay -l output has 3 devices, regardless of the i2s device being connected or not. I still have no audio output after changing w1_para parameter as suggested. (orange pi one and es9023 : https://www.aliexpre...2672945889.html )

 

any suggestions?

 

(When I attached 5v cable to the 3.3v pin, I heard some random popping sounds but not the pink noise that speaker-test produces.)



#50 markbirss

markbirss

    Member

  • Senior Members
  • PipPip
  • 20 posts

Posted 18 January 2017 - 12:54 PM

You using the correct output device ?

 

Try running this command:

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

This does not output pink noise but a voice saying "Front Left" "Front Right" and repeats

 

 

Dont attach 5v to the 3.3v pin

 

in my case, after changes in the fex file and updating script.bin, aplay -l output has 3 devices, regardless of the i2s device being connected or not. I still have no audio output after changing w1_para parameter as suggested. (orange pi one and es9023 : https://www.aliexpre...2672945889.html )

 

any suggestions?

 

(When I attached 5v cable to the 3.3v pin, I heard some random popping sounds but not the pink noise that speaker-test produces.)



#51 dmoneyblah

dmoneyblah

    Newbie

  • Senior Members
  • Pip
  • 1 posts

Posted 30 January 2017 - 05:11 AM

I have successfully followed this tutorial to get an I2S soundcard (ES9023 TeraDak clone) working on the NanoPi Neo. I had no issues and it worked the first time without surprises on Armbian 5.24. 

 

I did have to clone and compile the sunxi-tools from https://github.com/l...-tools#buildingto get the bin2fex and fex2bin utilities.



#52 Christos

Christos

    Advanced Member

  • Senior Members
  • PipPipPip
  • 198 posts

Posted 31 January 2017 - 12:45 PM

Is there any equivalent information for mainline images?

Or even how to test any available mainline WIP regarding I2S?


__________________________________________________________________________________________________________________

Samsung S5P6818             AllWinner H3                      AllWinner H5       Broadcom BCM2837    AllWinner A64

.  FriendlyArm NanoPi M3    .  FriendlyArm NanoPi NEO v1.1    .  OrangePi PC2    .  RaspberryPi 3    . NanoPi A64

.  Samsung Artik710         .  OrangePi ONE                   .                  .                   .

.                           .  OrangePi PC Plus               .                  .                   .

.                           .  OrangePi PC Plus2E             .                  .                   .


#53 doherty

doherty

    Newbie

  • Senior Members
  • Pip
  • 2 posts

Posted 06 February 2017 - 06:37 AM

I have I2S working fine but now I want to get 4 channels. I would think I will need to use TDM mode. Has anyone been succesful in getting TDM mode for I2S working?



#54 pharmac

pharmac

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 10 February 2017 - 04:52 PM

How can I set i2s function on OrangiPi PC2 (H5) - Armbian_Ubuntu?

#55 Igor

Igor

    Administrator

  • Administrators
  • 3078 posts

Posted 10 February 2017 - 04:58 PM

How can I set i2s function on OrangiPi PC2 (H5) - Armbian_Ubuntu?

 

Warning: nightly downloads are automated untested builds and no end user support is provided for them!


Donate to support Armbian. Thank you! | Use forum not private messaging | Use search before opening new topic | Enjoy!


#56 pharmac

pharmac

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 10 February 2017 - 05:09 PM

Are other H3 Armbian_Ubuntu systems the same?

#57 zador.blood.stained

zador.blood.stained

    Advanced Member

  • Moderators
  • 1838 posts

Posted 10 February 2017 - 05:10 PM

How can I set i2s function on OrangiPi PC2 (H5) - Armbian_Ubuntu?

H5 != H3, and I2S for H5 on mainline is not currently supported. And @Igor's post above can answer the question of where and if it will be added.


Spoiler

#58 Da Alchemist

Da Alchemist

    Advanced Member

  • Senior Members
  • PipPipPip
  • 82 posts

Posted 10 February 2017 - 08:15 PM

How can I set i2s function on OrangiPi PC2 (H5) - Armbian_Ubuntu?

The answer to this question is quite simple. Without soldering you will not get any I2S output, because Dout, PA20 is used for a led. So in my opinion  there is no need to activate this feature.

 

The PC2 is a fantastic Board, if you use the Multichannel HDMI output with the legacy Kernel from Xulong. My PC2 is running as active Crossover and mpd as Streamer. None of the other Oranges support this feature.


  • pharmac likes this

#59 pharmac

pharmac

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 12 February 2017 - 08:16 AM

Thanks Da Alchemist, good advice. I would like to try out the Multichannel HDMI function. However, the reason I asked the question is that the output of the mini board thinks i2s output is high quality sound. Raspberry pie has excellent software such as Volumino, Runeaudio, Moode Audio. All of them can output i2s. However, these software does not support OrangePi. On the other hand, PC Audio has excellent software such as foobar, Jplay, JRiver Media Center (JMC). PC Audio needs combo 384 etc DDC to output USB output i2s. Recently, I was able to introduce JMC for Raspberry to OrangePi PC - Armbian_Debian. Of course, the output is i 2 s. The scheme is as follows.
FLAC file(96 Hz / 24 bit) - OrangePi PC (Armbian_Debian - JMC - PCM 192 Hz / 32 bit i 2 s) - AK 4321 substrate (upsampling to DSD 512) - AK 4497 ​​DAC - AMP - SP
The sound that is output is the excellent!!

I am grateful to those who develop Armbian software.

#60 Igor

Igor

    Administrator

  • Administrators
  • 3078 posts

Posted 12 February 2017 - 09:20 AM

However, these software does not support OrangePi

 

Officially perhaps no, but I guess there must be some community builds. This is what I found with quick Google search:

http://www.orangepi....wthread&tid=191

Since Armbian is a solid base, official builds could be made in the future. I know some people at Volumio and will ping / ask them.


Donate to support Armbian. Thank you! | Use forum not private messaging | Use search before opening new topic | Enjoy!