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.

audiosample for EVM 6747

Other Parts Discussed in Thread: CCSTUDIO

Hi,

I just bought a 6747 EVM and I am trying to convert a dsk6713 project to it.
For the dsk 6713 I had used the CCS\examples\dsk6713\bsl\dsk_app project with ping pong buffering.

I was looking for something similar with the new board. So I tried the audio sample project given in pspdrivers_01_20_00 and pspdrivers_01_30_01\packages\ti\pspiom\examples\evm6747\audio.

My problems are the following:

1- How would I handle ping pong buffering with this example?

2- When I use the 01_20_00 version, the program works fine but I can't seem to make it work for 96kHz which is what I need. It seems that even when configured at 96kHz, the codec works at 48kHz.

3- I would like to set the codec to 32 bits data but I am not quite sure how this has to be done, I have tried the following in the audioSample_io.c but I get "Create output stream FAILED".

#define RX_NUM_SERIALIZER       (2u)
#define TX_NUM_SERIALIZER       (2u)

Mcasp_ChanParams mcasp_chanparam[Audio_NUM_CHANS] =
{
{ 0x0002, /* number of serialisers      */
{ Mcasp_SerializerNum_0, }, /* serialiser index           */
&mcaspRcvSetup, TRUE, Mcasp_OpMode_TDM, /* Mode (TDM/DIT)             */
Mcasp_WordLength_32, NULL, 0, NULL, NULL, 1, /* number of TDM channels      */
Mcasp_BufferFormat_MULTISER_MULTISLOT_SEMI_INTERLEAVED_2, TRUE, TRUE },
{ 0x0002, /* number of serialisers       */
{ Mcasp_SerializerNum_5, }, &mcaspXmtSetup, TRUE, Mcasp_OpMode_TDM, Mcasp_WordLength_32, /* word width                  */
NULL, 0, NULL, NULL, 1, /* number of TDM channels      */
Mcasp_BufferFormat_MULTISER_MULTISLOT_SEMI_INTERLEAVED_2, TRUE, TRUE } };

 

4- When I use the pspdrivers_01_30_01, the project can't be built, and I get the following message

--------------------------  audioSample.pjt - Debug  --------------------------
[Linking...] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"Debug.lkf"
<Linking>

 undefined first referenced                                                                                                                                                                               
  symbol       in file                                                                                                                                                                                    
 --------- ----------------                                                                                                                                                                               
 _SWI_new  C:/Program Files/Texas Instruments/pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6747/audio/build/ccs3/../../../../../../../ti\pspiom\mcasp\lib\C6747\Debug\ti.pspiom.mcasp.a674<Mcasp.obj>

error: unresolved symbols remain

"Mcasp.c", line 766: warning: relocation from function "mcaspMdBindDev" to
   symbol "_SWI_new" overflowed; the 31-bit relocated address 0xcfff01c0 is too
   large to encode in the 21-bit signed PC-Relative field (type = 'R_C60PCR21'
   (82), file = "C:/Program Files/Texas
   Instruments/pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6747/audio/bu
   ild/ccs3/../../../../../../../ti\pspiom\mcasp\lib\C6747\Debug\ti.pspiom.mcas
   p.a674<Mcasp.obj>", offset = 0x00000b40, section = ".text:_mcaspMdBindDev")
error: errors encountered during linking; "C:/Program Files/Texas
   Instruments/pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6747/audio/bu
   ild/ccs3/../../bin/Debug/audioSample.out" not built

>> Compilation failure


Build Complete,

  1 Errors, 1 Warnings, 0 Remarks.

 

Any help would be greatly appreciated,

JL

 

  • I will ask the PSP team to answer this question.

  • Hi,

    The PSP driver version 1.20.00 is a older version of the PSP drivers. Please refer to the package 1.30.01 for the latest version of the PSP drivers.

    1. can you elaborate on the “PING PONG buffering”. My understanding is you want to play audio continuously. The driver internally has PING PONG buffering enabled using spare EDMA paramsets and linking them to the main EDMA params to enable continuous audio play.

    2. please let me know how you have configured the 96KHz for the audio codec. In the mean time I would also check to see if there is any problem with the 96KHz configuration.

    3. From your configuration I understand you are trying to use two serializers with single slot enabled. Please confirm. If my assumption is correct you will need to change the configuration to the below.
    {
         0x0002, /* number of serialisers      */
            {
                 Mcasp_SerializerNum_0, 
                 Mcasp_SerializerNum_XX    /*  imtiaz: mention the other serializer number */
           }, /* serialiser index           */
    &mcaspRcvSetup,                                 /* imtiaz : please change the values according to the configuration required */
    TRUE,
    Mcasp_OpMode_TDM,    /* Mode (TDM/DIT)             */
    Mcasp_WordLength_32,
     NULL,
     0,
    NULL,
    NULL,
    1,                                         /* number of TDM channels      */
    Mcasp_BufferFormat_MULTISER_MULTISLOT_SEMI_INTERLEAVED_2,  /*  imtiaz : change to Mcasp_BufferFormat_MULTISER_1SLOT_SER_NON_INTERLEAVED or
                                                                                                                                                   Mcasp_BufferFormat_MULTISER_1SLOT_SER_INTERLEAVED */
    TRUE,
    TRUE
    }


    4. Regarding the compilation error, have you made any changes to the package before compiling? The package is compiled before releasing and hence I do not suspect any problem with the package as such. Can you try using a new package and check it the problem still persists?

    Thanks & Regards,
    Imtiaz SMA

  • Hi, thank you for your answer,

    1-On ping pong buffering you answered my question.

    2-For the 96kHz configuration I used the following lines in audioSample_io.c:

    Audio_ChannelConfig audioChanParamsIN =
    {
       /*  channel 0 (RX)                                            */
        (Ptr)&mcasp_chanparam[0],
        {   /* codec [0]                                              */
            {
                96000,  /* sampling rate for codec */
                   30,  /* gain (%) for codec      */
                 0x00,
                 0x00
            }
        }
    };

    Audio_ChannelConfig audioChanParamsOUT =
    {
        /*  channel 1 (TX)                                            */
        (Ptr)&mcasp_chanparam[1],
        {
            /* codec [1]                           */
            {
                96000,  /* sampling rate           */
                   70,  /* gain (%) for codec      */
                 0x00,
                 0x00
            }
        }
    };

    3- Thank you for your answer, what I am trying to do is get 32 bit words (or 24 bit words) from the codec, with one word for left channel then one word for right channel, interleaved, instead of having left channel and right channel coded as 16 bits LSB and MSB of a single 32 bit word.

    I used what you suggested but what I am obtaining is data interleaved with zeros: in the following picture I injected a sine wave to line in. (displayed as signed 32 bit) Also, when I try writing data to both channels at the same time (assuming they are interleaved), one of them doesn't seem to be taken into account.

     

    And the data I can write to the codec or read from the codec are still 16 bit words...In the codec documentation it says to use Register 9 to change this, but I don't know how to access it from the audiosample package...

    Here is my configuration:

    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
            },

    };


    /* McBsp channel parameters                                  */
    Mcasp_ChanParams  mcasp_chanparam[Audio_NUM_CHANS]=
    {
        {
            0x0002,                    /* number of serialisers      */
            {Mcasp_SerializerNum_0,
            Mcasp_SerializerNum_1 }, /* serialiser index           */
            &mcaspRcvSetup,
            TRUE,
            Mcasp_OpMode_TDM,          /* Mode (TDM/DIT)             */
            Mcasp_WordLength_32,
            NULL,
            0,
            NULL,
            NULL,
            1,                        /* number of TDM channels      */
            Mcasp_BufferFormat_MULTISER_1SLOT_SER_INTERLEAVED ,
            TRUE,
            TRUE
        },
        {
            0x0002,                   /* number of serialisers       */
            {Mcasp_SerializerNum_5,
            Mcasp_SerializerNum_6},
            &mcaspXmtSetup,
            TRUE,
            Mcasp_OpMode_TDM,
            Mcasp_WordLength_32,      /* word width                  */
            NULL,
            0,
            NULL,
            NULL,
            1,                        /* number of TDM channels      */
            Mcasp_BufferFormat_MULTISER_1SLOT_SER_INTERLEAVED ,
            TRUE,
            TRUE
        }
    };

    Audio_ChannelConfig audioChanParamsIN =
    {
       /*  channel 0 (RX)                                            */
        (Ptr)&mcasp_chanparam[0],
        {   /* codec [0]                                              */
            {
                96000,  /* sampling rate for codec */
                   30,  /* gain (%) for codec      */
                 0x00,
                 0x00
            }
        }
    };

    Audio_ChannelConfig audioChanParamsOUT =
    {
        /*  channel 1 (TX)                                            */
        (Ptr)&mcasp_chanparam[1],
        {
            /* codec [1]                           */
            {
                96000,  /* sampling rate           */
                   70,  /* gain (%) for codec      */
                 0x00,
                 0x00
            }
        }
    };


    4-Regarding the package 1.30.01, I stil have a link error, but when I use the old ti.pspiom.mcasp.a674 lib from the 1.20.00 package the link error disappears.



    Thanks and Regards,
    JLK


    PS: I noticed noise which seems  to be generated by the codec at 0Hz, is it normal?

    See below...


  • Hi,

    I am busy in some immediate release work. I will check this and get back to you as soon as possible.

    regards,

    imtiaz

  • Hi,

    1. The changes you are using should be sufficient for the 96KHz configuration. i tried the same configuration for the Aic31 codec and was able to get the 96Khz frame sync
       and checked the same on oscilloscope. The audio is also playing properly.
      
    2. I am confused about the part where you are trying to use two serializers.   The "C6747 EVM" has only one audio codec on board, hence i feel you need only one  serializer for transmit and one for receive(unless you have connected an extra Aic31 to two more serializers).please confirm.

    3. Regarding the problem with compilation i suspect that the 01.30.01 package is  linking the libraries from 01.30.00 package
      
    3. i am assuming (based on you input) that you are trying to get two channel audio   each of 32 bit and assuming that you are only using two serializers(one for
       transmit and one for recevie).

       Based on this assumption please find the configuration as below.
         
       in audioSample_main.c make the following changes to the below function
      
       void audioUserAic31Init()
       {
           Aic31_init();
           audioAic31Params = Aic31_PARAMS;
           audioAic31Params.acCtrlBusName = "/i2c0";
           audioAic31Params.acSlotWidth = ICodec_SlotWidth_32;
       }
          
       in audioSample_io.c add the following

       #define RX_NUM_SERIALIZER       (1u)
       #define TX_NUM_SERIALIZER       (1u)
      
    Mcasp_HwSetupData mcaspRcvSetup = {
            /* .rmask    = */ 0xFFFFFFFF,
            /* .rfmt     = */ 0x000080F0,
            /* .afsrctl  = */ 0x00000101,
            /* .rtdm     = */ 0x00000003,
            /* .rintctl  = */ 0x00000003,
            /* .rstat    = */ 0x000001FF,
            /* .revtctl  = */ 0x00000000,
            {
                 /* .aclkrctl  = */ 0x00000000,
                 /* .ahclkrctl = */ 0x00000000,
                 /* .rclkchk   = */ 0x00000000
            }
    } ;

    Mcasp_HwSetupData mcaspXmtSetup = {
            /* .xmask    = */ 0xFFFFFFFF,
            /* .xfmt     = */ 0x000080F0,
            /* .afsxctl  = */ 0x00000101,
            /* .xtdm     = */ 0x00000003,
            /* .xintctl  = */ 0x00000003,
            /* .xstat    = */ 0x000001FF,
            /* .xevtctl  = */ 0x00000000,
            {
                 /* .aclkxctl  = */ 0x00000000,
                 /* .ahclkxctl = */ 0x00000000,
                 /* .xclkchk   = */ 0x00000000
            },
    };


    /* McAsp 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_32,
            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_32,      /* word width                  */
            NULL,
            0,
            NULL,
            NULL,
            2,                        /* number of TDM channels      */
            Mcasp_BufferFormat_1SER_MULTISLOT_INTERLEAVED,
            TRUE,
            TRUE
        }
    };
     
    regards,
    imtiaz

  • Hi,

    Thank you very much for your answer.

    Actually, I only need one channel (mono) so I configured the codec as follows:

       void audioUserAic31Init()
       {
           Aic31_init();
           audioAic31Params = Aic31_PARAMS;
           audioAic31Params.acCtrlBusName = "/i2c0";
           audioAic31Params.acSlotWidth = ICodec_SlotWidth_32;
       }
         


    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
            },

    };


    /* 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_32,
            NULL,
            0,
            NULL,
            NULL,
            1,                        /* number of TDM channels      */
            Mcasp_BufferFormat_1SER_1SLOT,
            TRUE,
            TRUE
        },
        {
            0x0001,                   /* number of serialisers       */
            {Mcasp_SerializerNum_5,},
            &mcaspXmtSetup,
            TRUE,
            Mcasp_OpMode_TDM,
            Mcasp_WordLength_32,      /* word width                  */
            NULL,
            0,
            NULL,
            NULL,
            1,                        /* number of TDM channels      */
            Mcasp_BufferFormat_1SER_1SLOT,
            TRUE,
            TRUE
        }
    };

    Audio_ChannelConfig audioChanParamsIN =
    {
       /*  channel 0 (RX)                                            */
        (Ptr)&mcasp_chanparam[0],
        {   /* codec [0]                                              */
            {
                   96000,  /* sampling rate for codec */
                   30,  /* gain (%) for codec      */
                 0x00,
                 0x00
            }
        }
    };

    Audio_ChannelConfig audioChanParamsOUT =
    {
        /*  channel 1 (TX)                                            */
        (Ptr)&mcasp_chanparam[1],
        {
            /* codec [1]                           */
            {
                   96000,  /* sampling rate           */
                   70,  /* gain (%) for codec      */
                 0x00,
                 0x00
            }
        }
    };

     

     

    My problem is the following:

    I notice a DC component to the signal see picture below :

    -I try to play a sine wave to the exit, using a lookup table.

    The look up table is generated as follows:

       Int32 *pt_table=table;

    float inv_fs=1/96000;

    float pi=3.14159265;

    float f=442.0f;

    for (i = 0; i < 96000; i++)

    {

    *pt_table+ +=(Int32)(1e8f * sinf(2.0f * pi * f *  i * inv_fs));

    }

     

    and then played in the echo subroutine as follows

    memcpy(xmt,&table[ind_table],BUFSIZE* RX_NUM_SERIALIZER);

    if(ind_table<FS-BUFLEN)

    {

       ind_table+=BUFLEN;

    }

    else

    {

      ind_table=0;

    }

    I expect the sound generated to be a pure sine wave at frequency 442 Hz but it looks corrupt, is it due to the DC component that needs to be added or did I do something wrong? or is the frequency cut by the codec?

    When I connect line out to line in, and display xmt and rcv at the same time, here is what I obtain.

     

    Regards

  • Hi,

    My problem seems to be solved, I added

    audioAic31Params.acDataPath=ICodec_DataPath_TXRX;

    in the audioSample_main.c and I can now play a sine wave at the correct frequency using a look up table (as described in previous message). If I connect headphones to the exit of the board, the sound seems fine.

    However I still have questions regarding the DAC:

    1- I still notice a DC component to the entry: see below (sine wave at the entry)

    2- When I try to visualize the signal on an oscilloscope, it is corrupted by noise at frequencies 120kHz to 2.2MHz (as seen from an FFT on the oscilloscope), which makes it impossible to visualize it in time mode.

     

    Does the DAC generate noise at these frequencies? I have tried several connections between the board and the oscilloscope but I always have the same result. (which I never noticed with the DSK6713). Is it normal?

    Thank you for your answer,


    Best Regards,

  • Hello, 

    I have the same problem : 

    error: unresolved symbols remain

    "Mcasp.c", line 766: warning: relocation from function "mcaspMdBindDev" to
    symbol "_SWI_new" overflowed; the 31-bit relocated address 0xcffefff0 is too
    large to encode in the 21-bit signed PC-Relative field (type = 'R_C60PCR21'
    (82), file = "C:/Program Files/Texas
    Instruments/pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6747/audio/bu
    ild/ccs3/../../../../../../../ti\pspiom\mcasp\lib\C6747\Debug\ti.pspiom.mcas
    p.a674<Mcasp.obj>", offset = 0x00000b08, section = ".text:_mcaspMdBindDev")
    error: errors encountered during linking; "C:/Program Files/Texas
    Instruments/pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6747/audio/bu
    ild/ccs3/../../bin/Debug/audioSample.out" not built

    Can you tell me how did you resolved it please ?

    Best regards,

    Linh