• 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 » MSP430G2553 Serial UART - Bluetooth Module - Problem after setting BCSCTL1= CALBC1_16Mhz
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 >
  • MSP430G2553 Serial UART - Bluetooth Module - Problem after setting BCSCTL1= CALBC1_16Mhz

    MSP430G2553 Serial UART - Bluetooth Module - Problem after setting BCSCTL1= CALBC1_16Mhz

    This question is answered
    Corey Jones
    Posted by Corey Jones
    on Aug 28 2012 14:36 PM
    Prodigy30 points

    Hello All,

         I am new to Microcontroller programming so please bear with me. I appreciate any help the community can provide. I'm working to put two pieces of code together. One controls an RGB led and one is the msp430g2xx3_usci_uart_9600 sample code. I can run both pieces of code independently and they work great. The problem comes in when I attempt to combine them. Apparently after I set the clock using BCSCTL1 = CALBC1_16Mhz, the uart stuff does not function. I've included the USCI UART demo I'm building from below. It works great until I add the bit about setting the clock to 16Mhz. Any help would be greatly appreciated. I know I'm missing something obvious so please go easy on me. :)  Thanks! -Corey

    //******************************************************************************
    // MSP430G2xx3 Demo - USCI_A0, 9600 UART Echo ISR, DCO SMCLK
    //
    // Description: Echo a received character, RX ISR used. Normal mode is LPM0.
    // USCI_A0 RX interrupt triggers TX Echo.
    // Baud rate divider with 1MHz = 1MHz/9600 = ~104.2
    // ACLK = n/a, MCLK = SMCLK = CALxxx_1MHZ = 1MHz
    //
    // MSP430G2xx3
    // -----------------
    // /|\| XIN|-
    // | | |
    // --|RST XOUT|-
    // | |
    // | P1.2/UCA0TXD|------------>
    // | | 9600 - 8N1
    // | P1.1/UCA0RXD|<------------
    //******************************************************************************
    /*
    * ======== Standard MSP430 includes ========
    */
    #include <msp430.h>

    /*
    * ======== Grace related declaration ========
    */
    extern void CSL_init(void);

    /*
    * ======== main ========
    */
    int main(void)
    {
    CSL_init();

    //Code added here...
    //Set clock
    BCSCTL1 = CALBC1_16MHZ; //set range
    DCOCTL = CALDCO_16MHZ;//set dco step and modulation
    BCSCTL3 |= LFXT1S_2; // dco
    ////IFG1 &= ~OFIFG; //osc fault flag
    BCSCTL2 |= SELM_0; //sel DCO = mclk
    //End of added code...

    __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
    }

    void USCI0RX_ISR(void)
    {
    while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?
    UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
    }

    UART Clock MSP430g2553
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Chester Gillon
      Posted by Chester Gillon
      on Aug 28 2012 16:12 PM
      Mastermind6315 points

      The Baud rate divider from the demo is commented as being calculated on the assumption that MCLK = SMCLK = 1MHz.

      If the MCLK has been increased to 16 MHz then the baud rate divider needs to increased to 16MHz/9600 = ~1666.7

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Corey Jones
      Posted by Corey Jones
      on Aug 28 2012 19:44 PM
      Prodigy30 points

      Thanks for reply! That makes sense. Do you know how I would go about updating the baud rate divider?

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Michael Brunotte
      Posted by Michael Brunotte
      on Aug 29 2012 05:37 AM
      Verified Answer
      Verified by Corey Jones
      Intellectual1460 points

      Hello Corey,

      You are already using Grace. Why not look into configuring the USCI there?

      Regards,
      Michael 

      www.ti.com/grace

      MSP430 16 bit Microcontroller | MCU |  MSP430 Microcontroller Code |  MSP430 Microcontroller Kits | MSP430 8 bit Microcontroller | MCU |  TI Microcontroller | MCU

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Corey Jones
      Posted by Corey Jones
      on Aug 29 2012 17:32 PM
      Prodigy30 points

      Thanks Michael! That put me on the right track! Setting the clock to 16Mhz in the grace configuration did the trick for both pieces of code. Thanks!

      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