• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » MSP430™ Microcontrollers » MSP430 Ultra-Low Power 16-bit Microcontroller Forum » configuring DCO
Share
MSP430™ Microcontrollers
  • Forum
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
MSP430 Resources
  • MSP430 Product Folder
  • MSP-EXP430G2 - MSP430 LaunchPad Value Line Development kit
  • MSP430 Getting Started Guide
  • MSP430 Microcontroller Projects
  • More Resources >
  • configuring DCO

    configuring DCO

    This question has suggested answer(s)
    Saurabh Arora
    Posted by Saurabh Arora
    on May 18 2010 07:59 AM
    Prodigy20 points

    How to configure DCO ( for MSP 430Fg4618)  for SMCLK clock?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on May 18 2010 13:13 PM
      Suggested Answer
      Guru141810 points

      Hmmm, what do you mean? You do not configure DCO for any clock.

      The DCO is an oscillator. You configure it to oscillate with a frequency. More or less (as the DCO has relatively high tolerances).

      SMCLK is a clock. It is sourced by an oscillator, such as the DCO.

      If you want to know how to configure SMCLK to be sourced by the DCO, then the answer is: It already is at startup. That's the default setting. You can change this by setting the SELS bit in FLL_CTL1. THen SMCLK will be sourced by the (external) XT2 oscillator.

      The frequency of the DCO, however, is controlled by the FN_x bits in SCFI0 register and the DCOx bits in SCFI1. Or automatically adjusted by the FLL hardware, but that's a bit more complex.

      Read the Chapter 5.2 of the MSP430x4xx family users guide SLAU056j.pdf , it explains everything in detail.

       

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Saurabh Arora
      Posted by Saurabh Arora
      on May 19 2010 05:51 AM
      Prodigy20 points

      Hi,

      Thanks for your reply. But I am still facing a problem. XT2 is not present on my board but a 32.768 KHz watch crystal  connects to Xin & Xout.

      I am configuring DCO for SMCLK clock sourced from the watch crystal.

      Here is my code:

        FLL_CTL0 |= DCOF + DCOPLUS; //DCO oscillator fault condition present, DCO O/P is not divided
        FLL_CTL1 |= XT2OFF;  //Turn off XT2,
        SCFI0 |= FN_2;// f_DCO range = 1.3 to 12.1 MHz
        SCFI0 &= ~FLLD_1;// divide f_DCOLCLK by 1
        SCFQCTL |= 0x1F; //f_DCOCLK = 1.(31 + 1).f_crystal = f_DCOCLK = 32x32.768 kHz = 1.048576 MHz
       
        // Loop until 32kHz crystal stabilizes
        do
        {
            IFG1 &= ~OFIFG;                     // Clear oscillator fault flag
            for ( i=50000; i==0; i--);           // Delay
        }
        while (IFG1 & OFIFG);                   // Test osc fault flag
       
        // disable watchdog
        DisableWatchdog();    // Stop WDT - Password(write - 05Ah) + disable WDT

       

      Problem : When I am setting FLL_CTL1 |= XT2OFF;  //Turn off XT2,system is getting reset always. After commenting it, receiving and sending are still not working.

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on May 19 2010 07:49 AM
      Guru141810 points

      Saurabh Arora
      FLL_CTL0 |= DCOF

      DCOF (and the other OF bits) is set if an oscillator fault is detected (and NOT reset automatically). You can only reset it, if you think the fault condition has been removed, and it will reappear after some time (some 100us) if the oscillator is still not oscillating. If you manually set this bit, you tell the clock system that there is no working DCO. MCLK will then switch to XT2 (which isn't there). and then to VLOCLK (LFXT1CLK is not up yet). the WDT is also running on VLOCLK, so the watchdog will reset your system after 32768 VLO clock cycles, long before you disable the watchdog. Also, after setting DCOF, SMCLK will switch from DCO to XT2 as the only available clock source, and then you disable XT2, leaving SMCLK without any clock source.

      You need to disable XT2 (if your device has an XT2 input), or OFIFG will never clear, since XT2OF will be always set.


      Saurabh Arora
      for ( i=50000; i==0; i--);           // Delay

      And once again the classical delay loop. Since I isn't used inside the loop or ever after, any good optimizing compiler will completely eliminate this as dead code.
      If you do something inside the loop that isn't redundant (e.g. writing I into a hardware register that doesn't do anything), the loop will work as expected. As you do now, it will or won't, depending on the used compiler and its optimisation settings.

      Also, you do not set the XCAPxPF bits for the watch crystal capacitors. Do you have external capacitors? If not, the crystal will never come up.

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use