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.

[OMAP-L138] audioSample codec sampling rate

Other Parts Discussed in Thread: OMAPL138, TLV320AIC3106

Hi,

I am using omapl138 evm. I ran audioSample and everything works fine. Is there any way to change sampling rate to 9600? When I put that value in codec configuration, SIO_create() hangs the program.

  • Mariana,

    I am using PSP ver 1_30_00.

    When i chcange sampling rate to 8k, 24k, 44.1k, 48k or 96k, everything is ok. But I need sampling rate 9.6k.

    I'll check 1_30_01 version of the psp and tell if it helped.

  • I looked into souces and i found something:

    (...)

     if ((ICodec_Channel_INPUT == acChannel) ||
            (ICodec_Channel_OUTPUT == acChannel))
        {

            switch (sampleRate)
            {
                case 8000:
                    /* Set sampling rate to 8000Hz */
                    pllPValue      = 4u;
                    pllRValue      = 1u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 0u;
                    fsRef          = 0u;
                    sampleRateDiv  = 10u;
                    break;

                case 11025:
                    /* Set sampling rate to 11025Hz */
                    pllPValue      = 2u;
                    pllRValue      = 1u;
                    pllJValue      = 7u;
                    pllDLowValue   = 44u;
                    pllDHighValue  = 54u;
                    dualRate       = 0u;
                    fsRef          = 1u;
                    sampleRateDiv  = 6u;
                    break;

                case 16000:
                    /* Set sampling rate to 16000Hz */
                    pllPValue      = 4u;
                    pllRValue      = 1u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 0u;
                    fsRef          = 0u;
                    sampleRateDiv  = 4u;
                    break;

                case 22050:
                    /* Set sampling rate to 22050Hz */
                    pllPValue      = 2u;
                    pllRValue      = 1u;
                    pllJValue      = 7u;
                    pllDLowValue   = 44u;
                    pllDHighValue  = 54u;
                    dualRate       = 0u;
                    fsRef          = 1u;
                    sampleRateDiv  = 2u;
                    break;

                case 24000:
                    /* Set sampling rate to 24000Hz */
                    pllPValue      = 4u;
                    pllRValue      = 1u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 0u;
                    fsRef          = 0u;
                    sampleRateDiv  = 2u;
                    break;

                case 32000:
                    /* Set sampling rate to 32000Hz */
                    pllPValue      = 4u;
                    pllRValue      = 1u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 0u;
                    fsRef          = 0u;
                    sampleRateDiv  = 1u;
                    break;

                case 44100:
                    /* Set sampling rate to 44100Hz */
                    pllPValue      = 2u;
                    pllRValue      = 1u;
                    pllJValue      = 7u;
                    pllDLowValue   = 44u;
                    pllDHighValue  = 54u;
                    dualRate       = 0u;
                    fsRef          = 1u;
                    sampleRateDiv  = 0u;
                    break;

                case 48000:
                    /* Set sampling rate to 48000Hz */
                    pllPValue      = 4u;
                    pllRValue      = 1u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 0u;
                    fsRef          = 0u;
                    sampleRateDiv  = 0u;
                    break;

                case 96000:
                    /* Set sampling rate to 96000Hz */
                    pllPValue      = 4u;
                    pllRValue      = 1u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 1u;
                    fsRef          = 0u;
                    sampleRateDiv  = 0u;
                    break;
                default:
                    /* Sampling rate is not supported */
                    status = IOM_EBADARGS;
                    break;
            }

    (...)

    So I know why it doesn't work. I will have to add case 9600. My new question is why in case 8000 sampleRateDiv = 10u? I thought it should be sampleRateDiv = 6u. If it was like i thought, I would add case 9600 with sampleRateDiv = 5u.

  • Please see the codec datasheet (pages 29/30) at:

    http://www.ti.com/lit/gpn/tlv320aic3106

    From a codec stand point (I'm not a specialist in codecs), I would use:

                case 9600:
                    /* Set sampling rate to 16000Hz */
                    pllPValue      = 4u;
                    pllRValue      = 3u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 0u;
                    fsRef          = 0u;
                    sampleRateDiv  = 10u;
                    break;

     

  • Actually, sorry, per codec datasheet, 9600 is not supported:

    "The TLV320AIC3106 supports the following standard audio sampling rates: 8 kHz, 11.025 kHz, 12 kHz, 16 kHz, 22.05 kHz, 24 kHz, 32 kHz, 44.1 kHz, 48 kHz, 88.2 kHz, and 96 kHz"

  • Mariana,

    I've read this datasheet and on page 28 it is written:

    (...)

    "The TLV320AIC3106 supports the following standard audio sampling rates: 8 kHz, 11.025 kHz, 12 kHz, 16 kHz,
    22.05 kHz, 24 kHz, 32 kHz, 44.1 kHz, 48 kHz, 88.2 kHz, and 96 kHz. The converters can also operate at
    different sampling rates in various combinations, which are described further below.
    "

    (...)

    The sampling rate of the ADC and DAC can be set to fS(ref)/NDAC or 2×fS(ref)/NDAC, with NDAC being 1, 1.5, 2,
    2.5, 3, 3.5, 4, 4.5, 5, 5.5, or 6.

    (...)

    According to this I should be able to set sampling rate 9.6kHz by choosing fS = 48kHz and NDAC 5.

  • Hi Adam,

    That might be truth, but again, I'm not a codec specialist. If you need to confirm I would recommend you to post in a forum more specific to the codec, not the DSP forum...

  • case 9600:

                    /* Set sampling rate to 9600Hz */
                    pllPValue      = 4u;
                    pllRValue      = 1u;
                    pllJValue      = 16u;
                    pllDLowValue   = 0u;
                    pllDHighValue  = 0u;
                    dualRate       = 0u;
                    fsRef          = 0u;
                    sampleRateDiv  = 8u;
                    break;

     

    This is the answer , I received on that "codec" forum, and it worked. Here is the link to the thread about sampling rate.

  • Thanks for sharing that Adam!