I2S1 Slave configuration on iMX7D

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

I2S1 Slave configuration on iMX7D

2,954 Views
vishalthanki
Contributor II

Hi,

I have a custom board based on iMX7D. I want to configure the I2S1 (SAI1) in following fashion:

  • iMX7 SoC is clock master for I2S1 TX  (for BCLK and WCLK)
  • Codec/DSP is clock master for I2S1 RX (for BCLK and WCLK)
Note: The custom module has the clock lines (BCLK and WCLK for TX and RX respectively) connected between SAI1 and SAI3.
I have explicitly made the TX and RX asynchronous in DTS. And for the sake of testing above configuration, I added two DTS property which I am parsing in I2S driver (sound/soc/fsl/fsl_sai.c), and configuring the clocks accordingly. I can see that during playback from SoM, I2S1 TX has correct clocks (BCLK and WCLK), and there are no clocks/activity on I2S RX (BCLK and WCLK). I enabled the I2S config register to report the interrupts for TX and RX. I can see the interrupts for TX when playback is running. When I start the recording (using "arecord"), I can see the DSP/Codec is providing clocks (BCLK and WCLK are probed on scope), but I do not see any I2S RX interrupt, and the "arecord" simply comes out by reporting I/O error. I have configured the IOMUXC settings for the SAI in following manner.
Following is the pinmux configuration for SAI1 group in DTS:
pinctrl_sai1: sai1grp {
fsl,pins = <
MX7D_PAD_ENET1_RX_CLK__SAI1_TX_BCLK 0x14
MX7D_PAD_SAI1_TX_SYNC__SAI1_TX_SYNC 0x14
MX7D_PAD_ENET1_COL__SAI1_TX_DATA0 0x14
MX7D_PAD_SAI1_RX_DATA__SAI1_RX_DATA0 0x14

MX7D_PAD_ENET1_RGMII_TX_CTL__SAI1_RX_SYNC 0x14
MX7D_PAD_SAI1_RX_SYNC__SAI1_RX_SYNC 0x14
MX7D_PAD_SD1_CLK__SAI3_RX_SYNC 0x14
MX7D_PAD_ENET1_RGMII_TXC__SAI1_RX_BCLK 0x14
MX7D_PAD_SD1_CMD__SAI3_RX_BCLK 0x14
>;
};‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Edit1:

Following are the register details just after I start recording (using "arecord")

# cat /sys/kernel/debug/regmap/308a0000.sai/registers 
00: 00000000
04: 0000000c
08: 07000005
0c: 00000000
10: 00011f1b
14: 1f1f0f00
40: 00000000
60: fffffffc
80: 90000c01
84: 00000005
88: 02000000
8c: 00010000
90: 00011f1a
94: 1f1f0f00
a0: 00000000
c0: 00000000
e0: fffffffc

Any suggestions for debugging this issue further would be helpful.

Thanks,

Vishal

Labels (2)
Tags (3)
0 Kudos
Reply
5 Replies

1,935 Views
karina_valencia
NXP Apps Support
NXP Apps Support

igorpadykov‌  can you continue with the follow up?

0 Kudos
Reply

1,935 Views
igorpadykov
NXP Employee
NXP Employee

Hi Vishal

I/O error may be reported due to pads


MX7D_PAD_ENET1_RGMII_TX_CTL..
as they are used by another group pinctrl_enet1: enet1grp:
linux-2.6-imx.git - Freescale i.MX Linux Tree 
also SAI3 configs seems are not needed if only SAI1 instance used in the case.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------


0 Kudos
Reply

1,935 Views
vishalthanki
Contributor II

Hi Igor,

Thanks for your reply. I tried removing the pads used in ene1grp, and the pads for SAI3. Now the DTS entries for sai1grp looks like following. But still there is no success in the recording for SAI1 in slave mode.

pinctrl_sai1: sai1grp {
 fsl,pins = <
 MX7D_PAD_ENET1_RX_CLK__SAI1_TX_BCLK 0x14
 MX7D_PAD_SAI1_TX_SYNC__SAI1_TX_SYNC 0x14
 MX7D_PAD_ENET1_COL__SAI1_TX_DATA0 0x14
MX7D_PAD_SAI1_RX_DATA__SAI1_RX_DATA0 0x14
 MX7D_PAD_SAI1_RX_SYNC__SAI1_RX_SYNC 0x14
 /*
 MX7D_PAD_ENET1_RGMII_TX_CTL__SAI1_RX_SYNC 0x14
 MX7D_PAD_ENET1_RGMII_TXC__SAI1_RX_BCLK 0x14
 MX7D_PAD_SD1_CLK__SAI3_RX_SYNC 0x14
 MX7D_PAD_SD1_CMD__SAI3_RX_BCLK 0x14
 */
 >;
 };‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

For the sake of confirming the device-tree changes are actually applied, here is the dump of pin settings:

# hexdump  sai1grp/fsl,pins 
0000000 0000 6002 0000 d004 0000 a806 0000 0200
0000010 0000 0100 0000 1400 0000 0802 0000 7804
0000020 0000 ac06 0000 0000 0000 0000 0000 1400
0000030 0000 6802 0000 d804 0000 0000 0000 0200
0000040 0000 0000 0000 1400 0000 0002 0000 7004
0000050 0000 a006 0000 0000 0000 0000 0000 1400
0000060 0000 1002 0000 8004 0000 a406 0000 0000
0000070 0000 0000 0000 1400                    
0000078
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

EDIT1:

For the sake of testing, I made TX and RX synchronous (by removing "fsl,sai-asynchronous;") entry in DTS file. Then I started the playback followed by capture. In this case the capture works, but as soon as I stop the playback, the capture also stops with input/output error. I do not understand this behavior.

Thanks,

Vishal

0 Kudos
Reply

1,935 Views
igorpadykov
NXP Employee
NXP Employee

Hi Vishal

in synchronous mode both clock and frame sync are used

by transmitter and receiver, so one can check them by oscilloscope. This is described in

sect.13.8.3.3.1 Synchronous mode i.MX7D Reference Manual

http://cache.nxp.com/files/32bit/doc/ref_manual/IMX7DRM.pdf

Regarding

"not see any I2S RX interrupt, and the "arecord" simply comes out by reporting I/O error."

one can debug it (probably try to read FIFO and its pointers), use AN4553 Debugging Tools

http://www.nxp.com/assets/documents/data/en/application-notes/AN4553.pdf 

What BSP used in the case,  please note that i.MX7 supported starting only

 L4.1.15_1.2.0. Is it NXP BSP ?  Please check  NXP BSPs on

i.MX 6 Series Software and Development Tool|NXP 

Just for reference please check attached Linux Manual Table 28-1. Stereo Codec SoC Driver Files

for sai driver sources.

Best regards
igor

0 Kudos
Reply

1,935 Views
vishalthanki
Contributor II

Hi Igor,

The problem got fixed with correct value settings for following macros in arch/arm/boot/dts/imx7d-pinfunc.h

MX7D_PAD_ENET1_RGMII_TX_CTL__SAI1_RX_SYNC
MX7D_PAD_ENET1_RGMII_TXC__SAI1_RX_BCLK

Thanks,

Vishal

0 Kudos
Reply