Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pico i.MX7d: I2S doesn't work

21 views
Skip to first unread message

Toni

unread,
May 16, 2019, 4:46:30 AM5/16/19
to
I'm a little desperate.

I2S seems not to work.

If I try to play a sound with audioTrack. In the raspberry pi 3 it works without problems, but if I execute it in imx7d it gives me the following error:

audio_hw_primary: card 0, port 0 device 0x1000000

audio_hw_primary: rate 48000, channel 2 period_size 0xc0

audio_hw_primary: can not open pcm_out driver 0: can not set hw params: Invalid argument

The same thing happens with an i2s microphone

This is the code:


final AudioDeviceInfo audioOuputDevice = findAudioDevice(AudioManager.GET_DEVICES_OUTPUTS, AudioDeviceInfo.TYPE_BUS);

int mBufferSize = AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);

AudioFormat audioOutputFormat = new AudioFormat.Builder()
.setChannelMask(AudioFormat.CHANNEL_IN_MONO)
.setEncoding(AudioFormat.ENCODING_PCM_16BIT)
.setSampleRate(44100)
.build();

audioTrack = new AudioTrack.Builder()
.setAudioFormat(audioOutputFormat)
.setBufferSizeInBytes(mBufferSize * 2)
.setTransferMode(AudioTrack.MODE_STREAM)
.build();

audioTrack.setPreferredDevice(audioOuputDevice);
audioTrack.setPlaybackRate(44100);
audioTrack.setVolume(AudioTrack.getMaxVolume());
0 new messages