imx8qx sai0 output problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8qx sai0 output problem

Jump to solution
1,867 Views
draven
Contributor III

Hi all,

I have a new problem. Can you help me?

I am trying to work imx8qx's sai0 output. At software side everything looks fine. But I cannot any signal sai0's output with oscilloscope. My working stages at below.

 

sound {
compatible = "simple-audio-card";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,format = "i2s";
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,name = "tas2770-Audio";   
dailink_master: simple-audio-card,codec {
              sound-dai = <&codec>;
              clocks = <&mclkout0_lpcg 0>;
            };
        cpusai: simple-audio-card,cpu {
            sound-dai = <&sai0>;
            dai-tdm-slot-num = <2>;
            dai-tdm-slot-width = <32>;
             };
};

&i2c1 {
    codec: tas2770@41 {
        compatible = "ti,tas2770";
        #sound-dai-cells = <0>;
        assigned-clocks = <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,
<&mclkout0_lpcg 0>;
assigned-clock-rates = <786432000>, <49152000>, <12000000>, <12000000>;
clocks = <&mclkout0_lpcg 0>;
clock-names = "mclk";
        reg = <0x41>;
        ti,asi-format = <0>;
        ti,left-slot = <0>;
        ti,right-slot = <1>;
        ti,imon-slot-no = <0>;
        ti,vmon-slot-no = <2>;
        #address-cells = <1>;
        #size-cells = <0>;
        ti,reset-gpio = <&portexp 19 GPIO_ACTIVE_LOW>;
        ti,irq-gpio = <&lsio_gpio3 0 GPIO_ACTIVE_LOW>;
    };
};

&sai0 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai0>;
status = "okay";
fsl,sai-asynchronous;
};

pinctrl_sai0: sai0grp {
fsl,pins = <
IMX8QXP_SPI0_SDI_ADMA_SAI0_TXD 0x06000040
IMX8QXP_SPI0_SCK_ADMA_SAI0_TXC 0x06000040
IMX8QXP_SPI0_SDO_ADMA_SAI0_TXFS 0x06000040
>;
};

 

  • Before sai0's pins connect to ​M40_GPIO0_IO03 at my mex file. For be sure I can pinmux, I added pad_force_mux to scfw file. My scfw diff is : 

 

@@ -252,6 +252,20 @@ void board_init(boot_phase_t phase)
         /* Configure SNVS button timing (ON->OFF 5s, OFF->ON 100ms) */
         SNVS_ButtonTime(SNVS_DRV_BTN_ON_100MS, SNVS_DRV_BTN_DEBOUNCE_100MS, SNVS_DRV_BTN_PRESS_5S);
 
+        pad_force_mux(SC_P_SPI0_SDO, 1, SC_PAD_CONFIG_OUT_IN,
+            SC_PAD_ISO_OFF);
+
+        pad_force_mux(SC_P_SPI0_SCK, 1, SC_PAD_CONFIG_OUT_IN,
+            SC_PAD_ISO_OFF);
+
+        pad_force_mux(SC_P_SPI0_SDI, 1, SC_PAD_CONFIG_OUT_IN,
+            SC_PAD_ISO_OFF);
+
+        pad_force_mux(SC_P_SPI0_CS0, 1, SC_PAD_CONFIG_OUT_IN,
+            SC_PAD_ISO_OFF);
+
+        board_print(3, "%s(BOOT_PHASE_FINAL_INIT SAI pins configurated - %u)\n", __func__, (unsigned)phase);
+
         break;
     case BOOT_PHASE_TEST_INIT: /* Init HW required for unit tests */
         board_print(3, "%s(BOOT_PHASE_TEST_INIT - %u)\n", __func__, (unsigned)phase);

 

  • And for be sure m4 cortex not effect to sai pin's I generate new flash.bin from mkimage without m4 image. (make SOC=iMX8QX flash) / (flash -> SCU + AP)
  • Lastly everything looks fine at userspace : 

 

root@tqma8xqp-mba8xx:~# dmesg | grep tas27 
[    2.219460] tas2770 16-0041: tas2770_i2c_probe enter
[    2.224527] tas2770 16-0041: ti,asi-format=0
[    2.224551] tas2770 16-0041: ti,reset-gpio=507
[    2.224568] tas2770 16-0041: ti,irq-gpio=96
[    2.224574] tas2770 16-0041: ti,left-slot=0
[    2.224580] tas2770 16-0041: ti,right-slot=1
[    2.224586] tas2770 16-0041: ti,imon-slot-no=0
[    2.224592] tas2770 16-0041: ti,vmon-slot-no=2
[    2.224610] tas2770 16-0041: irq = 233
[    2.261280] tas2770 16-0041: tas2770_register_codec, enter
[    3.716892] tas2770 16-0041: tas2770_codec_probe
[    3.721583] tas2770 16-0041: tas2770_codec_read, reg: 0xc, value: 0xa
[    3.721593] tas2770 16-0041: tas2770_codec_read, reg: 0xc, value: 0xa
[    3.721602] tas2770 16-0041: tas2770_codec_read, reg: 0xc, value: 0xa
[    3.721610] tas2770 16-0041: tas2770_codec_read, reg: 0xc, value: 0xa
[    3.721623] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
[    3.721632] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
[    3.721641] debugfs: Directory '59040000.sai' with parent 'tas2770-Audio' already present!
[    3.729954] tas2770 16-0041: tas2770_set_dai_fmt, format=0x1001
[    3.729960] tas2770 16-0041: ASI format master is not found
[    3.735543] tas2770 16-0041: INV format: NBNF
[    3.735551] tas2770 16-0041: tas2770_codec_read, reg: 0xb, value: 0x2
[    3.735558] tas2770 16-0041: tas2770_codec_read, reg: 0xb, value: 0x2
[    3.735565] tas2770 16-0041: tas2770_codec_read, reg: 0xd, value: 0x10
[    3.735571] tas2770 16-0041: tas2770_codec_read, reg: 0xd, value: 0x10
[    3.735578] tas2770 16-0041: tas2770_codec_read, reg: 0xd, value: 0x10
[    3.735583] tas2770 16-0041: slot value: 0x10
[    3.735667] asoc-simple-card sound: tas2770 ASI1 <-> 59040000.sai mapping ok
[    3.748553] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
[    3.748584] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
[    4.114813]   #0: tas2770-Audio
[    8.532424] tas2770 16-0041: tas2770_codec_read, reg: 0x3, value: 0x10
[    8.537366] tas2770 16-0041: tas2770_codec_write, reg: 0x3, 0x14
[    8.537509] tas2770 16-0041: tas2770_codec_read, reg: 0x5, value: 0x0
[    8.537546] tas2770 16-0041: tas2770_codec_read, reg: 0xc, value: 0xa
[    8.537573] tas2770 16-0041: tas2770_codec_read, reg: 0xc, value: 0xa
[    8.537880] tas2770 16-0041: tas2770_codec_write, reg: 0xc, 0x1a
[    8.537923] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
[    8.537956] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
[    8.599187] tas2770 16-0041: tas2770_codec_read, reg: 0x3, value: 0x14
[    8.599235] tas2770 16-0041: tas2770_codec_read, reg: 0x5, value: 0x0
[    8.599266] tas2770 16-0041: tas2770_codec_read, reg: 0xc, value: 0x1a
[    8.599290] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
[    8.599313] tas2770 16-0041: tas2770_codec_read, reg: 0x2, value: 0xe
root@tqma8xqp-mba8xx:~# aplay -L

null

    Discard all samples (playback) or generate zero samples (capture)

sysdefault:CARD=tas2770Audio

    tas2770-Audio, 

    Default Audio Device

usbstream:CARD=tas2770Audio

    tas2770-Audio

    USB Stream Output

 

 

 

root@tqma8xqp-mba8xx:~# speaker-test 



speaker-test 1.1.9



Playback device is default

Stream parameters are 48000Hz, S16_LE, 1 channels

Using 16 octaves of pink noise

Rate set to 48000Hz (requested 48000Hz)

Buffer size range from 3840 to 5760

Period size range from 1920 to 1920

Using max buf[f e r20 s7i.z7e6 09577610]
 
 tPaesr27i7od0s  1=6- 400

4w1a:s  isrqet_ wpoerrki_ordou_stiiznee 

= 1920

was set buffer_size = 5760

 0 - Front Left

[  207.775724] tas2770 16-0041: IRQ status : 0x4, 0x0

 

 

I cannot see any digital signal at my som's sai0 pins via oscilloscope. 

I wam waiting for your helps.

Thanks.

0 Kudos
Reply
1 Solution
1,860 Views
igorpadykov
NXP Employee
NXP Employee

Hi yildizberat

 

one can look at wm8960 example

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qxp-mek-...

and Figure 27. ALSA SoC Software Architecture  i.MX Linux Reference Manual​

 

Best regards
igor

View solution in original post

0 Kudos
Reply
3 Replies
1,815 Views
draven
Contributor III

I wrote a simple machine driver and now it works.

0 Kudos
Reply
1,777 Views
giuseppepagano1
Contributor III

Hi, 

I think I have the same problem:

On a custom board I'm using a really simple codec (sgtl5000), connected via sai0 to an imx8qxp soc.

My audio codec plays well with 4.19 kernel, but with Yocto kernel 5.4.70 I can't see any signal (clock and data) on I2S bus.

At boot my codec is correctly recognized and linked to the sai0 controller.

With 5.4 kernel I can run "aplay test.vaw", but using the scope I can't see any signal at all.

 

Can you please clarify what have you correct in your machine driver ?

 

Really many thanks in advance.

Giuseppe

 

 

0 Kudos
Reply
1,861 Views
igorpadykov
NXP Employee
NXP Employee

Hi yildizberat

 

one can look at wm8960 example

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qxp-mek-...

and Figure 27. ALSA SoC Software Architecture  i.MX Linux Reference Manual​

 

Best regards
igor

0 Kudos
Reply