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.

RTOS/AM5728: MCASP_Audio Example on C66x DSP

Part Number: AM5728
Other Parts Discussed in Thread: BEAGLEBOARD-X15

Tool/software: TI-RTOS

Hi experts,

I want to use MCASP_Audio example to perform the FFT on RX samples. So in processing part I copy samples from the buffer to array 'x'.

memcpy((void*)(px),(void *)((uint8_t *)appBuf_ptr_rx->buf),rx_frame_size);

Then I can see that always 4 samples both from left and right channels are the same, for example:

0x8006A478: 0150C35E 017CD506 0150C35E 017CD506 0150C35E 017CD506 0150C35E

so the graf looks like (4 left and 4 right samples are on the same level always):

So I don't really can get FFT without harmonic distortion for pure sin. Do you have any suggestions?

  • JAm,

    Please provide some context here. What is the purpose of computing the FFT of the signals coming in. The data obtained over MCASP si digitized data that is provided by the AIC codec that takes the analog input and passes it through the ADC to provide the left and right channel data to the MCASP serializer.

    You can deinterleave the data and then do frequency analysis or filtering of the data from each channel and then or generate a sine wave data for two channels using PC tools like Audacity and then pass the data to K2G by playing the data from the file through the line in port. You can look at examples like the Audio Equalizer code in the MCASP example to see how to filter the data using biquads.

    www.ti.com/.../tidubq2a.pdf

    Please review that TI design and let us know if you have any further questions regarding this matter.

    Regards,
    Rahul
  • Hi, thanks for your replay.

    This is the case: I generate sine wave on my PC and want to analyze it on DSP with FFT.
    I generated pure sine wave but AIC codec provided with the same value samples 4 times in a row. So, in example,  when my sampling frequency is 44kHz and generated sine wave is 44 / 8 = app. 5 kHz I can see only two levels of samples: high and low - it looks like square signal. So 3 other samples are gone somewhere.

    (Here is some envelope present because I generated not exactly fs/8 Hz)



    Could You explain why those 4 samples are the same? (both for left and right channel - so we see 8 of them) or what I'm doing wrong?

    As I understanded, in biquad example processing is done like there is continuity in derived samples.

    And also when I copy it back to TX it sounds like it is sine wave. So I don't really understand that.

  • <if I didn't say - I'm working on beaglebone x15 with aic3104 - and AHCLK to codec is not provided from mcasp driver but direct from CLKOUT2>

    So, I was able to initialize mcasp to drive it by the interrupts to process samples one by one, because I didn't fully understand how that mcasp BIOS driver used in the example works(especially with use of dma). But now the situation is the same ... I have still groups of 4 samples in the row with same values for both channels as in image above.

    I changed sampling frequency inBIOS AIC driver to smaller values (from 44,1k to 24k, 16k in AIC31_config structure) but it didn't change anything.I still have 4 same samples in the row. So now I'm very confused because only thing I could suspect was that mcasp frame generation is too fast and ADC in codec was not fired yet.

    Do you guys have any suggestions what should I look for? Now I'm going to determine exact values of clock signals used.
  • Ok, so it took my 2 weeks to find a problem. I'm a little tardy a guess.

    There is a bug in pdk_am57xx_1_0_13  I think?
    It's In Aic31 Bios Codec Driver. Initialization of  sampling rate doesn't work. I can recall that I thought at first that the example that sound quality was bad (so now I know that it was low sample rate).

    On beagleboard-x15 codec has to be in slave mode and mcasp on master because of connections (only one rx). 


    Function "AIC31SampleRateConfig()" is never called because it's under if-check in Init function (aic31.c file):

                if (ICodec_OpMode_MASTER == instHandle->acOpMode)
                {
                    AIC31SampleRateConfig(instHandle->acBaseAddress,
                                          AIC31_MODE_BOTH,
                                          acChanConfig->samplingRate);
                }

    So when this driver operates in slave mode AIC3104 codec works with default sampling rate which is 4 times slower (for default 44100 KHz config) because "Q divder" is not initilized.

    To repair that I had to add else statement and also change one line for SLAVE configuration (in SampleRAteConfig func):

        //CodecRegWrite(baseAddr, AIC31_P0_REG8, 0xD0);  //MASTER
        CodecRegWrite(baseAddr, AIC31_P0_REG8, 0x00); // SLAVE

  • This is the same problem reported before:
    e2e.ti.com/.../2083579