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.

[参考译文] CDCEL913:输出频率

Guru**** 2379290 points
Other Parts Discussed in Thread: CDCEL913
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/clock-timing-group/clock-and-timing/f/clock-timing-forum/1063616/cdcel913-output-frequency

器件型号:CDCEL913

大家好、支持团队

我的客户有以下问题:

我正在使用 CDCEL913。
我可以输出整数频率、例如33MHz
但是、一旦出现诸如32.768MHz 之类的小数、输出就不正确。
例如、我设置32.768MHz、但示波器测量的频率为4MHz。

这是我的寄存器配置、可通过 Pro-Clock 软件获取:

Bit  ==>  76543210
Byte 00 - 00000001
Byte 01 - 00000000
Byte 02 - 10110100
Byte 03 - 00000111
Byte 04 - 00000010
Byte 05 - 01010000
Byte 06 - 01000000
Byte 07 - 00000000
Byte 08 - 00000000
Byte 09 - 00000000
Byte 10 - 00000000
Byte 11 - 00000000
Byte 12 - 00000000
Byte 13 - 00000000
Byte 14 - 00000000
Byte 15 - 00000000
Byte 16 - 00000000
Byte 17 - 00000000
Byte 18 - 00000000
Byte 19 - 00000000
Byte 20 - 00001101
Byte 21 - 00000010
Byte 22 - 00000000
Byte 23 - 00000000
Byte 24 - 11100000
Byte 25 - 00000010
Byte 26 - 10100011
Byte 27 - 10000011
Byte 28 - 11100000
Byte 29 - 00000010
Byte 30 - 10100011
Byte 31 - 10000000

这是我的 C 配置代码。 我可以确保寄存器被写入、因为输出整数频率是可以的。

#include "cdce913.h"
#include "iic.h"
#include <stdbool.h> 
#include "math.h"

/************************************************
* File Name: @@@.c

* Author:xykj

* Date:2019.11.29

* function:cdce913

*************************************************/


    
void CDCE913_Init_invar(void)
{
  cdce913_I2C_WriteByte(0x02, 0x34);    //
  cdce913_I2C_WriteByte(0x03, 0x1A);    //y1·ÖƵ 
  cdce913_I2C_WriteByte(0x04, 0x02);    //s0=0,s0=1¾ùѡͨ
  cdce913_I2C_WriteByte(0x05, 0x50);    //10PF ¾§ÕñµçÈÝ
  cdce913_I2C_WriteByte(0x06, 0x40);
    

  cdce913_I2C_WriteByte(0x12, 0X00);    //SSC1_1[5:3] AND  SSC1_0[2:0]  XXX XXX	
  cdce913_I2C_WriteByte(0x13, 0X00);    //s0=0,Ñ¡Ôñfvco1   s0=1,Ñ¡ÔñFVCO_0
  cdce913_I2C_WriteByte(0x14, 0x6D);    //ʹÓÃPLL1£¬Y2ʹÓÃpdiv2£¬y3ʹÓÃpdiv3 0110 1101 (6D)
  cdce913_I2C_WriteByte(0x15, 0X02);    //S0=0,S0=1´ò¿ª
    
  cdce913_I2C_WriteByte(0x16, 0X7D);    //y2·ÖƵ 0Ϊ¹Ø
  cdce913_I2C_WriteByte(0x17, 0X00);    //y3·ÖƵ 0Ϊ¹Ø   





  cdce913_I2C_WriteByte(0x18, 0X7C);    //N
  cdce913_I2C_WriteByte(0x19, 0XE2);    //N
  cdce913_I2C_WriteByte(0x1A, 0XC2);    //R
  cdce913_I2C_WriteByte(0x1B, 0X68);    //Q



  cdce913_I2C_WriteByte(0x1C, 0X7C);    //N
  cdce913_I2C_WriteByte(0x1D, 0XE2);    //N
  cdce913_I2C_WriteByte(0x1E, 0XC2);    //R
  cdce913_I2C_WriteByte(0x1F, 0X68);    //Q
  
   
}

//void CDCE913_Init_invar(void)
//{
//  cdce913_I2C_WriteByte(0x02, 0xB4);    //
//  cdce913_I2C_WriteByte(0x03, 0x7E);    //y1·ÖƵ 
//  cdce913_I2C_WriteByte(0x04, 0x02);    //s0=0,s0=1¾ùѡͨ
//  cdce913_I2C_WriteByte(0x05, 0x50);    //10PF ¾§ÕñµçÈÝ
//  cdce913_I2C_WriteByte(0x06, 0x40);
//    

//  cdce913_I2C_WriteByte(0x12, 0X00);    //SSC1_1[5:3] AND  SSC1_0[2:0]  XXX XXX	
//  cdce913_I2C_WriteByte(0x13, 0X00);    //s0=0,Ñ¡Ôñfvco1   s0=1,Ñ¡ÔñFVCO_0
//  cdce913_I2C_WriteByte(0x14, 0x2D);    //ʹÓÃPLL1£¬Y2ʹÓÃpdiv2£¬y3ʹÓÃpdiv3 0110 1101 (6D)
//  cdce913_I2C_WriteByte(0x15, 0X02);    //S0=0,S0=1´ò¿ª
//    
//  cdce913_I2C_WriteByte(0x16, 0X00);    //y2·ÖƵ 0Ϊ¹Ø
//  cdce913_I2C_WriteByte(0x17, 0X00);    //y3·ÖƵ 0Ϊ¹Ø   





//  cdce913_I2C_WriteByte(0x18, 0X6A);    //N
//  cdce913_I2C_WriteByte(0x19, 0X59);    //N
//  cdce913_I2C_WriteByte(0x1A, 0X82);    //R
//  cdce913_I2C_WriteByte(0x1B, 0X89);    //Q



//  cdce913_I2C_WriteByte(0x1C, 0X6A);    //N
//  cdce913_I2C_WriteByte(0x1D, 0X59);    //N
//  cdce913_I2C_WriteByte(0x1E, 0X82);    //R
//  cdce913_I2C_WriteByte(0x1F, 0X88);    //Q
//  
//   
//}

#define CLK_IN    26 

void CDCE_Init_set(float f_out)
{
  uint8_t read_back;
  uint8_t i = 0;
  uint32_t M, N,  Q, R;
  float Pdiv;
  uint8_t reg18, reg19, reg1A, reg1B;
  int32_t P;
  float f_vco = f_out;
  bool result    = false;
  uint8_t f_range;



  while (f_vco < 80)
  {
    i++;
    f_vco = f_out * i;
  }



  while (f_vco < 231)
  {
    for (N = 4095; N > 0; N--)
    {
      for (M = 511; M > 0; M--)
      {
        if ((N * CLK_IN / M) == f_vco)
        {          
          {
            result = true;
            break;
          }
        }
      }
      if (result)
      {
        break;
      }
    }
    if (result)
    {
      break;
    }
    else
    {
      i++;
      f_vco = f_out * i;
    }
  }



  P = 4 - (int)((log((double)N / (double)M))/log(2));
  if (P < 0)
  {
    P = 0;
  }
  Q = (int)((double)N * pow(2, (double)P) / (double)M);
  R = (double)N * pow(2, (double)P) - M * Q;



  if (f_vco < 125)
  {
    f_range = 0;
  }
  else if ((f_vco >= 125) && (f_vco < 150))
  {
    f_range = 1;
  }
  else if ((f_vco >= 150) && (f_vco < 175))
  {
    f_range = 2;
  }
  else
  {
    f_range = 3;
  }


  Pdiv = f_vco/ f_out;






  cdce913_I2C_WriteByte(0x02, 0xB4);
  cdce913_I2C_WriteByte(0x03, (uint8_t)Pdiv);
  cdce913_I2C_WriteByte(0x04, 0x02);
  cdce913_I2C_WriteByte(0x05, 0x50);
  cdce913_I2C_WriteByte(0x06, 0x40);
  
  cdce913_I2C_WriteByte(0x12, 0x00);
  cdce913_I2C_WriteByte(0x13, 0x00);
  cdce913_I2C_WriteByte(0x14, 0x6D);        //Y2,Y3¿ª¹Ø¿ØÖÆ£¬y1²»ÊǸÃÒý½Å¿ØÖÆ£¬¹Ì¶¨ÓÐY1
  cdce913_I2C_WriteByte(0x15, 0x02);
  
  cdce913_I2C_WriteByte(0x16, 0);
  cdce913_I2C_WriteByte(0x17, 0);



  reg18 = (N >> 4) & 0xFFF;
  reg19 = (N & 0xf) << 4 | (R & 0xf0) >> 5;
  reg1A = (R & 0x1f) << 3 | ((Q >> 3) & 0x7);
  reg1B = (Q & 0x7) << 5 | (P & 0x07) << 2 | (f_range & 0x03);



  cdce913_I2C_WriteByte(0x18, reg18);
  cdce913_I2C_WriteByte(0x19, reg19);
  cdce913_I2C_WriteByte(0x1A, reg1A);
  cdce913_I2C_WriteByte(0x1B, reg1B);


  cdce913_I2C_WriteByte(0x1C, N);
  cdce913_I2C_WriteByte(0x1D, ((N & 0xf) << 4) | (R & 0xf0));
  cdce913_I2C_WriteByte(0x1E, (R & 0x0f) | (Q & 0xf0));
  cdce913_I2C_WriteByte(0x1F, ((Q & 0x07) << 5) | ((P & 0x07) << 2) | (f_range & 0x03));



}

//void CDCE_Init_set(uint16_t f_out)
//{
//  uint8_t read_back;
//  uint8_t i = 0;
//  uint32_t M, N, Pdiv, Q, R;
//  uint8_t reg18, reg19, reg1A, reg1B;
//  int P;
//  uint16_t f_vco = f_out;
//  bool result    = false;
//  uint8_t f_range;



//  while (f_vco < 80)
//  {
//    i++;
//    f_vco = f_out * i;
//  }



//  while (f_vco < 231)
//  {
//    for (N = 4095; N > 0; N--)
//    {
//      for (M = 511; M > 0; M--)
//      {
//        if ((N * CLK_IN / M) == f_vco)
//        {          
//          {
//            result = true;
//            break;
//          }
//        }
//      }
//      if (result)
//      {
//        break;
//      }
//    }
//    if (result)
//    {
//      break;
//    }
//    else
//    {
//      i++;
//      f_vco = f_out * i;
//    }
//  }



//  P = 4 - (int)((log((double)N / (double)M))/log(2));
//  if (P < 0)
//  {
//    P = 0;
//  }
//  Q = (int)((double)N * pow(2, (double)P) / (double)M);
//  R = (double)N * pow(2, (double)P) - M * Q;



//  if (f_vco < 125)
//  {
//    f_range = 0;
//  }
//  else if ((f_vco >= 125) && (f_vco < 150))
//  {
//    f_range = 1;
//  }
//  else if ((f_vco >= 150) && (f_vco < 175))
//  {
//    f_range = 2;
//  }
//  else
//  {
//    f_range = 3;
//  }


//  Pdiv = f_vco/ f_out;






//  cdce913_I2C_WriteByte(0x02, 0xB4);
//  cdce913_I2C_WriteByte(0x03, (uint8_t)Pdiv);
//  cdce913_I2C_WriteByte(0x04, 0x02);
//  cdce913_I2C_WriteByte(0x05, 0x50);
//  cdce913_I2C_WriteByte(0x06, 0x40);
//  
//  cdce913_I2C_WriteByte(0x12, 0x00);
//  cdce913_I2C_WriteByte(0x13, 0x00);
//  cdce913_I2C_WriteByte(0x14, 0x6D);        //Y2,Y3Ñ¡Ôñ
//  cdce913_I2C_WriteByte(0x15, 0x02);
//  
//  cdce913_I2C_WriteByte(0x16, 0);
//  cdce913_I2C_WriteByte(0x17, 0);



//  reg18 = (N >> 4) & 0xFFF;
//  reg19 = (N & 0xf) << 4 | (R & 0xf0) >> 5;
//  reg1A = (R & 0x1f) << 3 | ((Q >> 3) & 0x7);
//  reg1B = (Q & 0x7) << 5 | (P & 0x07) << 2 | (f_range & 0x03);



//  cdce913_I2C_WriteByte(0x18, reg18);
//  cdce913_I2C_WriteByte(0x19, reg19);
//  cdce913_I2C_WriteByte(0x1A, reg1A);
//  cdce913_I2C_WriteByte(0x1B, reg1B);


//  cdce913_I2C_WriteByte(0x1C, N);
//  cdce913_I2C_WriteByte(0x1D, ((N & 0xf) << 4) | (R & 0xf0));
//  cdce913_I2C_WriteByte(0x1E, (R & 0x0f) | (Q & 0xf0));
//  cdce913_I2C_WriteByte(0x1F, ((Q & 0x07) << 5) | ((P & 0x07) << 2) | (f_range & 0x03));



//}

请帮助我了解问题是什么。

非常感谢。

此致、
Yuki

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Yuki、

    无论是整数还是小数、都不会真正达到输出频率。 它描述了输入频率与 VCO 频率之间的关系。 如果 VCO 是输入的整数倍、则我们假设 PLL 以整数模式工作。 否则、它是分数 PLL。 因此、在这种情况下、假设对于33MHz、VCO = 198MHz、则33MHz 和32.768MHz 都是"分数"。 因此、我不认为差异是因为这种情况。 配置对我来说是正确的、我没有看到任何明显的错误。 请尝试一些其他频率、并找到33MHz 设置与32.768Mhz 设置之间的其他潜在差异。

    此致、
    Hao