I2S amplifier compatibility with Odroid C4

Post Reply
tpeyruse
Posts: 4
Joined: Thu Jun 25, 2020 8:11 pm
languages_spoken: english
ODROIDs: U3, XU4, C4
Has thanked: 1 time
Been thanked: 0
Contact:

I2S amplifier compatibility with Odroid C4

Post by tpeyruse »

Hello,

to add sound output on an embedded robot with ODROID C4, I want to plug an I2S mono amplifier : https://www.adafruit.com/product/3006
This breakout works very well on Raspberry Pi 3+ and I want to plug it on the ODROID C4.
I did the test by following the install process for https://www.hardkernel.com/shop/hifi-shield-2/ but it does not work (not so channel on the small breakout card)

Is it possible to just activate the I2S channel for alsa sound manager ?

Thanks in advance,

User avatar
odroid
Site Admin
Posts: 35591
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1199 times
Been thanked: 877 times
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by odroid »

These users thanked the author odroid for the post:
tpeyruse (Wed Jul 01, 2020 5:33 am)

tpeyruse
Posts: 4
Joined: Thu Jun 25, 2020 8:11 pm
languages_spoken: english
ODROIDs: U3, XU4, C4
Has thanked: 1 time
Been thanked: 0
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by tpeyruse »

I tried the instructions :
I flashed the e-MMC (ubuntu-20.04-4.9-minimal-odroid-c4-20200526.img)
And after here is my log :

Code: Select all

root@odroid:/media/boot# cp meson64_odroidc4.dtb.old meson64_odroidc4.dtb
root@odroid:/media/boot# fdtget /media/boot/meson64_odroidc4.dtb /soc/audiobus@0xFF660000/tdm@1 status
okay
root@odroid:/media/boot# fdtput -t s /media/boot/meson64_odroidc4.dtb /soc/audiobus@0xFF660000/tdm@1 status "okay"
root@odroid:/media/boot# fdtget /media/boot/meson64_odroidc4.dtb /soc/audiobus@0xFF660000/tdm@1 status
okay
root@odroid:/media/boot# fdtget /media/boot/meson64_odroidc4.dtb /soc/cbus@ffd00000/i2c@1d000 status
okay
root@odroid:/media/boot# fdtput -t s /media/boot/meson64_odroidc4.dtb /soc/cbus@ffd00000/i2c@1d000 status "okay"
root@odroid:/media/boot# fdtput -t s /media/boot/meson64_odroidc4.dtb /soc/cbus@ffd00000/i2c@1d000/pcm5242 status "okay"
root@odroid:/media/boot# fdtget /media/boot/meson64_odroidc4.dtb /soc/cbus@ffd00000/i2c@1d000 status
okay
root@odroid:/media/boot# fdtget /media/boot/meson64_odroidc4.dtb /soc/cbus@ffd00000/i2c@1d000/pcm5242 status
okay

REBOOT

root@odroid:~# fdtget /media/boot/meson64_odroidc4.dtb /odroid_hifi2 status
disabled
root@odroid:~# fdtput -t s /media/boot/meson64_odroidc4.dtb /odroid_hifi2 status "okay"
root@odroid:~# fdtget /media/boot/meson64_odroidc4.dtb /odroid_hifi2 status
okay

REBOOT

root@odroid:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ODROIDHDMI [ODROID-HDMI], device 0: SPDIF-dit-hifi dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Unfortunately, I only have one sound card when executing "aplay -l"

I wish this can help.

User avatar
odroid
Site Admin
Posts: 35591
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1199 times
Been thanked: 877 times
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by odroid »

You should follow HiFi-shield & HiFi-Shield+ guide instead of HiFi-shield2.
Revert the backup dtb file and follow the correct instruction.

tpeyruse
Posts: 4
Joined: Thu Jun 25, 2020 8:11 pm
languages_spoken: english
ODROIDs: U3, XU4, C4
Has thanked: 1 time
Been thanked: 0
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by tpeyruse »

I did the process of Hifi-Shield

Code: Select all

 
fdtput -t s /media/boot/meson64_odroidc4.dtb /odroid_hifi status "okay"
fdtget /media/boot/meson64_odroidc4.dtb /odroid_hifi status
okay

reboot
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ODROIDHDMI [ODROID-HDMI], device 0: SPDIF-dit-hifi dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: ODROIDHIFI [ODROID-HIFI], device 0: TDM-B-pcm5102a-hifi multicodec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
I can play a .wav sound with aplay. Thank you for your help.
But the volume is 100% Is there a way to pilot the volume ?
I have to play .wav and .mp3 sound in command line via Python. So nothing complicated about sound processing.

User avatar
odroid
Site Admin
Posts: 35591
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1199 times
Been thanked: 877 times
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by odroid »

I don't know well about the ALSA control. I just guess you might need a pulse-audio package for the digital volume control.
I hope other Linux audio experts can help you.

gkkpch
Posts: 318
Joined: Mon Feb 25, 2013 11:47 pm
languages_spoken: english, dutch, german
ODROIDs: Odroid N2, Odroid C2, Odroid XU4, Odroid-C1+, Odroid-C1, Odroid-X2, HiFi Shield, HiFi Shield+, HiFi Shield 2
Location: Switzerland
Has thanked: 2 times
Been thanked: 9 times
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by gkkpch »

HiFi Shield/ Shield plus do not have hardware volume control.
Only Shield 2 has.
Workaround (with quality loss) is to use software volume control with e.g. mpd

AFUN
Posts: 6
Joined: Sun Oct 02, 2016 12:43 am
languages_spoken: english german
ODROIDs: C2 C4
Has thanked: 0
Been thanked: 0
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by AFUN »

I can't get my HiFi Shield Plus back to work on C4, even though it still worked yesterday with my old C2.
I run Kernel 4.9.236 and i followed the instructions and set

Code: Select all

fdtput -t s /media/boot/meson64_odroidc4.dtb /soc/audiobus@0xFF660000/tdm@1 status "okay"
fdtput -t s /media/boot/meson64_odroidc4.dtb /pcm5102a status "okay"
fdtput -t s /media/boot/meson64_odroidc4.dtb /odroid_hifi status "okay"
Every fdtget is okay, but the result is:

root@odroid:/home/odroid# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ODROIDHDMI [ODROID-HDMI], device 0: SPDIF-dit-hifi dit-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

Remark: I had to copy /boot/amlogic/meson64_odroidc4.dtb to /media/boot because the original file from the flashed image did not contain pcm5102a and odroid_hifi
What can be wrong?

AFUN
Posts: 6
Joined: Sun Oct 02, 2016 12:43 am
languages_spoken: english german
ODROIDs: C2 C4
Has thanked: 0
Been thanked: 0
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by AFUN »

dmesg output:

Code: Select all

[    4.429227] asoc-aml-card odroid_hdmi: dit-hifi <-> SPDIF mapping ok
[    4.429730] asoc-aml-card odroid_hifi: aml_card_dai_link_of: Can't find aml-audio-card,codec DT node
[    4.429733] asoc-aml-card odroid_hifi: aml_card_probe, aml_card_parse_of error -22 
[    4.429743] asoc-aml-card: probe of odroid_hifi failed with error -22

joshua.yang
Posts: 453
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 28 times
Been thanked: 113 times
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by joshua.yang »

AFUN wrote:
Sun Oct 11, 2020 5:46 am
dmesg output:

Code: Select all

[    4.429227] asoc-aml-card odroid_hdmi: dit-hifi <-> SPDIF mapping ok
[    4.429730] asoc-aml-card odroid_hifi: aml_card_dai_link_of: Can't find aml-audio-card,codec DT node
[    4.429733] asoc-aml-card odroid_hifi: aml_card_probe, aml_card_parse_of error -22 
[    4.429743] asoc-aml-card: probe of odroid_hifi failed with error -22
Hi,

Sorry for your inconvenience.
Could you try the DTBO file for HifiShield?

Open /media/boot/config.ini file and find this part. Then add a new profile then change the value of overlay_profile.
So finally it looks like this.

Code: Select all

; Device Tree Overlay
overlay_resize=16384
overlay_profile=hifishield
overlays="spi0 i2c0 i2c1 uart0"

[overlay_custom]
overlays="i2c0 i2c1"

[overlay_hktft32]
overlays="hktft32"

[overlay_hktft35]
overlays="hktft35"

[overlay_hifishield]
overlays="hifishield"
It exactly will run in the same way on HifiShield 2. Just replace that hifishield part with hifishield2.
You can check out what DTBO files provided by listing /media/boot/amlogic/overlays/odroidc4.

For someone who doesn't have the latest kernel, please update the kernel and booting things first.

Code: Select all

sudo apt install linux-odroid-c4 bootini u-boot
If you still have the problem, please try out with the fresh installed Ubuntu image. If it doesn't work, please let us know. :)

AFUN
Posts: 6
Joined: Sun Oct 02, 2016 12:43 am
languages_spoken: english german
ODROIDs: C2 C4
Has thanked: 0
Been thanked: 0
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by AFUN »

Thank you! The overlay works for me! :D

User avatar
odroid
Site Admin
Posts: 35591
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1199 times
Been thanked: 877 times
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by odroid »

Thank you for the confirmation.
We will update the wiki page.

joshua.yang
Posts: 453
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 28 times
Been thanked: 113 times
Contact:

Re: I2S amplifier compatibility with Odroid C4

Post by joshua.yang »

I have updated the wiki page to use the DTBO way. :)

https://wiki.odroid.com/accessory/sound ... _odroid-c4
These users thanked the author joshua.yang for the post:
odroid (Wed Oct 14, 2020 6:47 pm)

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 0 guests