This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Another OMAP L137/C6747 PSP audioSample and I2S mode question

Hi,

My platform is OMAPL137 EVM, CCS 3.3, BIOSPSP.

I tried to modify the audioSample program of BIOSPSP example to test I2S mode instead of DSP mode. But the output became noisy.

The following is my modification:

1. I modified audioAic31Params structure to change AIC31 mode to I2S in audioSample_main.c

Aic31_Params audioAic31Params = {
    ICodec_CodecType_AIC31,         /* acType                 */
    ICodec_ControlBusType_I2C,      /* acControlBusType       */
    "NONE",                         /* acCtrlBusName          */
    ICodec_OpMode_MASTER,           /* acOpMode               */
    ICodec_DataType_I2S,            /* acSerialDataType       */
    (Uint32)ICodec_SlotWidth_16,    /* acSlotWidth            */
    ICodec_DataPath_TXRX,           /* acDataPath             */
    0,                              /* isRxTxClockIndependent */
};

2. I modified some MCASP register value according to I2S standard  in audioSample_io.c

Mcasp_HwSetupData mcaspRcvSetup = {
        /* .rmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
        /* .rfmt     = */ 0x00018070, /*
                                       * 1 bit delay from framsync
                                       * MSB first
                                       * No extra bit padding
                                       * Padding bit (ignore)
                                       * slot Size is 16
                                       * Reads from DMA port
                                       * NO rotation
                                       */
        /* .afsrctl  = */ 0x00000110, /* 2-slot TDM(I2S),
                                       * Frame sync is one word
                                       * Rising edge is start of frame
                                       * externally generated frame sync
                                       */
        /* .rtdm     = */ 0x00000003, /* slot 0 and slot 1 are active (I2S)               */
        /* .rintctl  = */ 0x00000003, /* sync error and overrun error         */
        /* .rstat    = */ 0x000001FF, /* reset any existing status bits       */
        /* .revtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
        {
             /* .aclkrctl  = */ 0x00000080,
             /* .ahclkrctl = */ 0x00000000,
             /* .rclkchk   = */ 0x00000000
        }
} ;

Mcasp_HwSetupData mcaspXmtSetup = {
        /* .xmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
        /* .xfmt     = */ 0x00018070, /*
                                       * 1 bit delay from framsync
                                       * MSB first
                                       * No extra bit padding
                                       * Padding bit (ignore)
                                       * slot Size is 16
                                       * Reads from DMA port
                                       * NO rotation
                                       */
        /* .afsxctl  = */ 0x00000110, /* 2-slot TDM(I2S),
                                       * Frame sync is one word
                                       * Rising edge is start of frame
                                       * externally generated frame sync
                                       */
        /* .xtdm     = */ 0x00000003, /* slot 0 and slot 1 are active (I2S)               */
        /* .xintctl  = */ 0x00000007, /* sync error,overrun error,clK error   */
        /* .xstat    = */ 0x000001FF, /* reset any existing status bits       */
        /* .xevtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
        {
             /* .aclkxctl  = */ 0x00000000,
             /* .ahclkxctl = */ 0x00000000,
             /* .xclkchk   = */ 0x00000000
        },

};


/* McBsp channel parameters                                  */
Mcasp_ChanParams  mcasp_chanparam[Audio_NUM_CHANS]=
{
    {
        0x0001,                    /* number of serialisers      */
        {Mcasp_SerializerNum_0, }, /* serialiser index           */
        &mcaspRcvSetup,
        TRUE,
        Mcasp_OpMode_TDM,          /* Mode (TDM/DIT)             */
        Mcasp_WordLength_16,
        NULL,
        0,
        NULL,
        NULL,
        2,                        /* number of TDM channels      */
        Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED,
        TRUE,
        TRUE
    },
    {
        0x0001,                   /* number of serialisers       */
        {Mcasp_SerializerNum_5,},
        &mcaspXmtSetup,
        TRUE,
        Mcasp_OpMode_TDM,
        Mcasp_WordLength_16,      /* word width                  */
        NULL,
        0,
        NULL,
        NULL,
        2,                        /* number of TDM channels      */
        Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED,
        TRUE,
        TRUE
    }
};

But something must be wrong of above program,  because the output is noisy.

The original program in DSP mode runs quite well.

My project is here: 8816.audio_i2s.zip

Any help is appreciated !!!

Weiwei Zheng

  • Weiwei,

    Your setup is similar to mine but I use 32 bit audio instead of 16 bit. Otherwise it looks fine.  Is your McASP slave or master?  Here are steps you can use to debug

    1) look at the bit, word, data and master clocks to the codec to make sure they look like i2s.  If you are at 48 kHz then you should see 48 kHz at the word clock, 3 MHz at the bit clock and 12.288MHz as the master clock.  Data should be 1 bit delayed from the word clock.

    2) You may have a RX or a TX problem or a problem with both.  So generate a sine wave on the outgoing signal to see if you get a good signal on the output.  If you generate a dc signal you should be able to see the bits on the data signal change as you change the dc signal level.  Otherwise they would not change. 

    3) Correspondingly send in a sine wave, say 1 kHz, and then analyze the received buffer to see if the problem is on the input side.

    Hope this helps,

    Fawad

  • Fawad,

    Thank you very much for your help!

    Now I'm using 32 bit I2S format. And everything sounds well.

    But 16 bit format program still runs with a little click noise.

    McASP config for 16 bit:

    Mcasp_HwSetupData mcaspRcvSetup = {
            /* .rmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
            /* .rfmt     = */ 0x00018070, /*
                                           * 1 bit delay from framsync
                                           * MSB first
                                           * No extra bit padding
                                           * Padding bit (ignore)
                                           * slot Size is 16
                                           * Reads from DMA port
                                           * NO rotation
                                           */
            /* .afsrctl  = */ 0x00000111, /* 2-slot TDM(I2S),
                                           * Frame sync is one word
                                           * Falling edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .rtdm     = */ 0x00000003, /* slot 0 and slot 1 are active (I2S)               */
            /* .rintctl  = */ 0x00000003, /* sync error and overrun error         */
            /* .rstat    = */ 0x000001FF, /* reset any existing status bits       */
            /* .revtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
            {
                 /* .aclkrctl  = */ 0x00000080,
                 /* .ahclkrctl = */ 0x00000000,
                 /* .rclkchk   = */ 0x00000000
            }
    } ;

    Mcasp_HwSetupData mcaspXmtSetup = {
            /* .xmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
            /* .xfmt     = */ 0x00018070, /*
                                           * 1 bit delay from framsync
                                           * MSB first
                                           * No extra bit padding
                                           * Padding bit (ignore)
                                           * slot Size is 16
                                           * Reads from DMA port
                                           * NO rotation
                                           */
            /* .afsxctl  = */ 0x00000111, /* 2-slot TDM(I2S),
                                           * Frame sync is one word
                                           * Falling edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .xtdm     = */ 0x00000003, /* slot 0 and slot 1 are active (I2S)               */
            /* .xintctl  = */ 0x00000007, /* sync error,overrun error,clK error   */
            /* .xstat    = */ 0x000001FF, /* reset any existing status bits       */
            /* .xevtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
            {
                 /* .aclkxctl  = */ 0x00000080, /* shift data out on falling edge */
                 /* .ahclkxctl = */ 0x00000000,
                 /* .xclkchk   = */ 0x00000000
            },

    };


    /* McBsp channel parameters                                  */
    Mcasp_ChanParams  mcasp_chanparam[Audio_NUM_CHANS]=
    {
        {
            0x0001,                    /* number of serialisers      */
            {Mcasp_SerializerNum_0, }, /* serialiser index           */
            &mcaspRcvSetup,
            TRUE,
            Mcasp_OpMode_TDM,          /* Mode (TDM/DIT)             */
            Mcasp_WordLength_16,
            NULL,
            0,
            NULL,
            NULL,
            2,                        /* number of TDM channels      */
            Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED,
            TRUE,
            FALSE
        },
        {
            0x0001,                   /* number of serialisers       */
            {Mcasp_SerializerNum_5,},
            &mcaspXmtSetup,
            TRUE,
            Mcasp_OpMode_TDM,
            Mcasp_WordLength_16,      /* word width                  */
            NULL,
            0,
            NULL,
            NULL,
            2,                        /* number of TDM channels      */
            Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED,
            TRUE,
            FALSE
        }
    };

    Weiwei Zheng

  • Hi Weiwei,

    Actually, I have reviewed all McASP registers which you have modified in the code for I2S mode in both Tx and Rx format and even audioAic31Params structure seems to be good for I2S mode. Everything seems to be fine and i don't think, any issues in the code.

    But one small clarification, even though it is configured for 2-slot TDM, you are also allowed to configure Frame sync in one bit format instead of one word as per mentioned in TRM. May be you shall have a try in configuring 2-slot TDM Frame sync in one bit format. Actually, Frame sync in one bit format shall be configured for both burst mode by default as well TDM mode. Otherthan this, i do not have any specific question regarding your modification in the code for I2S format.

    Have you got any improvement in output noise in configuring McASP for 16-bit format?

    Please let us know, if you have any update on the same.

    Thanks & regards,

    Sivaraj K

    ----------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    ----------------------------------------------------------------------------------------------------------