首页 > 其他分享 >Si5351时钟芯片控制

Si5351时钟芯片控制

时间:2023-07-21 09:01:50浏览次数:39  
标签:P2 P1 芯片 Si5351 128 GPIO I2C I2C1 时钟

Si5351

一、SI5351频率计算公式:

      f 
     
    
      ( 
     
    
      o 
     
    
      u 
     
    
      t 
     
    
      ) 
     
    
      = 
     
    
      f 
     
    
      ( 
     
    
      p 
     
    
      l 
     
    
      l 
     
    
      ) 
     
    
      / 
     
    
      M 
     
    
      ( 
     
    
      x 
     
    
      ) 
     
    
      R 
     
    
      ( 
     
    
      x 
     
    
      ) 
     
    
   
     f(out) = f(pll) / M(x)R(x) 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10764em;">f</span><span class="mopen">(</span><span class="mord mathdefault">o</span><span class="mord mathdefault">u</span><span class="mord mathdefault">t</span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10764em;">f</span><span class="mopen">(</span><span class="mord mathdefault">p</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mclose">)</span><span class="mord">/</span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mopen">(</span><span class="mord mathdefault">x</span><span class="mclose">)</span><span class="mord mathdefault" style="margin-right: 0.00773em;">R</span><span class="mopen">(</span><span class="mord mathdefault">x</span><span class="mclose">)</span></span></span></span></span></span></p> 
1、小于150Mhz

先设置PLL的频率

      f 
     
    
      ( 
     
    
      p 
     
    
      l 
     
    
      l 
     
    
      ) 
     
    
      = 
     
    
      f 
     
    
      ( 
     
    
      晶 
     
    
      振 
     
    
      频 
     
    
      率 
     
    
      ) 
     
    
      ( 
     
    
      a 
     
    
      + 
     
    
      b 
     
    
      / 
     
    
      c 
     
    
      ) 
     
    
   
     f(pll) = f(晶振频率)(a + b/c) 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10764em;">f</span><span class="mopen">(</span><span class="mord mathdefault">p</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10764em;">f</span><span class="mopen">(</span><span class="mord cjk_fallback">晶</span><span class="mord cjk_fallback">振</span><span class="mord cjk_fallback">频</span><span class="mord cjk_fallback">率</span><span class="mclose">)</span><span class="mopen">(</span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault">b</span><span class="mord">/</span><span class="mord mathdefault">c</span><span class="mclose">)</span></span></span></span></span></span></p> 

a+b/c的范围 (15 + 0/1048575, 90)

a、b、c的设置方法参照文档设置MSNx_P1[17:0]、MSNx_P2[19:0]、MSNx_P3[19:0]寄存器
MSNA_P1[17:0]、MSNA_P2[19:0]、MSNA_P3[19:0]

      M 
     
    
      S 
     
    
      N 
     
     
     
       A 
      
     
       P 
      
     
    
      1 
     
    
      [ 
     
    
      17 
     
    
      : 
     
    
      0 
     
    
      ] 
     
    
      = 
     
    
      128 
     
    
      ∗ 
     
    
      a 
     
    
      + 
     
    
      F 
     
    
      l 
     
    
      o 
     
    
      o 
     
    
      r 
     
    
      ( 
     
    
      128 
     
    
      ∗ 
     
    
      b 
     
    
      / 
     
    
      c 
     
    
      ) 
     
    
      − 
     
    
      512 
     
    
   
     MSNA_P1[17:0] = 128 *a+Floor(128* b/c) - 512 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mord mathdefault" style="margin-right: 0.05764em;">S</span><span class="mord mathdefault" style="margin-right: 0.10903em;">N</span><span class="mord"><span class="mord mathdefault">A</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.328331em;"><span class="" style="top: -2.55em; margin-left: 0em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right: 0.13889em;">P</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span class=""></span></span></span></span></span></span><span class="mord">1</span><span class="mopen">[</span><span class="mord">1</span><span class="mord">7</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord">0</span><span class="mclose">]</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 0.64444em; vertical-align: 0em;"></span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.66666em; vertical-align: -0.08333em;"></span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.13889em;">F</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right: 0.02778em;">r</span><span class="mopen">(</span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault">b</span><span class="mord">/</span><span class="mord mathdefault">c</span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.64444em; vertical-align: 0em;"></span><span class="mord">5</span><span class="mord">1</span><span class="mord">2</span></span></span></span></span></span></p> 

      M 
     
    
      S 
     
    
      N 
     
     
     
       A 
      
     
       P 
      
     
    
      2 
     
    
      [ 
     
    
      19 
     
    
      : 
     
    
      0 
     
    
      ] 
     
    
      = 
     
    
      128 
     
    
      ∗ 
     
    
      b 
     
    
      − 
     
    
      c 
     
    
      ∗ 
     
    
      F 
     
    
      l 
     
    
      o 
     
    
      o 
     
    
      r 
     
    
      ( 
     
    
      128 
     
    
      ∗ 
     
    
      b 
     
    
      / 
     
    
      c 
     
    
      ) 
     
    
   
     MSNA_P2[19:0] = 128*b - c*Floor(128* b/c) 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mord mathdefault" style="margin-right: 0.05764em;">S</span><span class="mord mathdefault" style="margin-right: 0.10903em;">N</span><span class="mord"><span class="mord mathdefault">A</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.328331em;"><span class="" style="top: -2.55em; margin-left: 0em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right: 0.13889em;">P</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span class=""></span></span></span></span></span></span><span class="mord">2</span><span class="mopen">[</span><span class="mord">1</span><span class="mord">9</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord">0</span><span class="mclose">]</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 0.64444em; vertical-align: 0em;"></span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.77777em; vertical-align: -0.08333em;"></span><span class="mord mathdefault">b</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.46528em; vertical-align: 0em;"></span><span class="mord mathdefault">c</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.13889em;">F</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right: 0.02778em;">r</span><span class="mopen">(</span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault">b</span><span class="mord">/</span><span class="mord mathdefault">c</span><span class="mclose">)</span></span></span></span></span></span></p> 

      M 
     
    
      S 
     
    
      N 
     
     
     
       A 
      
     
       P 
      
     
    
      3 
     
    
      [ 
     
    
      19 
     
    
      : 
     
    
      0 
     
    
      ] 
     
    
      = 
     
    
      c 
     
    
   
     MSNA_P3[19:0] = c 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mord mathdefault" style="margin-right: 0.05764em;">S</span><span class="mord mathdefault" style="margin-right: 0.10903em;">N</span><span class="mord"><span class="mord mathdefault">A</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.328331em;"><span class="" style="top: -2.55em; margin-left: 0em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right: 0.13889em;">P</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span class=""></span></span></span></span></span></span><span class="mord">3</span><span class="mopen">[</span><span class="mord">1</span><span class="mord">9</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord">0</span><span class="mclose">]</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 0.43056em; vertical-align: 0em;"></span><span class="mord mathdefault">c</span></span></span></span></span></span></p> 

再设置Multisynth分频设置寄存器MSx_P1[17:0]、MSx_P2[19:0]、MSx_P3[19:0]

      M 
     
    
      S 
     
     
     
       A 
      
     
       P 
      
     
    
      1 
     
    
      [ 
     
    
      17 
     
    
      : 
     
    
      0 
     
    
      ] 
     
    
      = 
     
    
      128 
     
    
      ∗ 
     
    
      a 
     
    
      + 
     
    
      F 
     
    
      l 
     
    
      o 
     
    
      o 
     
    
      r 
     
    
      ( 
     
    
      128 
     
    
      ∗ 
     
    
      b 
     
    
      / 
     
    
      c 
     
    
      ) 
     
    
      − 
     
    
      512 
     
    
   
     MSA_P1[17:0] = 128 *a+Floor(128* b/c) - 512 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mord mathdefault" style="margin-right: 0.05764em;">S</span><span class="mord"><span class="mord mathdefault">A</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.328331em;"><span class="" style="top: -2.55em; margin-left: 0em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right: 0.13889em;">P</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span class=""></span></span></span></span></span></span><span class="mord">1</span><span class="mopen">[</span><span class="mord">1</span><span class="mord">7</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord">0</span><span class="mclose">]</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 0.64444em; vertical-align: 0em;"></span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.66666em; vertical-align: -0.08333em;"></span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.13889em;">F</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right: 0.02778em;">r</span><span class="mopen">(</span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault">b</span><span class="mord">/</span><span class="mord mathdefault">c</span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.64444em; vertical-align: 0em;"></span><span class="mord">5</span><span class="mord">1</span><span class="mord">2</span></span></span></span></span></span></p> 

      M 
     
    
      S 
     
     
     
       A 
      
     
       P 
      
     
    
      2 
     
    
      [ 
     
    
      19 
     
    
      : 
     
    
      0 
     
    
      ] 
     
    
      = 
     
    
      128 
     
    
      ∗ 
     
    
      b 
     
    
      − 
     
    
      c 
     
    
      ∗ 
     
    
      F 
     
    
      l 
     
    
      o 
     
    
      o 
     
    
      r 
     
    
      ( 
     
    
      128 
     
    
      ∗ 
     
    
      b 
     
    
      / 
     
    
      c 
     
    
      ) 
     
    
   
     MSA_P2[19:0] = 128*b - c*Floor(128* b/c) 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mord mathdefault" style="margin-right: 0.05764em;">S</span><span class="mord"><span class="mord mathdefault">A</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.328331em;"><span class="" style="top: -2.55em; margin-left: 0em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right: 0.13889em;">P</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span class=""></span></span></span></span></span></span><span class="mord">2</span><span class="mopen">[</span><span class="mord">1</span><span class="mord">9</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord">0</span><span class="mclose">]</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 0.64444em; vertical-align: 0em;"></span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.77777em; vertical-align: -0.08333em;"></span><span class="mord mathdefault">b</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 0.46528em; vertical-align: 0em;"></span><span class="mord mathdefault">c</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.13889em;">F</span><span class="mord mathdefault" style="margin-right: 0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right: 0.02778em;">r</span><span class="mopen">(</span><span class="mord">1</span><span class="mord">2</span><span class="mord">8</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">∗</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault">b</span><span class="mord">/</span><span class="mord mathdefault">c</span><span class="mclose">)</span></span></span></span></span></span></p> 

      M 
     
    
      S 
     
     
     
       A 
      
     
       P 
      
     
    
      3 
     
    
      [ 
     
    
      19 
     
    
      : 
     
    
      0 
     
    
      ] 
     
    
      = 
     
    
      c 
     
    
   
     MSA_P3[19:0] = c 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mord mathdefault" style="margin-right: 0.05764em;">S</span><span class="mord"><span class="mord mathdefault">A</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.328331em;"><span class="" style="top: -2.55em; margin-left: 0em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right: 0.13889em;">P</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span class=""></span></span></span></span></span></span><span class="mord">3</span><span class="mopen">[</span><span class="mord">1</span><span class="mord">9</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord">0</span><span class="mclose">]</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 0.43056em; vertical-align: 0em;"></span><span class="mord mathdefault">c</span></span></span></span></span></span></p> 

      M 
     
    
      ( 
     
    
      x 
     
    
      ) 
     
    
      = 
     
    
      a 
     
    
      + 
     
    
      b 
     
    
      / 
     
    
      c 
     
    
   
     M(x) = a + b/c 
    
   
 </span><span class="katex-html"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault" style="margin-right: 0.10903em;">M</span><span class="mopen">(</span><span class="mord mathdefault">x</span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.277778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.277778em;"></span></span><span class="base"><span class="strut" style="height: 0.66666em; vertical-align: -0.08333em;"></span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right: 0.222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right: 0.222222em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathdefault">b</span><span class="mord">/</span><span class="mord mathdefault">c</span></span></span></span></span></span></p> 

M(x)的范围(8 + 1/1048575, 2048)

二、驱动SI5351:

SI5351时钟芯片,通过I2C区控制,SI5351地址在Silabs-Si5351A.pdf文档上可以找到是:0xc0(写数据)0xc1(读数据);

SI5351设置低频率:通过为Rx_DIV写入适当的设置将其设置为1,2,4,8,… 128。设置此参数可生成低至8kHz的频率;

SI5351使用晶体振荡器时要设置PLL_SRC、XTAL_CL脚;

PLL_SRC,0x00
XTAL_CL,0x80

1、I2C程序

uint32_t I2C_Timeout;
 /** 
      PB6  -------> I2C1 SCL
      PB7  -------> I2C1 SDA
  **/
void GPIO_Init_Config(void)
{

GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);

GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_1);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_1);
}

void I2C1_Init_Config(void)
{
I2C_InitTypeDef I2C_InitStructure;
I2CMaster_RCC_Configuration();
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
GPIO_Init_Config();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

RCC_I2CCLKConfig(RCC_I2C1CLK_SYSCLK);

RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);

I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_AnalogFilter = I2C_AnalogFilter_Enable;
I2C_InitStructure.I2C_DigitalFilter = 0x01;
I2C_InitStructure.I2C_OwnAddress1 = 0x00;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_Timing = 0x30E32E44;
I2C_Init(I2C1, &I2C_InitStructure);

I2C_Cmd(I2C1, ENABLE);
I2CMaster_NVIC_Configuration();
//I2C_ITConfig();
}

void I2CMaster_RCC_Configuration(void)
{
/* Enable peripheral clocks --------------------------------------------------*/
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);

}

void I2CMaster_NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;

NVIC_InitStructure<span class="token punctuation">.</span>NVIC_IRQChannel <span class="token operator">=</span> I2C1_IRQn<span class="token punctuation">;</span>
NVIC_InitStructure<span class="token punctuation">.</span>NVIC_IRQChannelCmd <span class="token operator">=</span> ENABLE<span class="token punctuation">;</span> 
NVIC_InitStructure<span class="token punctuation">.</span>NVIC_IRQChannelPriority <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token function">NVIC_Init</span><span class="token punctuation">(</span><span class="token operator">&amp;</span>NVIC_InitStructure<span class="token punctuation">)</span><span class="token punctuation">;</span>

}

I2C_Status I2C_Read_NBytes(uint8_t driver_Addr, uint8_t number_Bytes, uint8_t *read_Buffer)
{
uint8_t read_Num;

I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY) != RESET)
{
if((I2C_Timeout--) == 0)
{
return I2C_FAIL;
}
}

I2C_TransferHandling(I2C1, driver_Addr, 1, I2C_SoftEnd_Mode, I2C_Generate_Start_Write);

I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TXIS) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

I2C_SendData(I2C1, 0Xc0);

I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TC) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

I2C_TransferHandling(I2C1, driver_Addr, number_Bytes, I2C_AutoEnd_Mode, I2C_Generate_Start_Read);

for(read_Num = 0; read_Num < number_Bytes; read_Num++)
{
I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_RXNE) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

read_Buffer<span class="token punctuation">[</span>read_Num<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token function">I2C_ReceiveData</span><span class="token punctuation">(</span>I2C1<span class="token punctuation">)</span><span class="token punctuation">;</span>

}

I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_STOPF) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

return I2C_OK;
}

I2C_Status I2C_Write_NBytes(uint8_t start_Addr, uint8_t write_Buffer)
{
uint8_t write_Num;
uint8_t number_Bytes = 1;
I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_BUSY) != RESET)
{
if((I2C_Timeout--) == 0)
{
return I2C_FAIL;
}
}

I2C_TransferHandling(I2C1, 0xC0, 1, I2C_Reload_Mode, I2C_Generate_Start_Write);

I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TXIS) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

I2C_SendData(I2C1, start_Addr);

I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TCR) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

I2C_TransferHandling(I2C1, 0xC0, number_Bytes, I2C_AutoEnd_Mode, I2C_No_StartStop);

for(write_Num = 0; write_Num < number_Bytes; write_Num++)
{
I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_TXIS) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

<span class="token function">I2C_SendData</span><span class="token punctuation">(</span>I2C1<span class="token punctuation">,</span> write_Buffer<span class="token punctuation">)</span><span class="token punctuation">;</span>

}

I2C_Timeout = I2C_TIMEOUT;
while(I2C_GetFlagStatus(I2C1, I2C_FLAG_STOPF) RESET)
{
if((I2C_Timeout--) 0)
{
return I2C_FAIL;
}
}

return I2C_OK;
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194

2、Si5351程序

//设置PPL时钟

// 参数: pll寄存器 mult a num b denom c
void setupPLL(uint8_t pll, uint8_t mult, uint32_t num, uint32_t denom)
{
uint32_t P1; // PLL config register P1
uint32_t P2; // PLL config register P2
uint32_t P3; // PLL config register P3

P1 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>num <span class="token operator">/</span> <span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>denom<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
P1 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span>mult<span class="token punctuation">)</span> <span class="token operator">+</span> P1 <span class="token operator">-</span> <span class="token number">512</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
P2 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>num <span class="token operator">/</span> <span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>denom<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
P2 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> num <span class="token operator">-</span> denom <span class="token operator">*</span> P2<span class="token punctuation">)</span><span class="token punctuation">;</span>
P3 <span class="token operator">=</span> denom<span class="token punctuation">;</span>

<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>P3 <span class="token operator">&gt;&gt;</span> <span class="token number">8</span><span class="token punctuation">)</span><span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    	<span class="token comment">//MSN_P3[15:8]											</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>P3 <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>			<span class="token comment">//MSN_P3[7:0]	 												</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>P1 <span class="token operator">&gt;&gt;</span> <span class="token number">16</span><span class="token punctuation">)</span><span class="token operator">&amp;</span> <span class="token number">0x03</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   	<span class="token comment">//MSN_P1[17:16]											</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>P1 <span class="token operator">&gt;&gt;</span> <span class="token number">8</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   	<span class="token comment">//MSN_P1[15:8]											</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>P1 <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>			<span class="token comment">//MSN_P1[7:0]	 							</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>P3 <span class="token operator">&gt;&gt;</span> <span class="token number">12</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0xF0</span><span class="token punctuation">)</span> <span class="token operator">|</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>P2 <span class="token operator">&gt;&gt;</span> <span class="token number">16</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0x0F</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//MSN_P3[19:16] + MSN_P2[19:16]</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>P2 <span class="token operator">&gt;&gt;</span> <span class="token number">8</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">//MSN_P2[15:8]												</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>pll <span class="token operator">+</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token punctuation">(</span>P2 <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>				 												<span class="token comment">//MSN_P2[7:0]</span>

}

void Multisynth(uint8_t synth, uint8_t a, uint32_t b, uint32_t c, uint8_t rDiv)
{
uint32_t P1; // Synth config register P1
uint32_t P2; // Synth config register P2
uint32_t P3; // Synth config register P3

P1 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>b <span class="token operator">/</span> <span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>c<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
P1 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span> <span class="token operator">+</span> P1 <span class="token operator">-</span> <span class="token number">512</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
P2 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> <span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>b <span class="token operator">/</span> <span class="token punctuation">(</span><span class="token keyword">float</span><span class="token punctuation">)</span>c<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
P2 <span class="token operator">=</span> <span class="token punctuation">(</span>uint32_t<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">128</span> <span class="token operator">*</span> b <span class="token operator">-</span> c <span class="token operator">*</span> P2<span class="token punctuation">)</span><span class="token punctuation">;</span>
P3 <span class="token operator">=</span> c<span class="token punctuation">;</span>

<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">0</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span>P3 <span class="token operator">&gt;&gt;</span> <span class="token number">8</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//MS_P3[15:8]                       </span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span>P3 <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>		   <span class="token comment">//MS_P3[7:0]														</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">2</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span><span class="token punctuation">(</span>P1 <span class="token operator">&gt;&gt;</span> <span class="token number">16</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0x03</span><span class="token punctuation">)</span> <span class="token operator">|</span> rDiv<span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">//MS_P1[17:16]							</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">3</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span>P1 <span class="token operator">&gt;&gt;</span> <span class="token number">8</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//MS_P1[15:8]												</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">4</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span>P1 <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>		   <span class="token comment">//MS_P1[7:0]													</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">5</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span><span class="token punctuation">(</span>P3 <span class="token operator">&gt;&gt;</span> <span class="token number">12</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0xF0</span><span class="token punctuation">)</span> <span class="token operator">|</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>P2 <span class="token operator">&gt;&gt;</span> <span class="token number">16</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0x0F</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//MS_P3[19:16] + MS_P2[19:16]</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">6</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span>P2 <span class="token operator">&gt;&gt;</span> <span class="token number">8</span><span class="token punctuation">)</span> <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	<span class="token comment">//MS_P2[15:8]												</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>synth <span class="token operator">+</span> <span class="token number">7</span><span class="token punctuation">,</span>   <span class="token punctuation">(</span>P2 <span class="token operator">&amp;</span> <span class="token number">0xFF</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>			<span class="token comment">//MS_P2[7:0]													</span>

}

//设置时钟频率
void si5351aSetFrequency(uint32_t frequency , uint8_t Chanal )
{

<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>PLL_SRC<span class="token punctuation">,</span><span class="token number">0x00</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>XTAL_CL<span class="token punctuation">,</span><span class="token number">0x80</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">if</span> <span class="token punctuation">(</span> Chanal <span class="token operator">==</span> <span class="token number">1</span> <span class="token punctuation">)</span><span class="token punctuation">{<!-- --></span>
	<span class="token comment">//I2C_Write_NBytes(FBB_INT , 0x40);       //整数模式</span>
	<span class="token function">setupPLL</span><span class="token punctuation">(</span>SI_SYNTH_PLL_B<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>				<span class="token comment">//设置锁相环与倍增系数计算</span>
	<span class="token function">Multisynth</span><span class="token punctuation">(</span>SI_SYNTH_MS_1<span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">1036</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> SI_R_DIV_32<span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>SI_PLL_RESET<span class="token punctuation">,</span><span class="token number">0xA0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>	
	<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>SI_CLK1_CONTROL<span class="token punctuation">,</span> <span class="token number">0x4F</span><span class="token operator">|</span>SI_CLK_SRC_PLL_B<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>frequency <span class="token operator">==</span> Fre_45M<span class="token punctuation">)</span>
<span class="token punctuation">{<!-- --></span>
	<span class="token keyword">if</span><span class="token punctuation">(</span> Chanal <span class="token operator">==</span> <span class="token number">0</span> <span class="token punctuation">)</span>
	<span class="token punctuation">{<!-- --></span>
		<span class="token function">setupPLL</span><span class="token punctuation">(</span>SI_SYNTH_PLL_A<span class="token punctuation">,</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>					 				     <span class="token comment">//设置锁相环与倍增系数计算</span>
		<span class="token function">Multisynth</span><span class="token punctuation">(</span>SI_SYNTH_MS_0<span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">,</span> SI_R_DIV_1<span class="token punctuation">)</span><span class="token punctuation">;</span> 	       <span class="token comment">//设置MultiSynth分配器0分计算。最后R分裂阶段可以除以2的幂,从1 . . 128。如果想在1兆赫兹以下输出,你必须使用,最后R分裂阶段</span>
		<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>SI_PLL_RESET<span class="token punctuation">,</span><span class="token number">0xA0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>							 				 <span class="token comment">//重置锁相环。这将导致输出的故障。对于小的变化参数,不需要复位锁相环,没有故障	</span>
		<span class="token function">I2C_Write_NBytes</span><span class="token punctuation">(</span>SI_CLK0_CONTROL<span class="token punctuation">,</span> <span class="token number">0x4F</span><span class="token operator">|</span>SI_CLK_SRC_PLL_A<span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//最后打开CLK0输出(0 x4f)并设置MultiSynth0是锁相环的输入	</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">}</span>

}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75

标签:P2,P1,芯片,Si5351,128,GPIO,I2C,I2C1,时钟
From: https://www.cnblogs.com/SymPny/p/17570278.html

相关文章

  • RN6752/RN6752V1/RN6854M/RN6862M/RN6864M---台湾立敏RICHNEX AHD RX芯片介绍
    台湾立敏RICHNEXAHDRX芯片介绍RICHNEX公司简介RICHNEX,台湾立敏电子股份有限公司,隶属于RICHTEK集团,成立于2008年,是一家无晶圆IC设计公司,主要从事模数混合类IC设计,主要应用于车载、安防、消费类等领域。RICHNEXAHD产品列表型号 分辨率  输入输出  应用 RN......
  • Azure VM (43) Azure VM时钟同步
    《WindowsAzurePlatform系列文章目录》 本文主要介绍AzureLinuxVM时钟同步问题在CentOS8.x上,默认采用chrony配置为使用PTP源同步。Chrony所选时间来源是可以配置的,你可以选择让他从Azure物理机进行时间同步(也就是通过PTP时钟)。具体可以参考:https://l......
  • 电容式触摸按键感应低功耗触摸IC芯片VK3702DM/VK3702TM/VK3702OM抗干扰触摸芯片
    产品型号(封装形式):VK3702DM  ——(SOP8)     VK3702TM  ——(SOP8)   VK3702OM——(SOP8)   产品品牌:永嘉微电/VINKA产品年份:新年份原厂,工程服务,技术支持!  产品简介:VK3702TM提供2个触摸感应按键,一对一的Toggle模式输出,提供低功耗模式,可使用于电......
  • 850K芯片数据分析
    850K芯片数据分析流程1.数据准备在进行数据分析之前,我们需要准备好待分析的数据。以下是整个数据分析流程的步骤表格:步骤描述1数据收集:从实验或者现场获取850K芯片数据2数据清洗:对数据进行清洗,去除无效数据和异常值3数据预处理:对数据进行预处理,如缺失值填充......
  • CS5466 Type-c to HDMI2.1_8K拓展坞方案芯片|低成本替代GSV6201方案
    GSV6201是一款高性能、低功耗、高性能的,USBType-C备用模式显示端口1.4至HDMI2.1转换器。通过集成增强型微控制器,GSV6201创造了一个经济高效的解决方案提供了上市时间优势。显示端口接收机支持高达32.4Gbps(HBR3,4通道)和HDMI发射机支持高达48Gbps(FRL,12G4Lane)。集成PowerDelivery3......
  • 14款超时尚的HTML5时钟动画
    时钟动画在网页应用中也非常广泛,在一些个人博客中,我们经常会看到一些相当个性化的HTML5时钟动画。今天我们向大家分享了14款形态各异的超时尚HTML5时钟动画,其中有圆盘时钟、3D时钟、个性化时钟等,强大的HTML5为时钟动画增添了不少精彩,希望能给大家带来帮助。1、可爱的CSS3圆盘时钟......
  • 苹果系统M系列芯片编译JDK18
    苹果系统M系列芯片编译JDK18MacosAppleSiliconBuildopenJDK为什么编译之前听blindpirate大佬说过,为了解决某个fastjson的bug编译了一下jdk让其报出更详细的异常信息.最近在读<深入理解java虚拟机(第三版周志明)>,第一章就是使用ubuntu18编译个openjdk12,以供接下......
  • CS5212/CS5202 DP转VGA芯片设计方案
    CS5212内置MCU控制器,超低待机功率<100uW,用于设计DP端口到VGA转换器,也可以用于主板DP转VGA方案,CS5212AN芯片功能特性:2-lane通道VESADP1.1兼容接收机VGA输出接口,DAC速度高达210MHz,8位分辨率高达1920x1200x60(RB,缩小消隐),24位色深,1920x1440x60(RB,缩小消隐),或2048x152x60(RB,缩小消隐......
  • ABS10-ASEMI迷你贴片整流桥50MIL芯片ABS10
    编辑:llABS10-ASEMI迷你贴片整流桥50MIL芯片ABS10型号:ABS10品牌:ASEMI芯片个数:4封装:MBS-4恢复时间:ns工作温度:-55°C~150°C浪涌电流:30A正向电流:1A反向耐压:1000V正向压降:1.05V引脚数量:4漏电流:>10uaABS10特性:ASEMI品牌ABS10是采用GPP工艺芯片,该芯片具有良好的稳定性及抗......
  • MCU芯片架构设计
    目录1.应用场景主要是I2C\UART\SPI协议2.Cortex-M3MCU成本与工艺选型按照晶圆进行收费,28nm,12寸晶圆,400万美金晶圆是圆形的,die是方形的,会存在浪费productivity-大约是理论数量(晶圆总面积/裸片面积)的50%-60%yield-生产工艺问题导致在晶圆上切出的die存在问题,存在......