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.

Audio loopback example using psp driver for 6748 lcdk

I want to run Audio loopback  example inside psp driver example on 6748 lcdk. I have installed c6sdk_02_00_00_00 , C6000 Code Generation Tools 7.3.1 and CcsV6.1.

I tried to use psp driver example "audio loopback " for evm6748 , but could not make it work even after reading posts on this issue. 

Help me please.

Ani.

  • Anil,

    Your questions seems to be more specific to the BIOS PSP and the SDK rather than TI-RTOS. I went ahead and moved this thread over to the device forum in hopes that you will get a faster response there.
  • Dear Anil,
    What error/problem exactly are you getting ?
    Not able to build or not able to run ?

    Can you provide some more information like version, example, location etc., ?
  • Thanks for responses, 

    more details of what i did: 

    I replaced I2C example project code with audioSample_io.c and audioSample_main.c from following path: biospsp_03_00_01_00\drivers\examples\evm6748\audio\src

    I could build it after setting pathnames and environment variables by reading "C6748_BIOSPSP_Userguide.pdf".

    Required 8KHz sampling rate with 24bits/sample and 16 bit word length. When running,  am getting both clocks  required and External device accept these clocks and starts giving input to AXR7.

    So I2C communication works fine.

    After printing "EDMA driver initialization PASS", code hangs at the line :

    /* Reclaim full buffer from the input stream */
    status = GIO_reclaim(inStream, (Ptr *)&rcv, NULL, NULL);

    1. Do I need to enable any mcasp  interrupts manually  after than  functions edma3init(), createStreams() and prime() ?

    2. Please help me by checking cfg file example code modification. 

    3. I have rebuilt "BIOS PSP Driver Modules" using command "gmake libs" but  I dont have  platform specific files for building LCDK6748. 

    HW connections:

    AXR7 - input from external audio device

    AXR15 - out put to external audio device

    also WCLK and BCLK connected. 

    audioSample_main.c
    /*
     * audioSample_main.c
     *
     * This file contains the test / demo code to demonstrate the Audio component 
     * driver functionality on SYS/BIOS 6.
     *
     * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
     *
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
    */
    
    /** \file   audioSample_main.c
     *
     *  \brief    sample application for demonstration of audio driver usage
     *
     *  This file contains the implementation of the sample appliation for the
     *  demonstration of audio playing through the audio interface layer.
     *
     *             (C) Copyright 2009, Texas Instruments, Inc
     */
    
    /* ========================================================================== */
    /*                            INCLUDE FILES                                   */
    /* ========================================================================== */
    
    #include <xdc/std.h>
    #include <string.h>
    #include <xdc/runtime/log.h>
    #include <ti/sysbios/knl/task.h>
    #include <ti/sysbios/io/GIO.h>
    #include <ti/sysbios/BIOS.h>
    #include <xdc/runtime/System.h>
    
    #include <mcasp/include/Mcasp.h>
    #include <platforms/codec/include/Aic31.h>
    #include <platforms/evm6748/Audio_evmInit.h>
    #include <platforms/evm6748/audio/include/Audio.h>
    #include <ti/sdo/edma3/drv/edma3_drv.h>
    
    //Anil
    #include <i2c/include/I2c.h>
    #include <cslr/soc_C6748.h>
    #include <cslr/cslr_syscfg0_C6748.h>
    
    /* ========================================================================== */
    /*                           MACRO DEFINTIONS                                 */
    /* ========================================================================== */
    
    
    /*
     * Mcasp device params. To be filled in userMcaspInit function which
     * is called before driver creation
     */
    Mcasp_Params audioMcaspParams;
    
    /*
     * Aic31 device params. To be filled in userAic31Init function which
     * is called before driver creation
     */
    Aic31_Params audioAic31Params;
    
    /*
     * Audio device params. To be filled in userAudioInit function which
     * is called before driver creation
     */
    
    Audio_Params audioParams;
    
    /* Handle to the EDMA driver instance                                         */
    EDMA3_DRV_Handle hEdma;
    
    /* ========================================================================== */
    /*                           FUNCTION DEFINITIONS                             */
    /* ========================================================================== */
    
    
    //For internal codec i2s
    void configureAudio2(void)
    {
    CSL_SyscfgRegsOvly syscfgRegs = (CSL_SyscfgRegsOvly)CSL_SYSCFG_0_REGS;
    Uint32 savePinmux0 = 0;
    Uint32 savePinmux1 = 0;
    Uint32 savePinmux2 = 0;  //Anil :
    Uint32 savePinmux4 = 0;
    
    #ifdef KICK_REG_ENABLE
    /*Enable write access to PINMUX and CFG registers in KICK0R and KICK1R */
    KICK0_REGISTER = KICK0_ENABLE_KEY;
    KICK1_REGISTER = KICK1_ENABLE_KEY;
    #endif
    
    savePinmux0 = (syscfgRegs->PINMUX0 &
    ~(CSL_SYSCFG_PINMUX0_PINMUX0_3_0_MASK |
    CSL_SYSCFG_PINMUX0_PINMUX0_7_4_MASK |
    CSL_SYSCFG_PINMUX0_PINMUX0_11_8_MASK |
    CSL_SYSCFG_PINMUX0_PINMUX0_15_12_MASK|
    CSL_SYSCFG_PINMUX0_PINMUX0_19_16_MASK|
    CSL_SYSCFG_PINMUX0_PINMUX0_23_20_MASK|
    CSL_SYSCFG_PINMUX0_PINMUX0_27_24_MASK|
    CSL_SYSCFG_PINMUX0_PINMUX0_31_28_MASK));
    
    savePinmux1 = (syscfgRegs->PINMUX1 &
    ~(CSL_SYSCFG_PINMUX1_PINMUX1_31_28_MASK   |    //));//| 	//axr8
    //CSL_SYSCFG_PINMUX1_PINMUX1_19_16_MASK|
    //CSL_SYSCFG_PINMUX1_PINMUX1_15_12_MASK|
    //CSL_SYSCFG_PINMUX1_PINMUX1_11_8_MASK)); //axr13
    CSL_SYSCFG_PINMUX1_PINMUX1_3_0_MASK));	//select function axr15 on pin
    
    savePinmux2 = (syscfgRegs->PINMUX2 &
    ~(CSL_SYSCFG_PINMUX2_PINMUX2_3_0_MASK));//| 	//axr7
    
    
    savePinmux4 = (syscfgRegs->PINMUX4 &
    ~(CSL_SYSCFG_PINMUX4_PINMUX4_11_8_MASK |
    CSL_SYSCFG_PINMUX4_PINMUX4_15_12_MASK));
    
    /* write to the pinmux registers to enable the mcasp0 and i2c0 */
    syscfgRegs->PINMUX0 = (savePinmux0 | 0x01111111);
    syscfgRegs->PINMUX1 = (savePinmux1 | 0x10000001); //Anil
    syscfgRegs->PINMUX2 = (savePinmux2 | 0x00000001); //Anil
    syscfgRegs->PINMUX4 = (savePinmux4 | 0x00002200);
    }
    
    
    
    /**
     *  \brief  Void main(Void)
     *
     *   Main function of the sample application. This function enables
     *   the mcasp instance in the power sleep controller and also
     *   enables the pinmux for the mcasp 1 instance.
     *
     *  \param  None
     *  \return None
     */
    Void main(Void)
    {
        Log_info0("\r\nAudio Sample Main\n");
    
        /* enable the pinmux for the mcasp device    */
        //configureAudio();
        configureAudio2(); //port for lcdk
    
    
    
        BIOS_start();
    
        return;
    }
    
    
    /*
     * Aic31 init function called when creating the driver.
     */
    void audioUserAic31Init()
    {
        Aic31_init();
        audioAic31Params = Aic31_PARAMS;
        audioAic31Params.acType =  ICodec_CodecType_AIC31;
        audioAic31Params.acControlBusType  = ICodec_ControlBusType_I2C;
        audioAic31Params.acCtrlBusName = "/i2c0";
        audioAic31Params.acOpMode = ICodec_OpMode_MASTER; 
        audioAic31Params.acSerialDataType = ICodec_DataType_I2S;
        audioAic31Params.acSlotWidth = ICodec_SlotWidth_24;
        audioAic31Params.acDataPath = ICodec_DataPath_TXRX;
        audioAic31Params.isRxTxClockIndependent = 0;
    }
    
    /*
     * Mcasp init function called when creating the driver.
     */
    void audioUserMcaspInit()
    {
        Mcasp_init();
        audioMcaspParams = Mcasp_PARAMS;
        audioMcaspParams.hwiNumber = 8;
    
    }
    
    /*
     * Audio init function called when creating the driver.
     */
    void audioUserAudioInit()
    {
        Audio_init();
        audioParams = Audio_PARAMS;
        audioParams.adDevType = Audio_DeviceType_McASP;
        audioParams.adDevName = "/mcasp0";
        audioParams.acNumCodecs = 1;
        audioParams.acDevName[0] = "/aic310";
    }
    
    
    /* ========================================================================== */
    /*                                END OF FILE                                 */
    /* ========================================================================== */
    
    audioSample_io.c
    /*
     * audioSample_io.c
     *
     * This file contains the test / demo code to demonstrate the Audio component 
     * driver functionality on SYS/BIOS 6.
     *
     * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
     *
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
    */
    
    /** \file     audioSample_io.c
     *
     *  \brief    sample application for demostration of audio playing
     *
     *  This file contains the implementation of the sample appliation for the
     *  demonstration of audio playing through the audio interface layer.
     *
     *             (C) Copyright 2009, Texas Instruments, Inc
     */
    
    /* ========================================================================== */
    /*                            INCLUDE FILES                                   */
    /* ========================================================================== */
    
    #include <xdc/std.h>
    #include <ti/sysbios/io/GIO.h>
    #include <ti/sysbios/io/iom.h>
    #include <xdc/runtime/Memory.h>
    #include <ti/sysbios/heaps/HeapMem.h>
    #include <xdc/runtime/IHeap.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/Log.h>
    #include <xdc/runtime/System.h>
    #include <ti/sysbios/BIOS.h>
    #include <mcasp/include/Mcasp.h>
    #include <platforms/evm6748/audio/include/Audio.h>
    #include <ti/sdo/edma3/drv/edma3_drv.h>
    
    
    /* ========================================================================== */
    /*                          IMPORTED VARIABLES                                */
    /* ========================================================================== */
    
    EDMA3_DRV_Handle edma3init(unsigned int edma3Id, EDMA3_DRV_Result *);
    extern EDMA3_DRV_Handle hEdma;
    extern HeapMem_Handle myHeap;
    
    /* ========================================================================== */
    /*                          MACRO DEFINITIONS                                 */
    /* ========================================================================== */
    
    /*
     * Buffers placed in external memory are aligned on a 128 bytes boundary.
     * In addition, the buffer should be of a size multiple of 128 bytes for
     * the cache work optimally on the C6x.
     */
    #define BUFLEN                  1024         /* number of samples in the frame */
    #define BUFALIGN                128 /* alignment of buffer for use of L2 cache */
    
    
    /** Number of serializers configured for record */
    #define RX_NUM_SERIALIZER       (1u)
    #define TX_NUM_SERIALIZER       (1u)
    
    #define BUFSIZE                 (BUFLEN * sizeof(Ptr))
    
    #define NUM_BUFS                2   /* Num Bufs to be issued and reclaimed */
    
    /* inStream and outStream are stream handles created in main */
    static GIO_Handle inStream, outStream;
    
    /* Function prototype */
    static Void createStreams();
    static Void prime();
    
    Ptr buf[NUM_BUFS * 2];
    
    
    
    
    
    
    
    
    
    Mcasp_HwSetupData mcaspRcvSetup = {
            /* .rmask    = */ 0xffffFFff, /* All the data bits are to be used     */
            /* .rfmt     = */ 0x000180b0, /* 0x00018070 for 16, 0x000180b0 for 24, 0x000180f0 for 32 */
                                           /* 1 bit delay from framsync
                                           * MSB first
                                           * No extra bit padding
                                           * Padding bit (ignore)
                                           * slot Size is 24
                                           * Reads from DMA port
                                           * NO rotation
                                           */
            /* .afsrctl  = */ 0x00000111, /* burst mode,
                                           * Frame sync is frame
                                           * Rising edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .rtdm     = */ 0x00000003, /* slot 1 and 2 is 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  = */ 0x00000000,
                 /* .ahclkrctl = */ 0x00000000,
                 /* .rclkchk   = */ 0x00000000
            }
    } ;
    
    Mcasp_HwSetupData mcaspXmtSetup = {
            /* .xmask    = */ 0xffffFFff, /* All the data bits are to be used     */
            /* .xfmt     = */ 0x000180b6, /* 0x00018074 for 16, 0x000180b6 for 24, 0x000180f0 for 32 */
                                          /* 1 bit delay from framsync
                                           * MSB first
                                           * No extra bit padding
                                           * Padding bit (ignore)
                                           * slot Size is 24
                                           * Reads from DMA port
                                           * 24 bit rotation
                                           */
            /* .afsxctl  = */ 0x00000111, /* burst mode,
                                           * Frame sync is frame
                                           * Rising edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .xtdm     = */ 0x00000003, /* slot 1 and 2 is 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,
                 /* .ahclkxctl = */ 0x00000000,
                 /* .xclkchk   = */ 0x00000000
            },
    
    };
    
    
    
    
    
    
    
    
    
    
    
    
    #if 0 // EDIT_1
    
    Mcasp_HwSetupData mcaspRcvSetup = {
             /* .rmask    = */ 0x0000FFFF, // Anil : 0xFFFFFFFF, /* All the data bits are to be used     */
    		// /* .rmask    = */ 0xFFFF0000,
    
    //		/* .rfmt     = */ 0x000180F0, /*
    //                                       * 1 bit delay from framsync  <<< Anil :changed to 1 bit delay
    //                                       * MSB first
    //                                       * No extra bit padding
    //                                       * Padding bit (ignore)
    //                                       * slot Size is 32
    //                                       * Reads from DMA port
    //                                       * NO rotation
    //                                       */
    
    		 /* .rfmt     = */ 0x000180B6, /*
    		                                        * 1 bit delay from framsync  <<< Anil :changed to 1 bit delay
    		                                        * MSB first
    		                                        * No extra bit padding
    		                                        * Padding bit (ignore)
    		                                        * slot Size is 24
    		                                        * Reads from DMA port
    		                                        * right by 24 bit rotation
    		                                        */
            /* .afsrctl  = */  0x00000110, // 0x00000110,
    										/* 2-slot TDM (I2S mode),
                                           * Frame sync width is one word
                                           * Rising edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .rtdm     = */ 0x00000003, /* slot 1 is active (DSP)               */
            /* .rintctl  = */ 0x00000003, /* sync error and overrun error         */
            /* .rstat    = */ 0x000001FF, /* reset any existing status bits       */
            /* .revtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
            {
                 /* .aclkrctl  = */ 0x00000000,
                 /* .ahclkrctl = */ 0x00000000,
                 /* .rclkchk   = */ 0x00000000
            }
    } ;
    
    Mcasp_HwSetupData mcaspXmtSetup = {
             /* .xmask    = */0x00000FFFF, //Anil : 0xFFFFFFFF, /* All the data bits are to be used     */
    		// /* .rmask    = */ 0xFFFF0000,
    		 //		/* .rfmt     = */ 0x000180F0, /*
    		 //                                       * 1 bit delay from framsync  <<< Anil :changed to 1 bit delay
    		 //                                       * MSB first
    		 //                                       * No extra bit padding
    		 //                                       * Padding bit (ignore)
    		 //                                       * slot Size is 32
    		 //                                       * Reads from DMA port
    		 //                                       * NO rotation
    		 //                                       */
    
    		 		 /* .rfmt     = */ 0x000180B6, /*
    		 		                                        * 1 bit delay from framsync  <<< Anil :changed to 1 bit delay
    		 		                                        * MSB first
    		 		                                        * No extra bit padding
    		 		                                        * Padding bit (ignore)
    		 		                                        * slot Size is 24
    		 		                                        * Reads from DMA port
    		 		                                        * right by 24 bit rotation
    		 		                                        */
            /* .afsxctl  = */ 0x00000110, /* 2-slot TDM (I2S mode),
                                           * Frame sync width is Single word
                                           * Rising edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .xtdm     = */ 0x00000003, /* slot 1 is active (DSP)               */
            /* .xintctl  = */ 0x00000003, /* 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
            },
    
    };
    
    #endif
    
    
    
    #if 0 //ORIGINAL
    
    Mcasp_HwSetupData mcaspRcvSetup = {
            /* .rmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
            /* .rfmt     = */ 0x000080F0, /*
                                           * 0 bit delay from framsync
                                           * MSB first
                                           * No extra bit padding
                                           * Padding bit (ignore)
                                           * slot Size is 32
                                           * Reads from DMA port
                                           * NO rotation
                                           */
            /* .afsrctl  = */ 0x00000000, /* burst mode,
                                           * Frame sync is one bit
                                           * Rising edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .rtdm     = */ 0x00000001, /* slot 1 is active (DSP)               */
            /* .rintctl  = */ 0x00000003, /* sync error and overrun error         */
            /* .rstat    = */ 0x000001FF, /* reset any existing status bits       */
            /* .revtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
            {
                 /* .aclkrctl  = */ 0x00000000,
                 /* .ahclkrctl = */ 0x00000000,
                 /* .rclkchk   = */ 0x00000000
            }
    } ;
    
    Mcasp_HwSetupData mcaspXmtSetup = {
            /* .xmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
            /* .xfmt     = */ 0x000080F0, /*
                                           * 0 bit delay from framsync
                                           * MSB first
                                           * No extra bit padding
                                           * Padding bit (ignore)
                                           * slot Size is 32
                                           * Reads from DMA port
                                           * NO rotation
                                           */
            /* .afsxctl  = */ 0x00000000, /* burst mode,
                                           * Frame sync is one bit
                                           * Rising edge is start of frame
                                           * externally generated frame sync
                                           */
            /* .xtdm     = */ 0x00000001, /* slot 1 is active (DSP)               */
            /* .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
            },
    
    };
    #endif
    
    
    /* McBsp channel parameters                                  */
    Mcasp_ChanParams  mcasp_chanparam[Audio_NUM_CHANS]=
    {
        {
            0x0001,                    /* number of serialisers      */
            //{Mcasp_SerializerNum_12, }, /* serialiser index           */
    		{Mcasp_SerializerNum_7, }, /* serialiser index           */ //Anil porting to lcdk
            &mcaspRcvSetup,
            TRUE,
            Mcasp_OpMode_TDM,          /* Mode (TDM/DIT)             */
            //Mcasp_WordLength_16, //Anil : Mcasp_WordLength_32,
    		Mcasp_WordLength_24,
    		NULL,
            0,
            NULL,
            NULL,
            2,//Anil : 1,                        /* number of TDM channels      */
    		//Mcasp_BufferFormat_1SER_MULTISLOT_NON_INTERLEAVED, //Anil :Mcasp_BufferFormat_1SER_1SLOT,
    		Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED, //not sure
    		TRUE,
            TRUE
        },
        {
            0x0001,                   /* number of serialisers       */
            //{Mcasp_SerializerNum_11,},
    		//{Mcasp_SerializerNum_8,},		//Anil porting to lcdk
    		{Mcasp_SerializerNum_15,},
            &mcaspXmtSetup,
            TRUE,
            Mcasp_OpMode_TDM,
    		//Mcasp_WordLength_16,	//Anil : Mcasp_WordLength_32,      /* word width                  */
    		Mcasp_WordLength_24,
    		NULL,
            0,
            NULL,
            NULL,
    		2,//Anil : 1,                        /* number of TDM channels      */
    		//Mcasp_BufferFormat_1SER_MULTISLOT_NON_INTERLEAVED, //Mcasp_BufferFormat_1SER_1SLOT,
    		Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED, //not sure
    		TRUE,
            TRUE
        }
    };
    
    
    
    
    
    Audio_ChannelConfig audioChanParamsIN =
    {
        /*  channel 0 (RX)                         */
        (Ptr)&mcasp_chanparam[0], 
        {   /* codec [0]                           */
            {
            		8000,//44100, Anil  /* sampling rate for codec */
                   30, //Anil : 30,  /* gain (%) for codec      */
    			   0x384000,//0x00,
    			   0x02,//0x00,
            }
        }
    };
    
    Audio_ChannelConfig audioChanParamsOUT =
    {        
        /*  channel 1 (TX)                         */
        (Ptr)&mcasp_chanparam[1],      
        {
            /* codec [1]                           */
            {
            		8000,//44100, Anil  /* sampling rate           */
                   70, //Anil : 70,  /* gain (%) for codec      */
    			   0x384000,//0x00,
    			   0x02,//0x00,
            }
        }
    };
    
    
    /*
     * ======== createStreams ========
     */
    static Void createStreams()
    {
    	Error_Block eb;
    	GIO_Params ioParams;
    	
        mcasp_chanparam[0].edmaHandle = hEdma;
        mcasp_chanparam[1].edmaHandle = hEdma;
        
        Error_init(&eb);
        GIO_Params_init(&ioParams);
        
        ioParams.chanParams = &audioChanParamsIN;
        ioParams.model 		= GIO_Model_ISSUERECLAIM;
    
        inStream = GIO_create("/audio0", GIO_INPUT, &ioParams, &eb);
        if (inStream == NULL)
        {
            System_printf("\r\nCreate input stream FAILED.\n");
            BIOS_exit(0);
        }
    
        GIO_Params_init(&ioParams);
        
        ioParams.chanParams = &audioChanParamsOUT;
        ioParams.model 		= GIO_Model_ISSUERECLAIM; 
          
        outStream = GIO_create("/audio0", GIO_OUTPUT, &ioParams, &eb);
        if (outStream == NULL)
        {
            System_printf("\r\nCreate output stream FAILED.\n");
            BIOS_exit(0);
        }
    }
    
    /*
     * ======== prime ========
     */
    static Void prime()
    {
    	Error_Block  eb;
        Int32        count = 0;
        IHeap_Handle iheap;
    
        iheap = HeapMem_Handle_to_xdc_runtime_IHeap(myHeap);
        Error_init(&eb);
        
        /* Allocate buffers for the SIO buffer exchanges                          */
        for(count = 0; count < (NUM_BUFS ); count ++)
        {
            buf[count] = Memory_calloc(iheap, BUFSIZE * RX_NUM_SERIALIZER, 
            														 BUFALIGN, &eb);
            if(NULL == buf[count])
            {
                System_printf("\r\nMEM_calloc failed.\n");
            }
        }
    
        /* Allocate buffers for the SIO buffer exchanges                          */
        for(count = NUM_BUFS; count < (NUM_BUFS * 2); count ++)
        {
            buf[count] = Memory_calloc(iheap, BUFSIZE * TX_NUM_SERIALIZER, 
            														BUFALIGN, &eb);
            if(NULL == buf[count])
            {
                System_printf("\r\nMEM_calloc failed.\n");
            }
        }
    
        for(count = 0; count < NUM_BUFS; count ++)
        {
            /* Issue the first & second empty buffers to the input stream         */
            GIO_issue(inStream, buf[count], BUFSIZE * RX_NUM_SERIALIZER, NULL);
        }
    
        for(count = NUM_BUFS; count < (NUM_BUFS * 2); count ++)
        {
            GIO_issue(outStream, buf[count], BUFSIZE * TX_NUM_SERIALIZER, NULL);
        }
    }
    
    /*
     * ======== echo ========
     * This function copies from the input SIO to the output SIO. You could
     * easily replace the copy function with a signal processing algorithm.
     */
    Void Audio_echo_Task()
    {
        volatile Int32 i32Count;
        
        Ptr rcv 	= NULL;
        Ptr xmt		= NULL;
        Int status	= IOM_COMPLETED;
    
        EDMA3_DRV_Result edmaResult = 0;
    
        hEdma = edma3init(0, &edmaResult);
        
        if (edmaResult != EDMA3_DRV_SOK)
        {
            /* Report EDMA Error */
            System_printf("\nEDMA driver initialization FAIL\n");
        }
        else
        {
            System_printf("\nEDMA driver initialization PASS.\n");
        }
        /* Call createStream function to create I/O streams                       */
        createStreams();
    
        /* Call prime function to do priming                                      */
        prime();
    
        /* Forever loop to continously receviec and transmit audio data           */
        for (i32Count = 0; i32Count >= 0; i32Count++)
        {
        	/* Reclaim full buffer from the input stream                          */
            status = GIO_reclaim(inStream, (Ptr *)&rcv, NULL, NULL);       
            
            /* Reclaim full buffer from the input stream                          */
            if (status != IOM_COMPLETED)
            {
                System_printf("\r\nError reclaiming full buffer from the input stream\n");
            }
            else
            {
            	System_printf("\r\nreclaiming full buffer from the input stream success\n");
            }
    
            /* Reclaim empty buffer from the output stream to be reused           */
            status = GIO_reclaim(outStream, (Ptr *)&xmt, NULL, NULL);
            if (status != IOM_COMPLETED)
            {
                System_printf("\r\nError reclaiming empty buffer from the output stream\n");
            }
            else
    		{
            	System_printf("\r\nreclaiming empty buffer from the output stream Success\n");
    		}
    
    
            /* copy the receive information to the transmit buffer                */
            memcpy(xmt,rcv,BUFSIZE * RX_NUM_SERIALIZER);
    
            /* Issue full buffer to the output stream                             */
            status = GIO_issue(outStream, xmt, BUFSIZE * TX_NUM_SERIALIZER, NULL);
            if (status != IOM_PENDING)
            {
                System_printf("\r\nFailed to issue empty buffer to stream\n");
            }
    
            /* Issue an empty buffer to the input stream                          */
            status = GIO_issue(inStream, rcv, BUFSIZE * RX_NUM_SERIALIZER, NULL);
            if (status != IOM_PENDING)
            {
                System_printf("\r\nFailed to issue empty buffer to stream\n");
            }
        }
    }
    
    4353.audiosample.cfg

  • Rx interrupts occurring, ALWAYS WITH UNDER RUN ERROR! , WHAT may be the possible reasons?