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.

Copy data from memory in C6748 McASP example, need help

Hi Everybody:

 

In LCDK C6748  McASP example,  I try get the  receive  buffer pointer in the memory using following  code,

 

while(1)

    {

        if(lastFullRxBuf != lastSentTxBuf)

        { 

            /*

            ** Start the transmission from the link paramset. The param set

            ** 1 will be linked to param set at PAR_TX_START. So do not

            ** update paRAM set1.

            */

            parToSend =  PAR_TX_START + (parOffTxToSend % NUM_PAR);

            parOffTxToSend = (parOffTxToSend + 1) % NUM_PAR;

            parToLink  = PAR_TX_START + parOffTxToSend;

 

            lastSentTxBuf = (lastSentTxBuf + 1) % NUM_BUF;

            //---

 -- ->         unsigned char * txptr=(unsigned char *)txBufPtr[lastSentTxBuf];

 -- ->         unsigned char * rxptr=(unsigned char *)rxBufPtr[lastFullRxBuf];

                       // SpectrumAnalyze(rxptr, txptr);

            //...

 

            /* Copy the buffer */

            memcpy((void *)txBufPtr[lastSentTxBuf],

                   (void *)rxBufPtr[lastFullRxBuf],

                   AUDIO_BUF_SIZE);

in the rx bufffer byte by byte output  like the following (input is audio signal from line in),   how can I build (digital math) number from this memory content.  look like every word  (32bits), only first two bytes are used,  AIC3106 is 24 bit ADC,  that confuse me. I want to get the data pointed by rxptr, so I can put filter or equalizer,   please help!.

 

  rxBuf1

01000011             00000010             00000000             00000000

10011100             00000010             00000000             00000000

01110101             00000010             00000000             00000000

01100000             00000010             00000000             00000000

00110100             00000010             00000000             00000000

10011011             00000010             00000000             00000000

01110000             00000010             00000000             00000000

01111100             00000010             00000000             00000000

01001101             00000010             00000000             00000000

01111010             00000010             00000000             00000000

00111110             00000010             00000000             00000000

10101110             00000010             00000000             00000000

01110101             00000010             00000000             00000000

01111001             00000010             00000000             00000000

00111010             00000010             00000000             00000000

10111000             00000010             00000000             00000000

01110000             00000010             00000000             00000000

10000111             00000010             00000000             00000000

01010101             00000010             00000000             00000000

01110110             00000010             00000000             00000000

01011011             00000010             00000000             00000000

01101000             00000010             00000000             00000000

01011101             00000010             00000000             00000000

00100011             00000010             00000000             00000000

00100000             00000010             00000000             00000000

01101101             00000010             00000000             00000000

01010101             00000010             00000000             00000000

01010101             00000010             00000000             00000000

00011111             00000010             00000000             00000000

01110100             00000010             00000000             00000000

00110011             00000010             00000000             00000000

10011001             00000010             00000000             00000000

01101010             00000010             00000000             00000000

01000101             00000010             00000000             00000000

00110001             00000010             00000000             00000000

01110101             00000010             00000000             00000000

01100001             00000010             00000000             00000000

01010110             00000010             00000000             00000000

00101010             00000010             00000000             00000000

01110100             00000010             00000000             00000000

00110111             00000010             00000000             00000000

01111110             00000010             00000000             00000000

01010000             00000010             00000000             00000000

00111011             00000010             00000000             00000000

00011111             00000010             00000000             00000000

 

 

  • Hi Mike,
    Thanks for your post.
    To address your query, i have walk through the code of C6748 LCDK McASP,
    as i understand, if you see macro "BYTES_PER_SAMPLE = ((WORD_SIZE >> 3)* NUM_I2S_CHANNELS)".  the calculation goes as below:
    Since WORD_SIZE is 16u & NUM_I2S_CHANNELS is 2u, then BYTES_PER_SAMPLE would be 4. Then each audio sample consumes 4 bytes of characted array rxbuf[1]. Then, the audio data would be 4 bytes each. But, I am not sure about your Rx. buf. output data since you are getting all zeros in all second 2 bytes of data consecutively. In my understanding, there is a mess up in the output Rx. buf. data and the output audio data seems to be wrong.
    Each audio data sample consumes 4 bytes each as per code.
    Thanks & regards,
    Sivaraj K
    ---------------------------------------------------------------------------------
    Please click the
    Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------
     
     
  • Hi Sivaraj K:

    Thanks,  but the audio input from line-in, I got the audio sound at line-out jack, it is correct. the data I got is rxptr pointed to , that is from memory. If the memory messed up, I would get audio sound.

    Now the McASP example  works in loopback model, I intend to get the received data, and do filtering then send back to transmitter.  Please help.

  • HI Sivaraj:

     

    my question is:

     

    In LCDK C6748  McASP example,  I try get the  receive  buffer pointer in the memory using following  code,

     

    while(1)

        {

            if(lastFullRxBuf != lastSentTxBuf)

            { 

                /*

                ** Start the transmission from the link paramset. The param set

                ** 1 will be linked to param set at PAR_TX_START. So do not

                ** update paRAM set1.

                */

                parToSend =  PAR_TX_START + (parOffTxToSend % NUM_PAR);

                parOffTxToSend = (parOffTxToSend + 1) % NUM_PAR;

                parToLink  = PAR_TX_START + parOffTxToSend;

     

                lastSentTxBuf = (lastSentTxBuf + 1) % NUM_BUF;

                //---

     -- ->         unsigned char * txptr=(unsigned char *)txBufPtr[lastSentTxBuf];

     -- ->         unsigned char * rxptr=(unsigned char *)rxBufPtr[lastFullRxBuf];

                           // SpectrumAnalyze(rxptr, txptr);

                //...

     

                /* Copy the buffer */

                memcpy((void *)txBufPtr[lastSentTxBuf],

                       (void *)rxBufPtr[lastFullRxBuf],

                       AUDIO_BUF_SIZE);

    in the rx bufffer byte by byte output  like the following (input is audio signal from line in).

    how can I build (digital math) number from this memory content.  look like every word  (32bits), only first two bytes are used,  AIC3106 is 24 bit ADC,  that confuse me. I want to get the data pointed by rxptr, so I can put filter or equalizer.

      rxBuf1

    01000011             00000010             00000000             00000000

    10011100             00000010             00000000             00000000

    01110101             00000010             00000000             00000000

    01100000             00000010             00000000             00000000

    00110100             00000010             00000000             00000000

    10011011             00000010             00000000             00000000

    01110000             00000010             00000000             00000000

    01111100             00000010             00000000             00000000

    01001101             00000010             00000000             00000000

    01111010             00000010             00000000             00000000

    00111110             00000010             00000000             00000000

    10101110             00000010             00000000             00000000

    01110101             00000010             00000000             00000000

    01111001             00000010             00000000             00000000

     

     

    I know the word is 32bits used up 4 bytes.  why two bytes are always  zero for 24bit ADC? the memcpy is still there.  the signal is audio signal I input from line-in, I connected earphone to line-out, the audio sound is clear, correct; the Rx buffeer could not be messed up, but the data I logout is not understandable.

     

     

    I need a instruction of how I could build math  number from rxBufPtr (the value pointed by rxBufPtr is integer?  float? little/big endian? a byte per address? ).

     

    Thanks!

    Mike

     

  • Hi Mike,

    Thanks for your clarification.

    Please check the C674x DSP CPU and Instruction Set Reference Guide as below:

    http://www.ti.com/lit/ug/sprufe8b/sprufe8b.pdf

    Thanks & regards,

    Sivaraj K

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

  • Hi Mike,

    Actually we have only two suggestions to you,

    1. I don't think, there are instructions that we could build mapping the math. number to the value pointed by rxBufPtr. The only way, we shall directly utilise the value pointed by rxBufPtr in the code, do filtering and send back to transmitter. Since, the C6748 LCDK starterware McASP sample application which you are pointing out, is itself a loopback example which loops back the input at LINE_IN of the EVM to the LINE_OUT of the EVM.

    2. Also, we insist you to check the sequence of LINEIN audio input format and please ensure us that, whether he is getting all zeros in the second 2 bytes of rxBufPtr memory consistently, because, the audio output which you have shared above would be taken at random instantaneous time intervals. I don't think, this should be the case at all point of time of LINEIN audio sequence and the pattern of rxBufPtr data output would vary based on the input sequence. So, we suggest you to change the input audio sequence or audio input sample and check whether the same is happening at all point of time consistently. This would help us to sort out the issue in a better way and to provide you the appropriate reply.

    Thanks for your understanding.

    Thanks & regards,

    Sivaraj K

  • Hi Experts:

    (1)  In LCDK C6748 development board, I used starterware example McASP to loop back the input at LINE_IN to the LINE_OUT of the EVM. The input audio is an hour-long recorded voice, I keep frequently  pause it to refresh rxBuf0, rxBuf1, and rxBuf2 to see the received data pointed by  rxBufPtr.  I am getting all zeros in the second  2 bytes of rxBufPtr memory consistently.  Please see the logout data (partial) for three receive buffers. AIC3106 is 24bits ADC, why the second 2 bytes in 32 bit word are always zero?

    rxBuf0:

    01011001 00000010 00000000 00000000 01110100 00000010 00000000 00000000 01001111 00000010 00000000 00000000 01010101 00000010 00000000 00000000 00110010 00000010 00000000 00000000 10011000 00000010 00000000 00000000 01110010 00000010 00000000 00000000 10000001 00000010 00000000 00000000 01011010 00000010 00000000 00000000 01011111 00000010 00000000 00000000 00111011 00000010 00000000 00000000 10100100 00000010 00000000 00000000 10000000 00000010 00000000 00000000 10010101 00000010 00000000 00000000 01110010 00000010 00000000 00000000 10001001 00000010 00000000 00000000 01100011 00000010 00000000 00000000 10101010 00000010 00000000 00000000 10000100 00000010 00000000 00000000 10010001 00000010 00000000 00000000 01101001 00000010 00000000 00000000 10011111 00000010 00000000 00000000 01111001 00000010 00000000 00000000 10011110 00000010 00000000 00000000 01111001 00000010 00000000 00000000 01111010 00000010 00000000 00000000 01010100 00000010 00000000 00000000 10101111 00000010 00000000 00000000 10001010 00000010 00000000 00000000 10011111 00000010 00000000 00000000 01111000 00000010 00000000 00000000 01101110 00000010 00000000 00000000 01001011 00000010 00000000 00000000 10101101 00000010 00000000 00000000 10000111 00000010 00000000 00000000 10011001 00000010 00000000 00000000 01110010 00000010 00000000 00000000 

    rxBuf1:

    01100101 00000010 00000000 00000000 10001011 00000010 00000000 00000000 01100100 00000010 00000000 00000000 01101010 00000010 00000000 00000000 01000100 00000010 00000000 00000000 10010101 00000010 00000000 00000000 01101101 00000010 00000000 00000000 01101011 00000010 00000000 00000000 01000110 00000010 00000000 00000000 01111010 00000010 00000000 00000000 01010101 00000010 00000000 00000000 10011101 00000010 00000000 00000000 01111000 00000010 00000000 00000000 01111101 00000010 00000000 00000000 01011000 00000010 00000000 00000000 10010001 00000010 00000000 00000000 01101011 00000010 00000000 00000000 10001101 00000010 00000000 00000000 01101001 00000010 00000000 00000000 00011111 00000010 00000000 00000000 11111100 00000001 00000000 00000000 11111100 00000001 00000000 00000000 11010111 00000001 00000000 00000000 00001010 00000010 00000000 00000000 11100010 00000001 00000000 00000000 10111110 00000001 00000000 00000000 10011011 00000001 00000000 00000000 11001010 00000001 00000000 00000000 10100011 00000001 00000000 00000000 10100101 00000001 00000000 00000000 01111111 00000001 00000000 00000000 10011100 00000001 00000000 00000000 01111011 00000001 00000000 00000000 11011010 00000001 00000000 00000000 10110111 00000001 00000000 00000000 10100000 00000001 00000000 00000000 01111101 00000001 00000000 00000000 

    rxBuf2:

    00110100 00000000 00000000 00000000 10101001 11111111 00000000 00000000 10001000 11111111 00000000 00000000 11110010 11111110 00000000 00000000 11010000 11111110 00000000 00000000 10111000 11111110 00000000 00000000 10011001 11111110 00000000 00000000 01011100 11111110 00000000 00000000 00111001 11111110 00000000 00000000 11111000 11111101 00000000 00000000 11011001 11111101 00000000 00000000 00010011 11111110 00000000 00000000 11110010 11111101 00000000 00000000 00000000 11111110 00000000 00000000 11011110 11111101 00000000 00000000 11101011 11111101 00000000 00000000 11001001 11111101 00000000 00000000 00010111 11111110 00000000 00000000 11110110 11111101 00000000 00000000 00010010 11111110 00000000 00000000 11110101 11111101 00000000 00000000 00101011 11111110 00000000 00000000 00001011 11111110 00000000 00000000 00111101 11111110 00000000 00000000 00011101 11111110 00000000 00000000 00010111 11111110 00000000 00000000 11110011 11111101 00000000 00000000 01000100 11111110 00000000 00000000 00100100       

    (2) I need to rebuild back math number from memory content for doing filtering, then send to transmitter. the content in memory is unsigned integer?  integer? float? little/ large endian?  could someone point out?

    Thanks!

    Mike

                       

     

  • Mike,

    I do not have the Starterware example nor an LCDK, so I cannot comment on what is in that code. I do not know if Sivaraj has that code either, since he has not commented on its operation. Perhaps he will post his suggestions here so you can see them.

    The AIC3106 may have different configurations available that define how many bits it will make available and what the syntax is for the bits coming in. The McASP also has configuration registers available that must be programmed to match the expected values from the AIC3106. The data that lands in the buffers will be the result of those configurations, and will also depend on the signal levels of your input analog signal compared to the voltage range of the AIC3106.

    What does the data look like in the McASP example program? I assume the example program simply does a loopback operation, so the correct data may be heard on the output and you can look at the data in the example program's buffers.

    Your data appears to be in 32-bit words, which is the normal result for any incoming data through the McASP. But your data does not look like it changes much for being valid audio data.

    Data from an AIC is generally either unsigned int or signed int, depending on which you have configured the AIC3106 to supply. So my guess is that your configuration is not what is needed to work with the range of data you want. I am not aware of AICs that generate floating-point data.

    The data you show here does not make any logical sense to me for any of the possibilities that I can imagine. There is not enough information to make good suggestions to you, other than for you to go back to the example program and analyze the configuration and data there.

    Regards,
    RandyP

  • Hi Randy.

    Thanks for your information of ' Data from an AIC is generally either unsigned int or signed int, depending on which you have configured the AIC3106 to supply' .

    Best Regards,

    Mike