Getting SPDIF output on a Khadas VIM2 running recently compiled LE firmware

  • I'm trying to get SPDIF output to connect it to some SONY receiver (having both coax and optical SPDIF-in, checked it with some other LE device (Orange Pi PC)) on the PIN 13 officially labelled "SPDIF" in the documentation. I hope to get this done through:

    Any ideas, what I'm missing? Using the cloned source for version 12.

    Edited once, last by ds000 (March 5, 2025 at 12:11 PM).

  • It's funny when a patch looks like this:

    In other words, these are not compiled into dtb by default, because you have to manually uncomment the option you want.
    So this patch needs another patch, or this patch needs to be modified.

  • Yes, you are right (just looked at the "//" and commented the first two options with those) :) I simply overlooked the good old C comments (/* ... */). Will try this and report back.

  • The BlackCatDevel0per patch with pinctrl-0 = <&spdif_out_h_pins>; uncommented in the &aiu node looks complete to me.

    ACODEC (Analog CODEC) is used for the 3.5mm jack present on Android boxes. You shouldn't need any of that for a VIM2 board.

    Are you using the Khadas DAC board or trying to wire pins from the GPIO header?

  • Ah, good to know: There is no 3.5mm jack on the VIM2, so I will revert the change. I'm directly connecting the coax via the two PINs 13, 14 on the 40pin connector.

  • Did the recompile with the third option properly commented out (a colleague explained to me, that the overlay should have enabled the output already, independently of the patch, though). No change/no output.

    LibreELEC:~/root # aplay -l
    **** List of PLAYBACK Hardware Devices **** 
    card 0: KHADASVIM2 [KHADAS-VIM2], device 0: fe.dai-link-0 (*) [] 
     Subdevices: 0/1 
     Subdevice #0: subdevice #0

    There is no special device for SPDIF (different on my Orange Pi PC/H3)!? To get some output, I had to switch the third column (right most one) from SPDIF (nothing to hear) to I2S (proper audio output). No idea how to configure it to make this default, or run it via command line non-interactively!?


  • I forget the exact command, but you can change mixer config with "amixer sset" commands. On boot the soundconfig script is run by udev (which provides the card device as the $0 variable), see:

    LibreELEC.tv/packages/audio/alsa-utils/scripts/soundconfig at master · LibreELEC/LibreELEC.tv
    Just enough OS for KODI. Contribute to LibreELEC/LibreELEC.tv development by creating an account on GitHub.
    github.com

    You cannot overwrite the soundconfig script as it's embedded in the read-only part of the OS, but you can create an autostart.sh script to run a command to change the mixer controls on boot, or (better, as it supports more precise scheduling) a systemd service that runs the command before Kodi starts.