rasperry pi compatible i2s sound card

I purchased a raspiaudio mix+ sound card which uses I2S, but have been unable to get it to work, it’s based on the NXP1334A chip. Does anyone know how to accomplish this?

Hello!

Are you referring to the Raspiaudio Audio+ or Mic+ HAT? The Audio+ appears to use the NXP1334A, but the Mic+ appears to be based upon the TI PCM5102a (because the setup appears to use the hifiberry-dac-overlay.dts).

To use this board with the Jetson Nano you need to …

  1. Configure the pins on the 40-pin header for I2S. There is a thread you can refer to on how to
    do this [0].

  2. Most codecs have two interfaces; one for control (via I2C/SPI) and one for audio (I2S). However, looking at both the NXP1334A and PCM5102a, neither have a control interface and there is only an I2S interface, which makes things a lot simpler and once the pins are configured should work. You should be to test by running the following commands …

Tone test:

speaker-test -D hw:tegrasndt210ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500

WAV file test:

aplay -D hw:tegrasndt210ref,0 <wavfile>

Regards,
Jon

[0] https://devtalk.nvidia.com/default/topic/1051776/jetson-nano/enabling-i2s-audio-output-on-40-pin-connector/

Does this have to be flashed using the SDK? I tried simply copying the dtb file to /boot but it didn’t work.

Hello!

Yes it needs to be flashed.

Regards,
Jon

yes, i tried flashing it and it worked. I then tried another SD card in that machine and it failed. What files does it change? Are they hidden partitions on the SD card? on the MMC?, on the board, or in the /boot directory of the SD card. I have a whole ecosystem built up on other SD cards and it would be nice if I did’t have to reinstall, and rebuild each time. I’d like to just copy from the working SD card to my other SD cards.

Hello!

Yes right now it needs to be flashed as the DTB resides on its own partition. We are working to improve this and hopefully in a future release it will be possible to place the DTB in the /boot directory and have the extlinux.conf script load it from there.

Regards,
Jon

The I2S interface doesn’t seem to work with the ALSA volume controls. Any Idea how to set the volumes for this card (which you correctly stated is based on the PCM5102a)?

Hello!

By the ALSA volume controls, do you mean via the Ubuntu desktop ‘Sound Settings’ menu? The PCM5102a does not have a hardware volume control and so the volume control is handled via software. I have tested a couple codecs (RT5658 and SGTL5000) and can hear the volume increase and decrease as the volume in changed under the sound settings. You should also see the volume level change for the sink ‘alsa_output.platform-sound.analog-stereo’ when executing …

$ pacmd list-sinks

...

 * index: 1
        name: <alsa_output.platform-sound.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: IDLE 
        priority: 9009
        volume: front-left: 34150 /  52% / -16.99 dB,   front-right: 34150 /  52% / -16.99 dB
                balance 0.00
...

$ pacmd list-sinks

...

  * index: 1
        name: <alsa_output.platform-sound.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: IDLE 
        priority: 9009
        volume: front-left: 19171 /  29% / -32.03 dB,   front-right: 19171 /  29% / -32.03 dB
                balance 0.00

Regards,
Jon

I read the Linux_Tegra_Driver_package_development_guide and boy was I confused. Gone are the days where you simply built a Kernel Module and away you went. Now I have no idea what’s going on. The Alsamixer does not show a volume control for the tegrasndt210ref devices, but the GUI sound control seems to control the playback volume. The arecord -l lists a whole bunch of devices: ADMAIFI-0 - 9, but I have no idea what these devices really are. So some very simple questions:

  1. How do I set the record volume from the command line?
  2. How do I set the play volume from the command line?

Hello!

Yes the audio configuration can be quite involved, but the benefit is that it is very flexible and allow us to route the audio through various components in the Audio Processing Engine (APE). The ADMAIF is the DMA interface to the APE and for Tegra210 there are 10. Hence, this is why you see ADMAIF0-9 in the aplay/arecord device list. Using amixer control we can then route the audio within the APE to different components. By default ADMAIF1 is connected directly to I2S4 for I2S playback which is the simplest configuration …

$ amixer -c tegrasndt210ref cget name='I2S4 Mux'

So there are potentially two ways to do volume control …

  1. Tegra APE using the Master Volume Control (MVC)

For playback route the audio from ADMAIF1 to MVC to I2S4 …

$ amixer -c tegrasndt210ref cset name='I2S4 Mux' MVC1
$ amixer -c tegrasndt210ref cset name='MVC1 Mux' ADMAIF1

Set the volume from 0 - 16000. For example to set to 50% …

$ amixer -c tegrasndt210ref cset name='MVC1 Vol' 8000

Check the volume with …

$ amixer -c tegrasndt210ref cget name='MVC1 Vol'

For capture you would …

$ amixer -c tegrasndt210ref cset name='ADMAIF1 Mux' MVC2
$ amixer -c tegrasndt210ref cset name='MVC2 Mux' I2S4

Set the volume from 0 - 16000. For example to set to 50% …

$ amixer -c tegrasndt210ref cset name='MVC2 Vol' 8000
  1. Use pulseaudio to control the volume

Set the playback volume to 50% …

$ pacmd set-sink-volume alsa_output.platform-sound.analog-stereo 0x8000

Check the volume with …

$ pacmd list-sinks

Set the capture volume to 50% …

$ pacmd set-source-volume alsa_output.platform-sound.analog-stereo 0x8000

Check the volume with …

$ pacmd list-sources

This 2nd option is equivalent to controlling the volume via the GUI.

Regards,
Jon

Thank You, for the first time, I am able to record, play and set the record and play volumes using the RASPIAUDIO card. All it took was two solid weeks for trying and your help.

Hi John. i tried to put the dtb file in the installation but i’m lossing the HDMI when i install it.
Could you provide me some recommendation to solve it?

Hello!

What Jetpack/L4T release are you using? I know that the DTB no longer works with the latest release …

https://devtalk.nvidia.com/default/topic/1049674/jetson-nano/audio-i2s-on-40-pin-connector/post/5373293/#5373293

Jon

With the Jetpack 4.2.1 the last…