I bought a DAC MAX98357A to convert I2S signal to analog signal for a speaker.
Can I output the audio to I2S pins on VIM3 under Ubuntu ?
Thank you very much
I bought a DAC MAX98357A to convert I2S signal to analog signal for a speaker.
Can I output the audio to I2S pins on VIM3 under Ubuntu ?
Thank you very much
I found out how to do it correctly so here you are:
To connect MAX98357A <–> Khadas:
Do aplay -l
to find out the device number correspond to i2s:
**** List of PLAYBACK Hardware Devices ****
card 0: AMLAUGESOUND [AML-AUGESOUND], device 0: SPDIF-B-dit-hifi-alsaPORT-spdif-b dit-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: AMLAUGESOUND [AML-AUGESOUND], device 1: TDM-A-dummy-alsaPORT-pcm multicodec-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: AMLAUGESOUND [AML-AUGESOUND], device 2: TDM-B-dummy-alsaPORT-i2s multicodec-2 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: AMLAUGESOUND [AML-AUGESOUND], device 3: TDM-C-dummy multicodec-3 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: AMLAUGESOUND [AML-AUGESOUND], device 4: SPDIF-dit-hifi-alsaPORT-spdif dit-hifi-4 []
Subdevices: 1/1
Subdevice #0: subdevice #0
speaker-test -Dhw:0,2 -t wav
to play test soundsox input.wav -b16 output.wav
sox input.wav onechannel.wav remix 1 # 1 for left channel and 2 for right channel
speaker-test -Dhw:0,2 -c 2 -t wav -w input.wav
Can anyone answer my following questions:
Is there any DAC pins on 40-pin header that we can use to connect to 2 pins of speaker directly ?
And what are those other device on the aplay -l
list ?
Thank you very much
@ptphucbk take a look at the GPIO pins: https://docs.khadas.com/vim3/GPIOPinout.html
Is there any DAC pins on 40-pin header that we can use to connect to 2 pins of speaker directly ?
I don’t think there are any real DAC pins but maybe you can output audio with the PWM pin 35 like the Arduino does? Arduino isn’t intended to do real audio stuff neither has audio outputs but people manage to get decent audio out from PWM pins. Maybe Khadas staff can help you with that question.
And what are those other device on the
aplay -l
list ?
Take a look at Odroid N2 webpage: https://wiki.odroid.com/odroid-n2/application_note/sound
They have good explanations there about the aplay devices list.
So I would say:
Now, I’m not sure about devices 1 and 3, can anyone from Khadas confirm? They seem like dummy devices for ALSA testing purposes.
Were you successful playing the audio through I2S?
@numbqq thanks for the clarification! Does that mean then that any DAC can be connected to I2S without having to write an ALSA driver for it? Or in order for apps to use the DAC as a soundcard the ALSA driver is required?
Yes, you can connect to the I2S from 40 PIN herader and use device 2
to control it.
Amazing, appreciated
Thank you for your answer. I will checkout audio output by PWM.
I did successfully play the audio through I2S as I described in my second reply in this thread. You can use the pcm example here to output audio and control volume by scaling your data send to I2S.
Hello,
Any Idea on how to make it it work using the 5.16 kernel?, since it show only one device.
card 0: KHADASVIM3 [KHADAS-VIM3], device 0: fe.dai-link-0 (*) []
Subdevices: 0/1
Subdevice #0: subdevice #0
And there are much more options in alsamixer than when using the vendor kernel.
Thanks!