[求助] MSP430F5438的DCO怎么设置

dageliu   2015-6-17 10:19 楼主
DCO怎么设置,怎么知道频率是多少

回复评论 (4)

  1. void SetVcoreUp (unsigned int level)
  2. {
  3.   PMMCTL0_H = PMMPW_H; /* Open PMM registers for write */
  4.   SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level; /* Set SVS/SVM high side new level */
  5.   SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level; /* Set SVM low side to new level */
  6.   while ((PMMIFG & SVSMLDLYIFG) == 0); /* Wait till SVM is settled */
  7.   PMMIFG &= ~(SVMLVLRIFG + SVMLIFG); /* Clear already set flags */
  8.   PMMCTL0_L = PMMCOREV0 * level; /* Set VCore to new level */
  9.   if ((PMMIFG & SVMLIFG)) /* Wait till new level reached */
  10.     while ((PMMIFG & SVMLVLRIFG) == 0);
  11.   SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level; /* Set SVS/SVM low side to new level */
  12.   PMMCTL0_H = 0x00; /* Lock PMM registers for write access */
  13. }

  14. void UcsInit (void)
  15. {
  16. // Increase Vcore setting to level3 to support fsystem=25MHz
  17. // NOTE: Change core voltage one level at a time..
  18.   SetVcoreUp (0x01);
  19.   SetVcoreUp (0x02);
  20.   SetVcoreUp (0x03);
  21.   UCSCTL3 = SELREF_2; // Set DCO FLL reference = REFO
  22.   UCSCTL4 |= SELA_2; // Set ACLK = REFO
  23.   __bis_SR_register(SCG0); // Disable the FLL control loop
  24.   UCSCTL0 = 0x0000; // Set lowest possible DCOx, MODx
  25.   UCSCTL1 = DCORSEL_7; // Select DCO range 50MHz operation
  26.   UCSCTL2 = FLLD_1 + 762; // Set DCO Multiplier for 25MHz
  27. // (N + 1) * FLLRef = Fdco
  28. // (762 + 1) * 32768 = 25MHz
  29. // Set FLL Div = fDCOCLK/2
  30.   __bic_SR_register(SCG0); // Enable the FLL control loop

  31. // Worst-case settling time for the DCO when the DCO range bits have been
  32. // changed is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS chapter in 5xx
  33. // UG for optimization.
  34. // 32 x 32 x 25 MHz / 32,768 Hz ~ 780k MCLK cycles for DCO to settle
  35.   __delay_cycles(782000);

  36. // Loop until XT1,XT2 & DCO stabilizes - In this case only DCO has to stabilize
  37.   do
  38.   {
  39.     UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);// Clear XT2,XT1,DCO fault flags
  40.     SFRIFG1 &= ~OFIFG; // Clear fault flags
  41.    }while (SFRIFG1&OFIFG); // Test oscillator fault flag
  42. }


官方给的一段程序,5438的DCO需要先升内核电压,然后设置DCO频率

  1.   UcsInit();//提高内核电压,DCO 25MHz
  2.   UCSCTL4|=SELM__DCOCLK+SELS__DCOCLK;//MCLK选择DCO 25MHz SMCLK选择DCO 25MHz


在程序里调用一下
点赞  2015-6-17 14:08
430F5438的DCO确实复杂点,带FLL功能,不过看描述,控制方法没多大区别,就是输出的时钟选择更多了
捕获5.PNG
点赞  2015-6-17 14:38
ccs刚装完,居然要更新,打不开例程
点赞  2015-6-17 14:44
引用: LeoMe 发表于 2015-6-17 14:08
官方给的一段程序,5438的DCO需要先升内核电压,然后设置DCO频率



在程序里调用一下

如果都是默认的呢,就是不初始化
点赞  2015-6-18 11:54
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复