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.

AIC23 codec on DSK5510 sample rate settings

Hi,

I am working on a DSK5510 board.

The DSK5510 ref guide from Spectrum digital says that codec has to be programmed to be in USB mode

bit 0(USB/Normal) in the sample rate generator register.

When I use the normal mode, and set the register to work for 8kHz (0x000c), the sample rate come out to be OK

though not exactly 8kHz (with a small drift by 200Hz).

When I use the USB mode and set the register to work for 8kHz (0x000d), the sample rate is not correct (very much less than

8kHz might be about half or 4kHz). Is there some other setting that has to be taken into consideration, when working in USB mode.

And what is the reason to work in USB mode, when normal mode works just fine?

 

Regards,

Aditi.

  • Does the ref guide accessible online?

  • Steve,

    Yes, it's available at http://c5000.spectrumdigital.com/dsk5510/

    I looked it yesterday but it's more AIC related question rather than DSP.

    Regards,

    Hyun

  • Hi Hyun/Steve,

     

    Thank you for the help.

    I have figured out that the problem is with the McBSP port.

     

    I have another problem though.

    I have configured the McBSP2 for 16-bit data receive/transmit.

    The AIC23 codec is also configured to handle 16-bit data. The codec

    sends 16-bit left channel data followed by 16-bit right channel data and a framesync at the start of the left channel data.

    But the McBSP is not able to read 2 16-bit words from the codec (reads only one word) and hence accounts for the reduced sampling rate.

    So my question is do we have to set up the McBSP to handle 32-bit data instead of 16-bit data?

    or is there something else that we need to setup for it to work properly.

     

    Thanks,

    Regards,

    Aditi.

  • Hi,

     

    Could you check frame length and word length correct corresponding to codec configuration?

    Regards,

    Hyun

  • Hyun,

    I have configured the McBSP2 to handle 1 32-bit word (that would be same as handling 2 16-bit words without delay).

    So now the McBSP2 transmits 1 32-bit word.

    Here is a patch of code to read and write to the codec.

    Read 32-bit word from the codec :

    rx_buf[inp_index] = (*(ioport short int *)DRR22_ADDR);  /* read word */
       ++inp_index;
       rx_buf[inp_index] = (*(ioport short int *)(DRR12_ADDR));

    Write 32-bit word to the codec :

    (*(ioport short int*)DXR22_ADDR) = tx_buf[out_index];
       ++out_index;
       (*(ioport short int*)DXR12_ADDR) = tx_buf[out_index];

     

    The problem is the codec is not reading 2 words (left channel and right channel). It is only reading one channel (the first one).

    I have gone through the codec registers to find if there is any thing else that needs to be set, but could not find any.

    Could you please suggest as to what could be done? It is a bit urgent and I need to finish this.

     

    Thank you,

    Regards,

    Aditi.

  • Hi,

    Your setting should match to McBSP data format too.

    One example code attached. It's from a C5509A example. It used the same AIC codec and same McBSP.

    Regards,

    Hyun

    dsk_app.zip
  • Hyun,

    I had done the same thing that is mentioned in the example before i.e. set the McBSP to handle 2 words per frame of 16-bit each.

    (McBSP2 -- RCR1, XCR1 = 0x0140)

    But I had problem with the receiving side of the McBSP. It would read-in only the left channel (the first word from the codec).

    And that has accounted for the sampling rate problem which I stated above.

    So, I had to go back and configure the McbSP to handle 1 32-bit word to read from the codec (McBSP2 -- RCR1, XCR1 = 0x00a0).

    The receive side is working fine. Now when I write (transmit) back to the codec, it is the same 32 bit word ,16-bit left followed by 16-bit right

    (that accounts for 2 16-bit words as would be for the other case). But the codec reads only the first word (or let channel).

     

    Regards,

    Aditi.

     

  • Hi,

     

    I ran out of ideas. Can you send me your code? I want to try out at my site.

    You can send me at hyunkim@ti.com.

    Regards,

    Hyun

  • Hyun,

    I have emailed you the code at the email address that you provided.

    Thanks,

    Regards,
    Aditi.

  • Aditi,

    I received it and I'll try it out later today.

    Regards,

    Hyun