Skip to main content
Visitor II
October 22, 2024
Question

problem to play Audio with Rate 22050Hz & 44100Hz on STM32MP257F board

  • October 22, 2024
  • 1 reply
  • 1066 views

Hi ST Team,

We have developed a board based on the STM32MP257F. Currently, I am focusing on the audio section. We use an I2S port to connect to a codec called ES8388 chip. You can find the schematic in the attached picture,

Nicky_0-1729586990523.png

the connection between ES8388 and STM32MP25 like the following path,

I2S2_MCK --- PI15
I2S2_CK    --- PB0
I2S2_SDO --  PK1
I2S2_WS ---   PI14
I2S2_SDI ---   PB6

I modified the dts, like the following code show,

 

 

/ {
 es8388: es8388@11 {
 compatible = "everest,es8388";
 reg = <0x11>;
 #sound-dai-cells = <0>;
 clocks = <&i2s2>; /* The codec is a consumer of I2S2 master clock */
 clock-names = "MCLK"; /* Feed MCLK codec clock with I2S2 master clock provider */
 status = "okay";

 ports {
 #address-cells = <1>;
 #size-cells = <0>;

 port@0 {
 reg = <0>;
 es8388_in: endpoint {
 remote-endpoint = <&i2s2_endpoint>;
 };
 };
 };

 };
};

&i2s2_pins_a {
 pins1 {
 pinmux = <STM32_PINMUX('K', 1, AF2)>, /* I2S2_SDO */
 <STM32_PINMUX('B', 6, AF2)>, /* I2S2_SDI */
 <STM32_PINMUX('I', 14, AF2)>, /* I2S2_WS */
 <STM32_PINMUX('B', 0, AF2)>, /* I2S2_CK */
 <STM32_PINMUX('I', 15, AF2)>; /* I2S2_MCK */
 slew-rate = <1>;
 drive-push-pull;
 bias-disable;
 };
};

&i2s2_sleep_pins_a {
 pins {
 pinmux = <STM32_PINMUX('K', 1, ANALOG)>, /* I2S2_SDO */
 <STM32_PINMUX('B', 6, ANALOG)>, /* I2S2_SDI */
 <STM32_PINMUX('I', 14, ANALOG)>, /* I2S2_WS */
 <STM32_PINMUX('B', 0, ANALOG)>, /* I2S2_CK */
 <STM32_PINMUX('I', 15, ANALOG)>; /* I2S2_MCK */
 };
};

&i2s2 {
 #clock-cells = <0>; /* Set I2S2 as master clock provider */
 pinctrl-names = "default", "sleep";
 pinctrl-0 = <&i2s2_pins_a>;
 pinctrl-1 = <&i2s2_sleep_pins_a>;
 status = "okay";

 i2s2_port: port {
 i2s2_endpoint: endpoint {
 remote-endpoint = <&es8388_in>;
 format = "i2s";
 mclk-fs = <256>; /* Set mclk/fs radio. (256 or 512)*/
 };
 };
};
&i2c2 {
 es8388: es8388@11 {
 compatible = "everest,es8388";
 reg = <0x11>;
 #sound-dai-cells = <0>;
 clocks = <&i2s2>; /* The codec is a consumer of I2S2 master clock */
 clock-names = "MCLK"; /* Feed MCLK codec clock with I2S2 master clock provider */
 status = "okay";

 ports {
 #address-cells = <1>;
 #size-cells = <0>;

 port@0 {
 reg = <0>;
 es8388_in: endpoint {
 remote-endpoint = <&i2s2_endpoint>;
 };
 };
 };

 };
};

 

 

I rebuilt the kernel and download it to board, I can recognized the audio card by using "aplay -l" command and also can play audio with rate 16000Hz,

 

 

root@stm32mp2:~# aplay test1.wav
Playing WAVE 'test1.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono

 

 

but when I play one audio with rate 22050Hz, the error occured,

 

 

root@stm32mp2:~# aplay test2.wav
Playing WAVE 'test2.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
[ 198.334255] st,stm32-i2s 400b0000.audio-controller: Failed to find an accurate rate
[ 198.336312] st,stm32-i2s 400b0000.audio-controller: ASoC: error at snd_soc_dai_set_sysclk on 400b0000.audio-controller: -22
[ 198.347840] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at snd_soc_link_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22
[ 198.361021] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at __soc_pcm_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22
[ 203.384524] st,stm32-i2s 400b0000.audio-controller: Failed to find an accurate rate
[ 203.386627] st,stm32-i2s 400b0000.audio-controller: ASoC: error at snd_soc_dai_set_sysclk on 400b0000.audio-controller: -22
[ 203.398530] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at snd_soc_link_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22
[ 203.411318] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at __soc_pcm_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22

 

 

and rate 44100hz also has error,

 

 

root@stm32mp2:~# aplay test3.wav
Playing WAVE 'test3.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
[ 132.343536] st,stm32-i2s 400b0000.audio-controller: Failed to find an accurate rate
[ 132.345630] st,stm32-i2s 400b0000.audio-controller: ASoC: error at snd_soc_dai_set_sysclk on 400b0000.audio-controller: -22
[ 132.356832] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at snd_soc_link_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22
[ 132.370390] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at __soc_pcm_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22
[ 137.389972] st,stm32-i2s 400b0000.audio-controller: Failed to find an accurate rate
[ 137.392105] st,stm32-i2s 400b0000.audio-controller: ASoC: error at snd_soc_dai_set_sysclk on 400b0000.audio-controller: -22
[ 137.403519] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at snd_soc_link_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22
[ 137.416918] 400b0000.audio-controller-es8328-hifi-analog: ASoC: error at __soc_pcm_hw_params on 400b0000.audio-controller-es8328-hifi-analog: -22

 

 

Can someone help check what happened? Did I miss something?

 

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    October 25, 2024

    Hi @Nicky ,

    Our local Chinese support office will soon contact you. 

    Olivier 

     

    NickyAuthor
    Visitor II
    October 28, 2024

    Hi Olivier,

    Thank you.