Board: i.MX8MPLUSLPD4-EVK (8MPLUS-BB base board)
attach an external I2S MEMS microphone (Knowles SPH0645LM4H) to SAI5,
using the SoC-side pins that are physically routed to the J21 (EXP_CN)
expansion header via level shifters U57/U58, per the base board schematic
(SPF-46370).
1. Hardware wiring (confirmed against schematic, verified on scope)
SPH0645 BCLK -> J21 pin 40 ("PDM_CLK", SoC pad SAI5_RXC)
SPH0645 LRCL -> J21 pin 32 ("PWM4_3V3", SoC pad SAI5_RXFS)
SPH0645 DOUT -> J21 pin 38 ("PDM_STREAM_0", SoC pad SAI5_RXD0)
SPH0645 SEL -> GND (left channel)
SPH0645 3V -> J21 pin 1
SPH0645 GND -> J21 pin 6
We are trying to connect an external I2S MEMS microphone (SPH0645) to
SAI5, wired to the J21 expansion header (BCLK -> SAI5_RXC, LRCL ->
SAI5_RXFS, DOUT -> SAI5_RXD0, confirmed against the 8MPLUS-BB schematic
and verified on oscilloscope).
We are facing this issue and need help resolving it:
The sound card registers correctly:
root@imx8mp-lpddr4-evk:~# arecord -l
card 2: sph0645audio [sph0645-audio], device 0: ...
But recording fails with a clock error:
root@imx8mp-lpddr4-evk:~# arecord -D hw:CARD=sph0645audio,DEV=0 \
-f S16_LE -r 48000 -c 1 mic.wav
[ 140.950940] fsl-sai 30c50000.sai: failed to derive required Rx rate: 3072000
[ 140.958042] fsl-sai 30c50000.sai: ASoC: error at snd_soc_dai_hw_params on 30c50000.sai: -22
arecord: set_params:1435: Unable to install hw params
Checking clk_summary shows sai5 is still deriving from the 24MHz
oscillator rather than the audio PLL:
sai_pll_out_div2 0 0 50000 Y 0 0 0 24576000
sai5 0 0 50000 N 0 0 0 24000000
sai5_root 0 0 50000 N 0 0 0 24000000
Our current &sai5 node:
&sai5 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai5>;
assigned-clocks = <&clk IMX8MP_CLK_SAI5>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
fsl,sai-mclk-direction-output;
fsl,sai-asynchronous;
fsl,dataline = <0 0x1 0x0>;
status = "okay";
};
pinctrl_sai5: sai5grp {
fsl,pins = <
MX8MP_IOMUXC_SAI5_RXFS__AUDIOMIX_SAI5_RX_SYNC 0xd6
MX8MP_IOMUXC_SAI5_RXC__AUDIOMIX_SAI5_RX_BCLK 0xd6
MX8MP_IOMUXC_SAI5_RXD0__AUDIOMIX_SAI5_RX_DATA00 0xd6
>;
};
We also disabled &micfil and &pwm4, since their pinctrl groups share the
same physical pads as SAI5_RXC/RXD0/RXFS on this board.
How do we correctly route SAI5's clock through the audio PLL so it can
derive 3072000 Hz (48kHz) instead of sitting on the 24MHz oscillator
path?
Also attached the some images for your reference.
Thank you.
IMG_8200.jpegIMG_8200.jpeg
IMG_8205.jpegIMG_8205.jpeg
preview.jpgpreview.jpg
preview (1).jpgpreview (1).jpg
Hello,
I suggest you try with the next configuration:
&sai5 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai5>;
assigned-clocks = <&clk IMX8MP_CLK_SAI5>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI5_IPG>, <&clk IMX8MP_CLK_DUMMY>,
<&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI5_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
<&clk IMX8MP_CLK_DUMMY>, <&clk IMX8MP_AUDIO_PLL1_OUT>,
<&clk IMX8MP_AUDIO_PLL2_OUT>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k", "pll11k";
fsl,sai-asynchronous;
fsl,dataline = <0 0x1 0x0>;
status = "okay";
};
Without the clocks/clock-names binding, the driver falls back to the 24 MHz oscillator. Also, there is no need of fsl,sai-mclk-direction-output property if you are not connecting it to the microphone.
Best regards.