Skip to main content
Associate II
June 30, 2026
Solved

Why does the .wav files from ALSA sounds like they are recorded under water?

  • June 30, 2026
  • 3 replies
  • 92 views

Hi!

I have a custom board with STM32MP257F. I have the same electrical setup for HDMI as STM32MP257-DK board have. Hence, the HDMI output is working. 

But playing sound through HDMI does not work very well. It sounds like the mono .wav files from /etc/share/sound/alsa are recorded under water.

I play these sounds by using instructions from https://wiki.st.com/stm32mpu/wiki/How_to_play_audio

Here is my sound card. I can play test sounds like pink noise, PWM and sine waves from speaker-test. 

Here is my hardware setup. I'm using the same HDMI and I2S Device Tree setup as STM32MP257-DK.

(No, in mobile view, I cannot post this as a code block because the button "..." is not available)

root@watermelon-wine-1aunknown:/usr/share/sounds/alsa# aplay -l

**** List of PLAYBACK Hardware Devices ****

card 0: STM32MP25DK [STM32MP25-DK], device 0: 400b0000.audio-controller-i2s-hifi i2s-hifi-0 [400b0000.audio-controller-i2s-hifi i2s-hifi-0]

  Subdevices: 1/1

  Subdevice #0: subdevice #0

root@watermelon-wine-1aunknown:/usr/share/sounds/alsa# cat /etc/asound.conf

pcm.!playback_hdmi {

    type hw

    card STM32MP25DK

    device 0

}

 

pcm.!record_dmic0 {

    type hw

    card STM32MP25DK

    device 1

}

 

pcm.!record_dmic1 {

    type hw

    card STM32MP25DK

    device 2

}

root@watermelon-wine-1aunknown:/usr/share/sounds/alsa# pactl list sinks

Sink #60

        State: SUSPENDED

        Name: alsa_output.platform-sound.hdmi-stereo

        Description: Built-in Audio Digital Stereo (HDMI)

        Driver: PipeWire

        Sample Specification: s16le 2ch 48000Hz

        Channel Map: front-left,front-right

        Owner Module: 4294967295

        Mute: no

        Volume: front-left: 41958 / 64% / -11.62 dB, front-right: 41302 / 63% / -12.03 dB

                balance -0.02

        Base Volume: 65536 / 100% / 0.00 dB

        Monitor Source: alsa_output.platform-sound.hdmi-stereo.monitor

        Latency: 0 usec, configured 0 usec

        Flags: HARDWARE DECIBEL_VOLUME LATENCY SET_FORMATS

        Properties:

                alsa.card = "0"

                alsa.card_name = "STM32MP25-DK"

                alsa.class = "generic"

                alsa.device = "0"

                alsa.driver_name = "snd_soc_audio_graph_card"

                alsa.id = "STM32MP25DK"

                alsa.long_card_name = "STM32MP25-DK"

                alsa.name = "400b0000.audio-controller-i2s-hifi i2s-hifi-0"

                alsa.resolution_bits = "16"

                alsa.subclass = "generic-mix"

                alsa.subdevice = "0"

                alsa.subdevice_name = "subdevice #0"

                alsa.sync.id = "00000000:00000000:00000000:00000000"

                api.alsa.card.longname = "STM32MP25-DK"

                api.alsa.card.name = "STM32MP25-DK"

                api.alsa.headroom = "8192"

                api.alsa.path = "hdmi:0"

                api.alsa.pcm.card = "0"

                api.alsa.pcm.stream = "playback"

                audio.channels = "2"

                audio.position = "FL,FR"

                card.profile.device = "1"

                device.api = "alsa"

                device.class = "sound"

                device.id = "48"

                device.profile.description = "Digital Stereo (HDMI)"

                device.profile.name = "hdmi-stereo"

                device.routes = "1"

                factory.name = "api.alsa.pcm.sink"

                media.class = "Audio/Sink"

                device.description = "Built-in Audio"

                node.name = "alsa_output.platform-sound.hdmi-stereo"

                node.nick = "400b0000.audio-controller-i2s-hifi i2s-hifi-0"

                node.pause-on-idle = "false"

                object.path = "alsa:acp:STM32MP25DK:1:playback"

                port.group = "playback"

                priority.driver = "1000"

                priority.session = "1000"

                factory.id = "19"

                clock.quantum-limit = "8192"

                client.id = "47"

                node.driver = "true"

                node.loop.name = "data-loop.0"

                library.name = "audioconvert/libspa-audioconvert"

                object.id = "45"

                object.serial = "60"

                api.acp.auto-port = "false"

                api.alsa.card = "0"

                api.alsa.use-acp = "true"

                api.dbus.ReserveDevice1 = "Audio0"

                api.dbus.ReserveDevice1.Priority = "-20"

                device.bus_path = "platform-sound"

                device.enum.api = "udev"

                device.form_factor = "internal"

                device.icon_name = "audio-card-analog"

                device.name = "alsa_card.platform-sound"

                device.nick = "STM32MP25-DK"

                device.plugged.usec = "34320631"

                device.subsystem = "sound"

                sysfs.path = "/devices/platform/sound/sound/card0"

                device.string = "0"

        Ports:

                hdmi-output-0: HDMI / DisplayPort (type: HDMI, priority: 5900, availability unknown)

        Active Port: hdmi-output-0

        Formats:

                pcm

root@watermelon-wine-1aunknown:/usr/share/sounds/alsa# ls

Front_Center.wav Front_Left.wav Front_Right.wav Noise.wav Rear_Center.wav Rear_Left.wav Rear_Right.wav Side_Left.wav Side_Right.wav

root@watermelon-wine-1aunknown:/usr/share/sounds/alsa#

Best answer by Windows

Message for ST!

 

Here is the solution. You should post this in your Wiki for I2S.

 

First: If you don't use Master Clock for I2S. Just remove mclk-fs from DT.

 

&i2s2 {

 pinctrl-names = "default", "sleep";

 pinctrl-0 = <&i2s2_pins_mx>;

 pinctrl-1 = <&i2s2_sleep_pins_mx>;

 status = "okay";

 

 /* USER CODE BEGIN i2s2 */

 

 i2s2_port:port{

 

  i2s2_endpoint:endpoint{

   remote-endpoint = <&adv7535_tx_endpoint>;

   format = "i2s";

   mclk-fs = <256>; // Remove this line

  };

 };

 /* USER CODE END i2s2 */

};

 

Second: You need to have right SPI2 clock because I2S2 shares the same clock as SPI2.

Look at the reference manual RM0457 at table 801. Tune in your SPI2 at for example exactly 49.152 MHz. You can do that by turning the frac value in CubeMX. I'm using 49.152 MHz and it's working perfectly. I'm not using any Master Clock.

 

Third: Use this formula for computing the correct settings for your PLL clock and SPI2 clock in CubeMX. 

 

% Räkna ut I2S klockan

HSE = 24; % MHz (Konstant: kan ej ändras)

FREFDIV = 1;

FBDIV = 49;

POSTDIV1 = 1;

POSTDIV2 = 3;

FRAC = 2550137;

PREDIV = 1;

FINDIV = 8;

 

FFOUT = (HSE * (FBDIV + FRAC/(2^24)))/FREFDIV;

PLL7 = FFOUT/(POSTDIV1 * POSTDIV2)

 

I2S_CLK = PLL7/(PREDIV * FINDIV)

 

%Källa I2S frekvenstabell: RM0457 (rev 5) sida 4598 och sida 4599

%Källa formler: RM0457 (rev 5) sida 978 och sida 979

Sorry! I cannot post code in Mobile view on this forum. I hope this helps.

 

3 replies

WindowsAuthor
Associate II
June 30, 2026

I got an error now!

root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa# aplay -D playback_
hdmi -r 44100 -c 2 -B 500000 Front_Center_Stereo.wav
Playing WAVE 'Front_Center_Stereo.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
aplay: pcm_write:2178: write error: Input/output error
root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa#

It seems like it’s wrong MCLK settings for I2S.

root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa# cat /sys/kernel/de
bug/clk/clk_summary
enable prepare protect duty hardware connection
clock count count count rate accuracy phase cycle enable consumer id
---------------------------------------------------------------------------------------------------------------------------------------------
ck_usb2phy2800_pll 0 0 0 480000000 0 0 50000 Y deviceless no_connection_id
ck_usb2phy2800_48m 0 0 0 48000000 0 0 50000 Y deviceless no_connection_id
ck_usb2phy2400_pll 1 1 0 480000000 0 0 50000 Y usb@482f0000 no_connection_id
deviceless no_connection_id
ck_usb2phy2400_48m 0 0 0 48000000 0 0 50000 Y deviceless no_connection_id
ck_icn_p_pcie 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_rtc_am 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_lpdma_am 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_ipcc2_am 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_gpioz_am 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
msi_ker_ck 0 0 0 16000000 0 0 0 Y deviceless no_connection_id
hse_ker_ck 0 0 0 24000000 0 0 0 Y deviceless no_connection_id
ck_ker_usb2phy1_stp 0 0 0 24000000 0 0 50000 N usb2-phy1 stp
deviceless no_connection_id
hsi_ker_ck 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_icn_m_etr 0 0 0 400000000 0 0 0 Y deviceless no_connection_id
ck_icn_s_stm 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_p_stm 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_sys_atb 0 0 0 400000000 0 0 0 Y deviceless no_connection_id
ck_sys_dbg 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_ker_tpiu 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_ker_ospi2 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_ker_ospi1 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_bus_ipcc2 1 1 0 200000000 0 0 0 Y 46250000.mailbox no_connection_id
deviceless no_connection_id
ck_bus_ipcc1 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_bus_hpdma3 0 0 0 200000000 0 0 0 Y 40420000.dma-controller no_connection_id
deviceless no_connection_id
ck_bus_hpdma2 0 0 0 200000000 0 0 0 Y 40410000.dma-controller no_connection_id
deviceless no_connection_id
ck_bus_hpdma1 1 1 0 200000000 0 0 0 Y 40400000.dma-controller no_connection_id
deviceless no_connection_id
ck_bus_gpioz 1 1 0 200000000 0 0 0 Y gpio@46200000 no_connection_id
deviceless no_connection_id
ck_bus_gpiok 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_bus_gpioj 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_bus_gpioi 1 1 0 200000000 0 0 0 Y gpio@442c0000 no_connection_id
deviceless no_connection_id
ck_bus_gpioh 1 1 0 200000000 0 0 0 Y gpio@442b0000 no_connection_id
deviceless no_connection_id
ck_bus_gpiog 1 1 0 200000000 0 0 0 Y gpio@442a0000 no_connection_id
deviceless no_connection_id
ck_bus_gpiof 1 1 0 200000000 0 0 0 Y gpio@44290000 no_connection_id
deviceless no_connection_id
ck_bus_gpioe 1 1 0 200000000 0 0 0 Y gpio@44280000 no_connection_id
deviceless no_connection_id
ck_bus_gpiod 1 1 0 200000000 0 0 0 Y gpio@44270000 no_connection_id
deviceless no_connection_id
ck_bus_gpioc 1 1 0 200000000 0 0 0 Y gpio@44260000 no_connection_id
deviceless no_connection_id
ck_bus_gpiob 1 1 0 200000000 0 0 0 Y gpio@44250000 no_connection_id
deviceless no_connection_id
ck_bus_gpioa 1 1 0 200000000 0 0 0 Y gpio@44240000 no_connection_id
deviceless no_connection_id
ck_ker_fmc 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_icn_p_etr 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
timg2_ck 0 1 0 200000000 0 0 0 Y deviceless no_connection_id
ck_ker_tim1 0 1 0 200000000 0 0 50000 N 40200000.timer no_connection_id
40200000.timer int
deviceless no_connection_id
timg1_ck 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_apbdbg 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_apb4 2 4 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_p_venc 0 1 0 200000000 0 0 50000 N 480e0000.venc no_connection_id
deviceless no_connection_id
ck_icn_p_vdec 0 1 0 200000000 0 0 50000 N 480d0000.vdec no_connection_id
deviceless no_connection_id
ck_icn_p_usb3pciephy 0 0 0 200000000 0 0 50000 N 480c0000.phy apb-clk
deviceless no_connection_id
ck_icn_p_lvds 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_dcmipp 0 0 0 200000000 0 0 50000 N 48030000.dcmipp kclk
deviceless no_connection_id
ck_icn_p_csi 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_ltdc 1 1 0 200000000 0 0 50000 Y 48010000.display-controller bus
deviceless no_connection_id
ck_icn_p_dsi 2 2 0 200000000 0 0 50000 Y 48000000.dsi pclk
48000000.dsi pclk
deviceless no_connection_id
ck_icn_apb3 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_p_is2m 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_apb2 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_p_fdcan 0 0 0 200000000 0 0 50000 N 402d0000.can hclk
deviceless no_connection_id
ck_icn_p_usart6 0 0 0 200000000 0 0 50000 Y deviceless no_connection_id
ck_icn_p_tim1 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_apb1 0 1 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_p_i3c3 0 0 0 200000000 0 0 50000 Y deviceless no_connection_id
ck_icn_p_i2c2 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_i2c1 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_usart2 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_spi2 0 1 0 200000000 0 0 50000 N audio-controller@400b0000 no_connection_id
400b0000.audio-controller pclk
400b0000.audio-controller pclk
deviceless no_connection_id
rtc_ck 0 0 0 0 0 0 0 Y deviceless no_connection_id
ck_bus_rtc 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_pll3 0 0 0 24000000 0 0 0 Y deviceless no_connection_id
ck_ker_gpu 0 0 0 24000000 0 0 50000 N 48280000.gpu core
deviceless no_connection_id
hse_div2_ck 0 0 0 12000000 0 0 0 Y deviceless no_connection_id
ck_ker_usb3pciephy 0 0 0 12000000 0 0 50000 N 480c0000.phy ker-clk
deviceless no_connection_id
msi_ck 0 0 0 16000000 0 0 0 Y deviceless no_connection_id
lsi_ck 0 0 0 32000 0 0 0 Y deviceless no_connection_id
hsi_ck 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
lse_ck 0 0 0 0 0 0 0 Y deviceless no_connection_id
hse_ck 2 2 0 24000000 0 0 0 Y deviceless no_connection_id
ck_ker_dts 1 1 0 24000000 0 0 50000 Y 44070000.thermal-sensor no_connection_id
deviceless no_connection_id
clk_phy_dsi 2 2 0 24000000 0 0 50000 Y 48000000.dsi ref
deviceless no_connection_id
txbyteclk 1 1 0 320000000 0 0 50000 Y deviceless no_connection_id
clk_lanebyte 0 0 0 320000000 0 0 50000 Y deviceless no_connection_id
ck_icn_ls_mcu 3 3 0 200000000 0 0 0 Y 42130000.risab no_connection_id
42120000.risab no_connection_id
42110000.risab no_connection_id
42100000.risab no_connection_id
420f0000.risab no_connection_id
deviceless no_connection_id
ck_ker_eth1rx 1 1 0 200000000 0 0 50000 Y 482c0000.eth1 mac-clk-rx
deviceless no_connection_id
ck_ker_eth1tx 1 1 0 200000000 0 0 50000 Y 482c0000.eth1 mac-clk-tx
deviceless no_connection_id
ck_ker_eth1mac 1 1 0 200000000 0 0 50000 Y 482c0000.eth1 stmmaceth
deviceless no_connection_id
ck_ker_eth1stp 0 0 0 200000000 0 0 50000 N 482c0000.eth1 ethstp
deviceless no_connection_id
ck_icn_p_spi8 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_cryp1 0 0 0 200000000 0 0 50000 N 42030000.crypto no_connection_id
deviceless no_connection_id
ck_icn_p_ospiiom 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_adc3 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_adc12 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_p_eth1 0 0 0 200000000 0 0 50000 Y deviceless no_connection_id
ck_flexgen_63 0 0 0 400000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_62 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_61 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_60 0 0 0 50000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_59 0 0 0 600000000 0 0 0 Y deviceless no_connection_id
ck_icn_m_gpu 0 0 0 600000000 0 0 50000 N 48280000.gpu bus
genpd:0:48280000.gpu no_connection_id
deviceless no_connection_id
ck_flexgen_58 2 2 0 24000000 0 0 0 Y deviceless no_connection_id
ck_ker_usb2phy2_en 1 1 0 24000000 0 0 50000 Y usb2-phy2 core
deviceless no_connection_id
ck_ker_usb2phy2 2 2 0 24000000 0 0 50000 Y 48300000.usb suspend
48300000.usb ref
deviceless no_connection_id
ck_flexgen_57 1 1 0 24000000 0 0 0 Y deviceless no_connection_id
ck_ker_usb2phy1 1 1 0 24000000 0 0 50000 Y usb2-phy1 core
deviceless no_connection_id
ck_flexgen_56 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_ker_eth1ptp 0 0 0 200000000 0 0 50000 Y 482c0000.eth1 ptp_ref
deviceless no_connection_id
ck_flexgen_55 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_54 1 1 0 25000000 0 0 0 Y deviceless no_connection_id
ck_ker_eth1 1 1 0 25000000 0 0 50000 Y 482c0000.eth1 eth-ck
deviceless no_connection_id
ck_flexgen_53 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_52 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_51 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_ker_sdmmc1 0 0 0 200000000 0 0 50000 N 48220000.mmc no_connection_id
48220000.mmc apb_pclk
deviceless no_connection_id
ck_flexgen_50 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_49 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_48 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_47 0 0 0 40000000 0 0 0 Y deviceless no_connection_id
ck_ker_adc3 0 0 0 40000000 0 0 50000 N deviceless no_connection_id
ck_flexgen_46 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_ker_adc12 0 0 0 64000000 0 0 50000 N deviceless no_connection_id
ck_flexgen_45 0 0 0 400000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_44 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_43 0 0 0 50000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_42 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_41 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_40 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_39 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_38 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_37 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_ker_spi8 0 0 0 64000000 0 0 50000 N 46020000.spi no_connection_id
deviceless no_connection_id
ck_ker_spi8_am 0 0 0 64000000 0 0 50000 N deviceless no_connection_id
ck_flexgen_36 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_35 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_34 0 0 0 20000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_33 0 0 0 24000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_32 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_ker_lvdsphy 0 0 0 64000000 0 0 50000 N deviceless no_connection_id
ck_flexgen_31 0 0 0 25000000 0 0 0 Y deviceless no_connection_id
ck_ker_csiphy 0 0 0 25000000 0 0 50000 N 48020000.csi csi2phy
deviceless no_connection_id
ck_flexgen_30 0 0 0 12000000 0 0 0 Y deviceless no_connection_id
ck_ker_csitxesc 0 0 0 12000000 0 0 50000 N 48020000.csi txesc
deviceless no_connection_id
ck_flexgen_29 0 0 0 320000000 0 0 0 Y deviceless no_connection_id
ck_ker_csi 0 0 0 320000000 0 0 50000 N 48030000.dcmipp mclk
48030000.dcmipp mclk
48020000.csi pclk
deviceless no_connection_id
ck_flexgen_28 0 0 0 4000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_27 1 1 0 40000000 0 0 0 Y deviceless no_connection_id
ck_ker_ltdc 1 1 0 40000000 0 0 50000 Y 48010000.display-controller lcd
48000000.dsi px_clk
deviceless no_connection_id
clk_pix_ltdc 1 1 0 40000000 0 0 50000 Y 48010000.display-controller ref
deviceless no_connection_id
ck_flexgen_26 0 0 0 120000000 0 0 0 Y deviceless no_connection_id
ck_ker_fdcan 0 0 0 120000000 0 0 50000 N 402d0000.can cclk
deviceless no_connection_id
ck_flexgen_25 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_24 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_23 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_22 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_21 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_20 1 1 0 64000000 0 0 0 Y deviceless no_connection_id
ck_ker_usart6 1 1 0 64000000 0 0 50000 Y serial@40220000 no_connection_id
deviceless no_connection_id
ck_flexgen_19 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_18 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_17 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_16 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_15 0 0 0 100000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_14 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_13 1 1 0 64000000 0 0 0 Y deviceless no_connection_id
ck_ker_i3c3 1 1 0 64000000 0 0 50000 Y 401b0000.i3c no_connection_id
deviceless no_connection_id
ck_flexgen_12 0 2 0 100000000 0 0 0 Y deviceless no_connection_id
ck_ker_i2c2 0 1 0 100000000 0 0 50000 N 40130000.i2c no_connection_id
deviceless no_connection_id
ck_ker_i2c1 0 1 0 100000000 0 0 50000 N 40120000.i2c no_connection_id
deviceless no_connection_id
ck_flexgen_11 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_10 0 0 0 55803 0 0 0 Y deviceless no_connection_id
ck_ker_spi2 0 0 0 55803 0 0 50000 N 400b0000.audio-controller i2sclk
deviceless no_connection_id
ck_flexgen_09 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_flexgen_08 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_ker_usart2 0 0 0 64000000 0 0 50000 N deviceless no_connection_id
ck_flexgen_07 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_icn_vid 0 0 0 600000000 0 0 0 Y deviceless no_connection_id
ck_icn_nic 0 0 0 400000000 0 0 0 Y deviceless no_connection_id
ck_icn_hsl 2 2 0 300000000 0 0 0 Y deviceless no_connection_id
ck_icn_m_usb3dr 1 1 0 300000000 0 0 50000 Y 48300000.usb bus_early
deviceless no_connection_id
ck_icn_m_usb2ehci 1 1 0 300000000 0 0 50000 Y usb@482f0000 no_connection_id
deviceless no_connection_id
ck_icn_m_usb2ohci 0 0 0 300000000 0 0 50000 Y deviceless no_connection_id
ck_icn_display 0 0 0 400000000 0 0 0 Y deviceless no_connection_id
ck_icn_ddr 0 0 0 600000000 0 0 0 Y deviceless no_connection_id
ck_icn_sdmmc 0 0 0 200000000 0 0 0 Y deviceless no_connection_id
ck_icn_m_sdmmc1 0 0 0 200000000 0 0 50000 N deviceless no_connection_id
ck_icn_hs_mcu 0 0 0 400000000 0 0 0 Y deviceless no_connection_id
clk-ext-cec 1 1 0 24000000 0 0 50000 Y hdmi@39 no_connection_id
1-0039 cec
deviceless no_connection_id
clk-ext-camera 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
clk-rcbsec 0 0 0 64000000 0 0 50000 Y deviceless no_connection_id
root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa#

 

WindowsAuthor
Associate II
June 30, 2026

Is it normal that my I2S clock is at 55803 Hz?

 

root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa# cat /sys/kernel/debug/clk/clk_summary | grep -E 'spi2|flexgen_10'
ck_ker_ospi2 0 0 0 64000000 0 0 0 Y deviceless no_connection_id
ck_icn_p_spi2 0 1 0 200000000 0 0 50000 N audio-controller@400b0000 no_connection_id
ck_flexgen_10 0 0 0 55803 0 0 0 Y deviceless no_connection_id
ck_ker_spi2 0 0 0 55803 0 0 50000 N 400b0000.audio-controller i2sclk
root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa#

 

WindowsAuthor
Associate II
June 30, 2026

What is working is this:

The TV shift sound-speaker...but the latency of the sound is about 10 seconds slow. So when 1 - Front Right appears, it takes 10 seconds for me to hear that the sound has shifted to another speaker.

root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa# speaker-test -c 4

speaker-test 1.2.11

Playback device is default
Stream parameters are 48000Hz, S16_LE, 4 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 524288
Period size range from 16 to 262144
Periods = 4
was set period_size = 12000
was set buffer_size = 48000
0 - Front Left
1 - Front Right
3 - Rear Right
2 - Rear Left
Time per period = 302.931905
0 - Front Left
^CWrite error: -4,Interrupted system call
xrun_recovery failed: -4,Interrupted system call
Transfer failed: Interrupted system call
root@watermelon-wine-1aunknownunknown:/usr/share/sounds/alsa#

 

WindowsAuthorBest answer
Associate II
July 3, 2026

Message for ST!

 

Here is the solution. You should post this in your Wiki for I2S.

 

First: If you don't use Master Clock for I2S. Just remove mclk-fs from DT.

 

&i2s2 {

 pinctrl-names = "default", "sleep";

 pinctrl-0 = <&i2s2_pins_mx>;

 pinctrl-1 = <&i2s2_sleep_pins_mx>;

 status = "okay";

 

 /* USER CODE BEGIN i2s2 */

 

 i2s2_port:port{

 

  i2s2_endpoint:endpoint{

   remote-endpoint = <&adv7535_tx_endpoint>;

   format = "i2s";

   mclk-fs = <256>; // Remove this line

  };

 };

 /* USER CODE END i2s2 */

};

 

Second: You need to have right SPI2 clock because I2S2 shares the same clock as SPI2.

Look at the reference manual RM0457 at table 801. Tune in your SPI2 at for example exactly 49.152 MHz. You can do that by turning the frac value in CubeMX. I'm using 49.152 MHz and it's working perfectly. I'm not using any Master Clock.

 

Third: Use this formula for computing the correct settings for your PLL clock and SPI2 clock in CubeMX. 

 

% Räkna ut I2S klockan

HSE = 24; % MHz (Konstant: kan ej ändras)

FREFDIV = 1;

FBDIV = 49;

POSTDIV1 = 1;

POSTDIV2 = 3;

FRAC = 2550137;

PREDIV = 1;

FINDIV = 8;

 

FFOUT = (HSE * (FBDIV + FRAC/(2^24)))/FREFDIV;

PLL7 = FFOUT/(POSTDIV1 * POSTDIV2)

 

I2S_CLK = PLL7/(PREDIV * FINDIV)

 

%Källa I2S frekvenstabell: RM0457 (rev 5) sida 4598 och sida 4599

%Källa formler: RM0457 (rev 5) sida 978 och sida 979

Sorry! I cannot post code in Mobile view on this forum. I hope this helps.