I2S master does not generate master clock on verdin imx8m-plus

Objective

Connect 4 mono audio devices to the iMX using the codec CS4234 (i2s)

Description

The audio codec requires a master clock and as i2s master, the iMX should generate it. A custom device tree overlay is applied to configure i2s (see below), but there is no clock signal at the configured pin. The file imx8mp-verdin-dev.dtsi was used as reference.

dmesg contains the error fsl-aud2htx 30cb0000.aud2htx: failed to pcm register 5 times.
dmesg.log (32.4 KB)

/dts-v1/;
/plugin/;

#include <dt-bindings/clock/imx8mp-clock.h>
#include <dt-bindings/gpio/gpio.h>
#include "imx8mp-pinfunc.h"

/ {
    compatible = "toradex,verdin-imx8mp";
};

&{/} {
    sound {
        compatible = "simple-audio-card";
        simple-audio-card,bitclock-master = <&codec_dai>;
        simple-audio-card,format = "i2s";
        simple-audio-card,frame-master = <&codec_dai>;
        simple-audio-card,mclk-fs = <256>;
        simple-audio-card,name = "radios";
        simple-audio-card,routing =
            "Line Out", "R1OUT",
            "Line Out", "R2OUT",
            "Line Out", "R3OUT",
            "Line Out", "R4OUT",
            "R1IN", "Line In",
            "R2IN", "Line In",
            "R3IN", "Line In",
            "R4IN", "Line In";
        simple-audio-card,widgets =
            "Line Out", "Line Out",
            "Line", "Line In";

        codec_dai: simple-audio-card,codec {
            clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1>;
            sound-dai = <&cs4234>;
        };

        simple-audio-card,cpu {
            sound-dai = <&sai1>;
        };
    };
};

/* Verdin I2C_1 */
&i2c4 {
	status = "okay";

	/* Audio Codec */
	cs4234: audio-codec@10 {
		compatible = "cirrus,cs4234";
		reg = <0x10>;
        VA-supply = <&reg_5p0v>;
        VL-supply = <&reg_1p8v>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_sai1>;
		#sound-dai-cells = <0>;
	};
};

/* Verdin I2S_1 */
&sai1 {
	assigned-clocks = <&clk IMX8MP_CLK_SAI1>;
	assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
	assigned-clock-rates = <24576000>;
	fsl,sai-mclk-direction-output;
    fsl,sai-synchronous-rx;
	status = "okay";
};

tcbuild.yaml (757 Bytes)

The codec is connected to the I2S_1, pins 11 to 15 of X19 (SODIMM Pins 30, 32, 34, 36, 38) and I2C_1, pins 10 and 11 of X10 (SODIMM Pins 12 and 14). All I2S pins just keep having ground level.

Device

Software summary

Bootloader: U-Boot
Kernel version: 6.6.54-7.1.0-g3493ccd66900 #1-Torizon SMP PREEMPT Tue Dec 17 21:04:41 UTC 2024
Kernel command line: root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/126e49fd181914e3dee90ccea67ccf14d4897990e0e223ebde4654af4f5fd774/0
Distro name: NAME=“Torizon OS”
Distro version: VERSION_ID=7.1.0-build.4
Distro variant: VARIANT=“Docker”
Hostname: verdin-imx8mp-15010410

Hardware info

HW model: Toradex Verdin iMX8M Plus on Mallow Board
Toradex version: 0065 V1.1A
Serial number: 15010410
Processor arch: aarch64

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

To address the issue of the I2S master clock not being generated on your Verdin iMX8M Plus, let’s explore a few key areas:

  1. Device Tree Configuration: Ensure your device tree overlay is correctly setting up the I2S interface and master clock. The assigned-clocks and assigned-clock-parents for the sai1 node appear to be set to use IMX8MP_AUDIO_PLL1_OUT, which is correct. However, verify that the assigned-clock-rates value of 24576000 Hz is suitable for your application and matches the CS4234 codec’s requirements.

  2. Master Clock Output: The fsl,sai-mclk-direction-output property is set to output the master clock, which is correct. Double-check the physical connections to ensure the correct pin is used for the master clock output and that there are no hardware issues.

  3. Error Message in dmesg: The error fsl-aud2htx 30cb0000.aud2htx: failed to pcm register indicates a potential issue with the PCM interface registration. This might be due to a misconfiguration in the device tree or a missing driver. Ensure the CS4234 codec driver is loaded and compatible with your kernel version.

  4. Kernel and Driver Compatibility: Confirm that your kernel version supports the CS4234 codec and the I2S configuration. Sometimes, updating the kernel or applying specific patches may be necessary.

  5. Clock Source and Routing: Verify that the clock source is correctly routed and enabled in the system. Check the clock tree configuration in the kernel to ensure the clock source is active and properly routed to the I2S interface.

  6. Testing and Debugging: Use tools like i2cdetect to verify I2C communication with the codec. Additionally, check the ALSA configuration to ensure the audio interface is correctly set up.

I hope these steps help you resolve the issue. If you have further questions, feel free to ask.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

https://community.nxp.com/t5/i-MX-Processors/iMX8M-SAI-Master-Clock-quot-Skipping-quot/m-p/902615

IMX8MP Verdin on Mallow carrier board.