AnsweredAssumed Answered

Pico i.MX7Dual: I2S  -> can not open pcm_out driver

Question asked by toni1727@gmail.com on May 14, 2019
Latest reply on May 14, 2019 by CarlosCasillas

Good Day iMX community.

 

This question is regarding Android of Things.

 

I'm a little desperate. I2S seems not to work on Pico i.MX7Dual.

 

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());

 

It is not about pins connections (J9: 3,6,10,7), It doesn't matter, connected or unconnected. Same Result

 

I changed the wav format. Same result too.

 

Thank you very much!

Outcomes