How to configure SSI to give the MCLK, BCLK and LRCLK to external ADC

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

How to configure SSI to give the MCLK, BCLK and LRCLK to external ADC

Jump to solution
5,112 Views
ajithpv
Contributor V

Hi all,

As part of our task, we are using the CS5343 Audio A/D Converter for Audio Input mic setup.

The CS5343 (a simple ADC without any register settings) is not using any external clock source and the 12.288 MHz (256xLRCLK) MCLK has to be given through the SSI sys_clk.

The CS5343 signals are connected to i.MX6DL' AUDMUX port 4 (AUDMUX_AUD4), which in-turn connects to the SSI in the i.MX6DL processor.

I have set the AUDMUX and SSI registers and now I'm getting the MCLK, BCLK and LRCLK when  I probed the signals. But no data is generating from the CS5343 chip.

The issue is that, I'm not getting the MCLK as desired while probing and is equal to the BCLK!

I'm setting SSI's sys clock as 12.28 MHz and I'm expecting the same value on AUDMUX_AUD4_RXC which is connected to the MCLK signal of the ADC.

The BCLK (3.02 MHz) and LRCLK (48 KHz) are coming proper while probing the signal lines, but the MCLK is coming 3.02 MHz instead of 12.28MHz in the AUDMUX_AUD4_RXC line!

More over, in my driver, the MCLK is coming properly (12.28 MHz ) and I'm setting the proper divisions too (that's why the BCLK and LRCLK is coming properly).

I have gone through the i.MX6DL reference manual and understand the below details from 61.8.4.1 SSI Clock and Frame Sync Generation,

1) If I have to get the SSI’s sys clock as external output, then I need to drive it through the SRCK port.

2) Right now, I’m getting the MCLK as equivalent as BCLK so hence, I’m suspecting the STCK is driving instead of SRCK line (STCK is equivalent to BLCK from the diagram).

3) I have gone through the Table 61-2. Clock Pin Configurations also but, I didn’t get the actual settings.

I would like to share my configuration as below.

1) SSI and AUDMUX settings in the board file as follows:

    static struct mxc_audio_platform_data mx6_iwg15m_mxm_audio_data = {
        .ssi_num = 1, /* SSI number = 2 */
        .src_port = 2, /* Source Port = 2 */
        .ext_port = 4, /* External Port = 4 = AUD4*/

        ...
     };
2) AUDMUX settings in my machine driver as follows:

a)    imx_audmux_config(plat->ext_port, plat->src_port); /* clock directions are from i.MX6 SSI to CS5343 since the CS5343 is slave. Data is input to the processor since its Audio-In mic ADC */

 

b)    static int imx_audmux_config(int slave, int master)
       {
        unsigned int ptcr, pdcr;
        slave = slave - 1;
        master = master - 1;

        ptcr = MXC_AUDMUX_V2_PTCR_SYN |
                MXC_AUDMUX_V2_PTCR_TFSDIR |
                MXC_AUDMUX_V2_PTCR_TFSEL(master) |
                MXC_AUDMUX_V2_PTCR_TCLKDIR |
                MXC_AUDMUX_V2_PTCR_TCSEL(master)|
                MXC_AUDMUX_V2_PTCR_RCLKDIR |            /* Newly added for RXC configuration */
                MXC_AUDMUX_V2_PTCR_RCSEL(master);    /* Newly added for RXC port selection */
        pdcr = MXC_AUDMUX_V2_PDCR_RXDSEL(master);
        mxc_audmux_v2_configure_port(slave, ptcr, pdcr);

        ptcr = MXC_AUDMUX_V2_PTCR_SYN;
        pdcr = MXC_AUDMUX_V2_PDCR_RXDSEL(slave);
        mxc_audmux_v2_configure_port(master, ptcr, pdcr);

        return 0;
}

3) From the AUDMUX_PTCR4 configuration settings:

RCLKDIR=1 RXC is an output.

RCSEL[3:0] = 1000 Selects RXC from port2.

so, I changed the default configuration from

#define MXC_AUDMUX_V2_PTCR_RCSEL(x)   (((x) & 0xf) << 12)        to

#define MXC_AUDMUX_V2_PTCR_RCSEL(x)   (((x) & 0xf) << 15)

in the arch/arm/plat-mxc/include/mach/audmux.h file.

Still I'm getting the STCK value instead of  SRCK !

I'm also make sure that, the TXDIR and SYS_CLK_EN are enable which is required to drive the SRCK as SSI sys clk.

What might be wrong here? Am I missing some other settings which required?

I hereby request you to provide me the settings/configuration/idea for driving the SSI’s sys clock through SRCK port, so that I will get the same SSI’s sys clock in the AUDMUX_AUD4_RXC line.

Thanks in advance

Ajith P V

Labels (2)
0 Kudos
1 Solution
1,387 Views
ajithpv
Contributor V

Hi ,

Thank you for your suggestion and its really helped me a lot.

According to the i.MX6DL reference Manual, the AUDMUX_PTCR4 can be RCSEL[3:0] = 1xxx Selects RXC from port. So I thought the configuration shall be 1000 (since x can be any value) instead of 1001.

After the change along with SYN in Asynchronous mode made the really good progress! Now I'm getting the MCLK as expected in the AUDMUX_AUD4_RXC line.

Thank you so much for the help again...

Ajith P V

View solution in original post

0 Kudos
4 Replies
1,387 Views
igorpadykov
NXP Employee
NXP Employee

Also very strange that MCLK is equal to the BCLK, probably it

is just short circuited with BCLK. One can run bare metal SDK tests

and check hardware.

0 Kudos
1,387 Views
ajithpv
Contributor V

Hi ,

According to Figure 61-22. SSI Transmit Clock Generator Block Diagram of i.MX6DL Reference Manual, the SRCK as well as STCK can be opened at the same time. In my case, STCK and SRCK was configured, but the trick played by the AUDMUX configuration.

In SYN (synchronous) mode, the AUDMUX using 4-wire connection and is not using RXC at that time. So I was getting TXC clock which in-turn gives the BCLK! Once the configuration done properly, then SRCK is selected via RXC pin.

Ajith P V

1,387 Views
igorpadykov
NXP Employee
NXP Employee

If you are using SSI number = 2 (internally conected to AUDMUX Port = 2) then

AUDMUX_PTCR4 should be RCSEL[3:0] = 1001 - Selects RXC from port2.

For port2 PTCR should be RCLKDIR=0 - RXC is an input.

1,388 Views
ajithpv
Contributor V

Hi ,

Thank you for your suggestion and its really helped me a lot.

According to the i.MX6DL reference Manual, the AUDMUX_PTCR4 can be RCSEL[3:0] = 1xxx Selects RXC from port. So I thought the configuration shall be 1000 (since x can be any value) instead of 1001.

After the change along with SYN in Asynchronous mode made the really good progress! Now I'm getting the MCLK as expected in the AUDMUX_AUD4_RXC line.

Thank you so much for the help again...

Ajith P V

0 Kudos