Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

Interfacing (DSI, CSI, I2C, etc.) • I2S multichannel unstable

$
0
0
Hi, I have clock master TC358743 I2S 2 channel in -> Dolby EAC3 (5.1 channels) -> HifiBerry DACx8 8 channel out running at 192kHz.

Everything works, but sometimes I get:

- channels that are switched - pressing play and pause sometimes reorders the channels correctly

Code:

(1 2) (3 4) (5 6) -> (5 6) (1 2) (3 4) -> (3 4) (5 6) (1 2)
- dma errors:

Code:

[  505.703477] dma dma2chan0: dma2chan0 failed to stop[  505.703672] dma dma2chan0: dma2chan0 is non-idle!
- error 77 when executing snd_pcm_pause

All this is related to the DMA I2S1 playback:

Code:

cat /sys/kernel/debug/dmaengine/summary...dma2 (1f00188000.dma): number of channels: 8 dma2chan0    | 1f000a4000.i2s:tx dma2chan1    | 1f000a4000.i2s:rx
device tree:

Code:

/dts-v1/;/plugin/;/ {    compatible = "brcm,bcm2712";                                /* compute module 5 https://www.raspberrypi.com/documentation/computers/processors.html#bcm2712 */    fragment@0 {target = <&rp1_i2s1_18_21>;                     /* https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/rp1.dtsi#L671 */__overlay__ {pins = "gpio18", "gpio19",              /* also activate I2S1 slave input/output on 0 and output on 1 2 and 3: 18 I2S1_SCLK, 19 I2S1_WS,  */                               "gpio20", "gpio21", "gpio23",    /* 20 I2S1_SDI[0], 21 I2S1_SDO[0], 22 I2S1_SDI[1], 23 I2S1_SDO[1] */                               "gpio25", "gpio27";              /* 24 I2S1_SDI[2], 25 I2S1_SDO[2], 26 I2S1_SDI[3], 27 I2S1_SDO[3] */};};    fragment@1 {        target = <&i2s_clk_consumer>;                   /* shortcut for rp1_i2s1 https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/bcm2712-rpi.dtsi#L368 */        __overlay__ {            status = "okay";                            /* activate i2s in slave clock mode */        };    };    /* https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm64/boot/dts/broadcom/rp1.dtsi#L431        rp1_i2s1: i2s@a4000 {reg = <0xc0 0x400a4000  0x0 0x1000>;compatible = "snps,designware-i2s";// Providing an interrupt disables DMA// interrupts = <RP1_INT_I2S1 IRQ_TYPE_LEVEL_HIGH>;clocks = <&rp1_clocks RP1_CLK_I2S>;clock-names = "i2sclk";#sound-dai-cells = <0>;dmas = <&rp1_dma RP1_DMA_I2S1_TX>,<&rp1_dma RP1_DMA_I2S1_RX>;dma-names = "tx", "rx";dma-maxburst = <4>;status = "disabled";};        cat /sys/kernel/debug/clk/clk_summary | grep i2s shows that the i2s clk runs at 50 000 000 Hz or 50 MHz     */    fragment@2 {        target-path = "/";        __overlay__ {            xlr_8_out: playback_codec {                #address-cells = <0>;                   /*                                                            #address-cells and #size-cells properties may be used in any device node that has children                                                            in the device-tree hierarchy and describes how child device nodes should be addressed.                                                            The #address-cells property defines the number of <u32> cells used to encode the address                                                            field in a child node’s reg property                                                         */                #size-cells = <0>;                      /*                                                            The #size-cells property defines the number of <u32>cells used to encode the size field                                                            in a child node’s reg property.                                                        */                #sound-dai-cells = <0>;                compatible = "linux,spdif-dit";         /* generic I2S transmitter, see details modinfo snd_soc_spdif_tx */            };            hdmi_2_in: tc358743-codec {                 /* https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm/boot/dts/overlays/tc358743-audio-overlay.dts */                #address-cells = <0>;                #size-cells = <0>;                #sound-dai-cells = <0>;                compatible = "linux,spdif-dir";         /* generic I2S receiver, see details modinfo snd_soc_spdif_rx */            };        };    };    fragment@3 {        target = <&sound>;        __overlay__ {            compatible = "simple-audio-card";           /* https://www.kernel.org/doc/Documentation/devicetree/bindings/sound/simple-card.txt */            simple-audio-card,name = "hdmi2in8outxlr";            status="okay";                              /* activate card, if not, it will not show up in alsa */            simple-audio-card,dai-link@0 {              /* I2S - capture from TC358743 on GPIO 20 I2S1_SDI[0] */                format = "i2s";                frame-master = <&capture_codec>;                bitclock-master = <&capture_codec>;                cpu {                                   /* no tdm needed https://github.com/raspberrypi/linux/issues/6568 */                    sound-dai = <&i2s_clk_consumer>;    /* bind to I2S1 slave clock */                };                                capture_codec: codec {                  /* Toshiba HDMI Bridge IC TC358743XBG */                    sound-dai = <&hdmi_2_in>;                };            };            simple-audio-card,dai-link@1 {              /* I2S - playback */                format = "i2s";                bitclock-master = <&playback_codec>;                frame-master = <&playback_codec>;                cpu {                    sound-dai = <&i2s_clk_consumer>;                };                playback_codec: codec {                    sound-dai = <&xlr_8_out>;                };            };        };    };
snd_soc_simple_card, designware_i2s and snd_soc_spdif_tx are loaded:

Code:

lsmod | grep sndsnd_soc_simple_card    49152  3snd_soc_simple_card_utils    49152  1 snd_soc_simple_cardsnd_soc_hdmi_codec     49152  2snd_soc_spdif_rx       49152  1snd_soc_spdif_tx       49152  1snd_soc_core          311296  7 snd_soc_spdif_tx,snd_soc_spdif_rx,vc4,snd_soc_hdmi_codec,designware_i2s,snd_soc_simple_card_utils,snd_soc_simple_cardsnd_compress           49152  1 snd_soc_coresnd_pcm_dmaengine      49152  1 snd_soc_coresnd_pcm               147456  8 snd_soc_hdmi_codec,designware_i2s,snd_compress,snd_soc_simple_card_utilssnd_soc_core,snd_pcm_dmaenginesnd_timer              65536  1 snd_pcmsnd                   131072  9 snd_soc_hdmi_codec,snd_timer,snd_compress,snd_soc_core,snd_pcm
How can I best debug? Should I play with the dma-maxburst?

Thanks!

Statistics: Posted by spyder8 — Sun May 25, 2025 10:03 pm



Viewing all articles
Browse latest Browse all 8041

Trending Articles