Jump to content

MXQ RK322X as audiophile music box


Hai Nguyen

Recommended Posts

 

Instead of using Volumio or Daphile, I installed Armbian_21.05.1_Rk322x-box_buster_legacy_4.4.194 to a MXQ Pro box. The box was shipped with Android 7, and I installed Devinfo to check if it is eMMC or NAND. It is lucky that my box equipped with eMMC, so I installed the OS easily. After that, I did some following steps:

1-     Run rk322x-config: I select CPU 3228B-1.4 Ghz, board 322x MXQ, wifi ssv6X5X

2-     Run nmtui to setup wifi connection

3-     Armbian-config: to add something such as infra red

4-     Set default sound card:

hai@rk322x-box:/etc$ aplay -l

**** List of PLAYBACK Hardware Devices ****

card 0: DWI2SHDMI [DW-I2S-HDMI], device 0: 100c0000.i2s0-i2s-hifi i2s-hifi-0 []

  Subdevices: 1/1

  Subdevice #0: subdevice #0

card 1: SPDIF [SPDIF], device 0: 100d0000.spdif-dit-hifi dit-hifi-0 []

  Subdevices: 1/1

  Subdevice #0: subdevice #0

card 2: DAC [USB Audio DAC], device 0: USB Audio [USB Audio]

  Subdevices: 1/1

  Subdevice #0: subdevice #0

card 3: ANALOG [ANALOG], device 0: 100b0000.i2s1-rk3228-hifi rk3228-hifi-0 []

  Subdevices: 1/1

  Subdevice #0: subdevice #0

It means that my USB Audio DAC is card 2.

I revised /etc/asound.conf to make it contain only 2 lines

defaults.ctl.card 2

defaults.pcm.card 2

You can verify with alsamixer : it should display USB DAC as default.

5-     Install mpd and edit /etc/mpd.conf

# I will use usbstick to store the songs

music_directory         "/mnt/usb"

#you can set static IP for music server or add “any” as the address

bind_to_address         "any"

The other lines can be left as default

6-     Automount USB

Edit /etc/fstab to add the following line

 UUID=689E-CF4D /mnt/usb vfat defaults 0 0

Youn can find your usbstick UUID with sudo blkid

7-     The most difficult section is configuring infra red. Now lirc and /dev/lirc0 have been obsolate. We will have to deal with gpio_ir_recv (you can check with lsmod)

There are 2 steps here:

a-     Map the key name with keycode of your remote controller.

b-     Config a daemon to do the action you want while received the keycode.

At first, you should know which device is belong to your ir receiver.

hai@rk322x-box:/dev/input$ ll /dev/input/by-path/

total 0

lrwxrwxrwx 1 root root 9 May 21 21:17 platform-200a0000.hdmi-event-mouse -> ../event0

lrwxrwxrwx 1 root root 9 May 21 21:17 platform-30120000.usb-usb-0:1:1.2-event -> ../event2

lrwxrwxrwx 1 root root 9 May 21 21:17 platform-gpio-keys-event -> ../event1

lrwxrwxrwx 1 root root 9 May 21 21:17 platform-ir-receiver-event-mouse -> ../event3

In this case, /dev/input/event3 is my ir

And then I can run this command to check ir code:

hai@rk322x-box:/dev/input$ ir-keytable --device /dev/input/event3 -t -v

Opening /dev/input/event3

Input Protocol version: 0x00010001

Testing events. Please, press CTRL-C to abort.

1845.720102: event type EV_MSC(0x04): scancode = 0x113

1845.720102: event type EV_SYN(0x00).

^C

It will wait for you to push a RC button and show the code (0x113). After that, you can create a file to map keyname with keycode. I edited /lib/udev/rc_keymaps/samsung.toml

[[protocols]]

name = "samsung"

protocol = "nec"

variant = "nec"

[protocols.scancodes]

0x140= "KEY_POWER"

There are many *.toml files in the same directory, you can refer them to find the correct keynames.

Next, to make it consitent, you can edit /etc/rc_maps.cfg (its header guided you very clearly)

Add this line: gpio_ir_recv * /lib/udev/rc_keymaps/samsung.toml

 

Regarding step b, you should install triggerhappy.  

To config it is very easy. Just create a file under /etc/triggerhappy/triggers.d (any filename)

My file contains only one line: KEY_POWER 1 /usr/sbin/init 0 (use key power to shutdown the box)

 

Finally, you can test

sudo  ir-keytable -c -w /lib/udev/rc_keymaps/samsung.toml --device /dev/input/event3

Old keytable cleared

Wrote 1 keycode(s) to driver

sudo thd --trigger /etc/triggerhappy/triggers.d/ /dev/input/event3

 

If it can work well, you just need to reboot the box!

 

Important note: If you use MXQ as an audiophile music box, you must connect it to a linear power supply. Never use its equipped power adapter or any other pulse power supply.

 

Link to comment
Share on other sites

Thanks very much for this success and cool story! :thumbup:

I will point it from the rk322x big thread as an interesting way to handle both sound/alsa configuration and rc configuration.

 

I underline the need for a linear quality power supply to get high quality output from the connected USB audio device. Maybe connecting a separate DAC with coaxial SPDIF coming out from the box may decouple the two devices so the box could be powered by its own power adapter and only the DAC requires a high quality power supply, but I'm not sure though because coaxial still shares the common ground and it's up to the DAC to have an insulated SPDIF input. Optical SPDIF (never seen any on rk322x boxes) has no such problem though.

Link to comment
Share on other sites

Thanks for the write-up! I have my MXQ running as a server without a GUI desktop environment. I, too, would like to use it to play audio. However, when I enter alsamixer I am greeted by the message "This sound device does not have any controls".

 

I have been looking around and all I could find is that it seems to have to do something with the controls missing. I tried setting-up a softvol without success and ended up giving up after some time.

 

Do you know how to enable ALSA mixer?

Link to comment
Share on other sites

2 hours ago, hardheid said:

Thanks for the write-up! I have my MXQ running as a server without a GUI desktop environment. I, too, would like to use it to play audio. However, when I enter alsamixer I am greeted by the message "This sound device does not have any controls".

 

I have been looking around and all I could find is that it seems to have to do something with the controls missing. I tried setting-up a softvol without success and ended up giving up after some time.

 

Do you know how to enable ALSA mixer?

The alsamixer is right, the devices have no hardware controls, so volume must be controlled from the source player.

A sound server like pulseaudio can do all the mixing and volume control though.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines