i.MX8M Mini aplay can't the file recorded by PDM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8M Mini aplay can't the file recorded by PDM

2,055 Views
m_c
Senior Contributor I

PDM record always constrains sample rate at 22.05KHz when 24KHz,.
root@imx8mmevk:/usr# arecord -d 10 -Dhw:1,0 -r 24000 -f S16_LE -c 6 > aaaa.wav
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 24000 Hz, Channels 6
Warning: rate is not accurate (requested = 24000Hz, got = 22050Hz)
please, try the plug plugin

So try do some code modifications to let it works at 24KHz.
1. Set to default: #define MICFIL_CTRL2_OSR_DEFAULT (0 << MICFIL_CTRL2_CICOSR_SHIFT)
2. Add 24000 to support rate in imx_micfil.c
3. Add 24000 to snd_pcm_known_rates in pcm_native.c

Then set to the high quality and each CHx Gain to 15. After that, it can correctly record by 24KHz sampling rate and PDM clock is at 3.072MHz as the enclosed. But these modification make a side effect on “aplay”:
root@imx8mmevk:/usr# aplay -Dhw:2,0 -r 48000 -f S16_LE -c 2 1K_Hz_Left_48kHz.wav
Playing WAVE '1K_Hz_Left_48kHz.wa[ 172.932484] fsl-sai 30030000.sai: failed to derive required Tx rate: 1411200
v' : Signed 16 bit Little Endian,[ 172.942220] fsl-sai 30030000.sai: ASoC: can't set 30030000.sai hw params: -22
Rate 48000 Hz, Stereo
Warning: rate is not accurate (requested = 48000Hz, got = 44100Hz)
please, try the plug plugin
aplay: set_params:1403: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (92879 92880)
PERIOD_SIZE: 4096
PERIOD_BYTES: 16384
PERIODS: 4
BUFFER_TIME: (371519 371520)
BUFFER_SIZE: 16384
BUFFER_BYTES: 65536
TICK_TIME: 0

Why the above aplay command exit right away and can't play?

Labels (1)
0 Kudos
Reply
1 Reply

1,678 Views
joanxie
NXP TechSupport
NXP TechSupport

pls refer to the document as below:

https://community.nxp.com/docs/DOC-343059