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.

TPS65950 output not matching input frequency

Other Parts Discussed in Thread: TPS65950

Hello everyone.

I am working on DM37xEVM. I have a sine wave sampled at 44.1kHz and frequency is 345Hz. I have configured my McBSP and TPS65950 at 44.1kHz. When I input these samples to codec, the output from DAC appears at 7.1kHz, Can anyone suggest the possible issue.

  • Hey Muhammad,

    I haven't seen this particular issue. Can you post some scope shots showing the signals?

    Thanks,
    Kevin LaRosa
  • #include <stdio.h>
    #include "I2Ccomm.h"
    #include "beep.h"
    STATUS   Audio_PMIC_Write(UINT8 device_address, UINT8 address, UINT8 value);
    STATUS   Audio_PMIC_Read(UINT8 device_address, UINT8 address, UINT8 buf[]);
    
    UINT16 sin345_wavdata[1024] =
    {
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd,
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd,
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd,
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd,
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd,
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd,
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd,
              0x832, 0x896, 0x8fa, 0x95e, 0x9c0, 0xa22, 0xa82, 0xae1, 0xb3d, 0xb98, 0xbf1, 0xc47, 0xc9b, 0xceb, 0xd39, 0xd84,
              0xdcb, 0xe0e, 0xe4e, 0xe8a, 0xec2, 0xef5, 0xf25, 0xf50, 0xf76, 0xf98, 0xfb5, 0xfce, 0xfe1, 0xff0, 0xffa, 0xfff,
              0xfff, 0xffa, 0xff0, 0xfe1, 0xfce, 0xfb5, 0xf98, 0xf76, 0xf50, 0xf25, 0xef5, 0xec2, 0xe8a, 0xe4e, 0xe0e, 0xdcb,
              0xd84, 0xd39, 0xceb, 0xc9b, 0xc47, 0xbf1, 0xb98, 0xb3d, 0xae1, 0xa82, 0xa22, 0x9c0, 0x95e, 0x8fa, 0x896, 0x832,
              0x7cd, 0x769, 0x705, 0x6a1, 0x63f, 0x5dd, 0x57d, 0x51e, 0x4c2, 0x467, 0x40e, 0x3b8, 0x364, 0x314, 0x2c6, 0x27b,
              0x234, 0x1f1, 0x1b1, 0x175, 0x13d, 0x10a, 0x0da, 0x0af, 0x089, 0x067, 0x04a, 0x031, 0x01e, 0x00f, 0x005, 0x000,
              0x000, 0x005, 0x00f, 0x01e, 0x031, 0x04a, 0x067, 0x089, 0x0af, 0x0da, 0x10a, 0x13d, 0x175, 0x1b1, 0x1f1, 0x234,
              0x27b, 0x2c6, 0x314, 0x364, 0x3b8, 0x40e, 0x467, 0x4c2, 0x51e, 0x57d, 0x5dd, 0x63f, 0x6a1, 0x705, 0x769, 0x7cd
    };
    
    void Codec_Init()
    {
        UINT8 buf;
        Audio_PMIC_Write(0x49, 0x01, 0x00);
        Audio_PMIC_Write(0x49, 0x01, 0x90);      //option 2 enabled./
        Audio_PMIC_Write(0x49, 0x02, 0xC0);
        Audio_PMIC_Write(0x49, 0x43, 0x00);
        Audio_PMIC_Write(0x49, 0x3a, 0x0f);
        Audio_PMIC_Write(0x49, 0x3a, 0x1F);
    
        Audio_PMIC_Write(0x49, 0x2e, 0x00);
    
        Audio_PMIC_Write(0x49, 0x17, 0x0C);
    
        Audio_PMIC_Write(0x49, 0x1b, 0x03);
    
        Audio_PMIC_Write(0x49, 0x1c, 0x03);
    
        Audio_PMIC_Write(0x49, 0x2f, 0xa1);
    
        Audio_PMIC_Write(0x49, 0x0e, 0x00);
        Audio_PMIC_Write(0x49, 0x0e, 0x01);
    
        Audio_PMIC_Read(0x49, 0x01, &buf);
    
        Audio_PMIC_Write(0x49, 0x01, buf|0x02);
    
        Audio_PMIC_Write(0x49, 0x22, 0x2d);   //hs_outlow_en
    
        Audio_PMIC_Write(0x49, 0x12, 0xe1);
    
        Audio_PMIC_Write(0x49, 0x13, 0xe1);  //////////////////
    
        Audio_PMIC_Write(0x49, 0x23, 0x05);
    
        Audio_PMIC_Write(0x49, 0x05, 0x80);
    
        do
        {
            Audio_PMIC_Read(0x49, 0x05, &buf);
        }while(buf != 0x00);
    
        Audio_PMIC_Write(0x49, 0x3e, 0x02);
    
        Audio_PMIC_Read(0x49, 0x01, &buf);
        buf &= ~0x02;
        Audio_PMIC_Write(0x49, 0x01, buf);
    
        Audio_PMIC_Write(0x49, 0x01, buf|0x02);
    
        Audio_PMIC_Write(0x49, 0x24, 0x40);
    
        Audio_PMIC_Write(0x49, 0x23, 0x0a);
    
        Audio_PMIC_Read(0x49, 0x24, &buf);
    
        Audio_PMIC_Write(0x49, 0x24, buf|0x1E);
    }
    void McBSP_Init(void)
    {
        UINT32 temp32;
    
        /* Enable McBSP2 functional clock. */
        temp32 = MEM_READ32(0x48005000);
        MEM_WRITE32(0x48005000, temp32|1);
    
        /* Enable McBSP2 interface clock. */
        temp32 = MEM_READ32(0x48005010);
        MEM_WRITE32(0x48005010, temp32|1);
    
        /* Place McBSP in reset state. */
        MEM_WRITE32(0x49022014, 0x00);
        MEM_WRITE32(0x49022010, 0x00);
    
        MEM_WRITE32(0x49022024, 0x40);         //XCR1
        MEM_WRITE32(0x49022020, 0x8040);       //XCR2
        MEM_WRITE32(0x49022014, (MEM_READ32(0x49022014)|1<<7));
    
        /* Take it out of reset. */
        MEM_WRITE32(0x49022014, 0x01);
        MEM_WRITE32(0x49022010, 0x01);
    }
    void main(void)
    {
        UINT16 i;
    
        /* Configure codec here. */
        Codec_Init();
    
        /* Configure McBSP2. */
        McBSP_Init();
    
        while(1)
        {
            for(i = 0; i< 1024; i++)
            {
                MEM_WRITE32(0x49022008, sin345_wavdata[i]);
            }
        }
    }
    

    Thank you very much for your response.

    I am using DM37x EVM. I am attaching my scope shots and my source code as well. I have configured TPS65950 as master and McBSP2 as slave. The audio file contains an array which is sampled sine wave. It is sampled at 44100Hz and the array contains 8 cycles. Total samples are 1024. So, when played, the output frequency should be 44100/(1024/8) = 345Hz. When I play it, the frequency on scope is above 7kHz.

    Also, when I play an audio file (.wav converted to a C array), I always hear noise and nothing else.

    Sampling frequency of TPS65950 is set at 44100Hz and now, the I2S clk signal is running at 955.53kHz

    Please help,

    Thanks and regards,

    Muhammad Umair Khan

  • Hey Muhammad,

    Have you looked through Chapter 14 on the Technical Reference Manual for this device? That would be located here: www.ti.com/.../swcu050

    It has a whole section on the order of programming to ensure proper audio output. Let me know if it has the information you may be looking for, the source code submitted seemed sparse relative to what I was expecting.

    Thanks,
    Kevin LaRosa
  • Thanks Kevin for your response.

    Yes I have seen it and configured the codec accordingly. Actually, I do not want to play encoded mp3 files but wav files which contain sampled data and the TRM you referred to only discuss the case of encrypted mp3 files. I attached the source code earlier in which I configured the codec with my understanding. If I am wrong anywhere, please guide.

    Thanks,

    Muhammad Umair Khan

  • Hey Muhammad,

    In that case, have you tried running the ITBOK tool to confirm that the audio is working in general: processors.wiki.ti.com/.../ITBOK

    Have you contacted the DM37x forum regarding this issue? If it is a software issue, they will be much more knowledgeable; we focus primarily on analog issues. I will continue to try and help you out here as best I can, but hopefully you are engaging the DM37x team as well to help with the software.

    Thanks,
    Kevin LaRosa
  • Hello everyone.

    Finally I am able to resolve the issue. The issue was with writing data to McBSP2 module. I was continuously writing data to McBSP2->DXR without reading the XBUFFSTAT register. It caused the issue. After reading XBUFFSTAT register and writing data accordingly, my issue is resolved.

    Thank you all for the help you provided.

    Muhammad Umair Khan

  • Thanks for the update Muhammad!

    Good to hear you were able to get to the root cause.

    Thanks,

    Kevin LaRosa