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.

MSP430FR2311: No DCOCTL; How do you set DCO?

Part Number: MSP430FR2311
Other Parts Discussed in Thread: MSP430G2553

Hi,

I'm trying to implement a 1 MHz frequency on the DCO in order in implement UART using the Argenox tutorial (I've attached their code at the bottom). But they use a MSP430G2 microcontroller. After looking in the msp430fr2311.h file and data sheet, I see that it doesn't have the DCOCTL register. I've found in the data sheet that in order to have a DCO of 1 MHz the following can be set:

After looking up a few of these in the header file, I have found that they are in the CSCTL1 register. 

My question is how to set the CSCTL1 register in order to have a 1 MHz frequency. I couldn't find a layout of the register in the data sheet, and couldn't figure out which bit corresponds to what.

Argenox Code:

#include <msp430.h>

int main(void)
{
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT

    /* Use Calibration values for 1MHz Clock DCO*/
    DCOCTL = 0;
    BCSCTL1 = CALBC1_1MHZ;
    DCOCTL = CALDCO_1MHZ;

    /* Configure Pin Muxing P1.1 RXD and P1.2 TXD */
    P1SEL = BIT1 | BIT2 ;
    P1SEL2 = BIT1 | BIT2;

    /* Place UCA0 in Reset to be configured */
    UCA0CTL1 = UCSWRST;

    /* Configure */
    UCA0CTL1 |= UCSSEL_2; // SMCLK
    UCA0BR0 = 104; // 1MHz 9600
    UCA0BR1 = 0; // 1MHz 9600
    UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1

    /* Take UCA0 out of reset */
    UCA0CTL1 &= ~UCSWRST;

    /* Enable USCI_A0 RX interrupt */
    IE2 |= UCA0RXIE;

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

/* Echo back RXed character, confirm TX buffer is ready first */
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
    while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?
    UCA0TXBUF = UCA0RXBUF; // TX -&amp;gt; RXed character
}

Any help would be great! Thanks.
  • Hi,

    There is a significant difference between the clock modules in the MSP430G2553 and the MSP430FR2311 so the registers and how to properly set things up will be different. The MSP430G2553 uses what TI calls the Basic Clock Module+ and the MSP430FR2311 uses what's called the Clock System (CS). You can find information on the two systems in the respective device user guides. Also, be sure you are looking at the Device User's Guide for information concerning how to properly setup registers and the device data sheet for more device specific information such as recommended operating conditions. 

    In order to get UART communication working and properly setting up clocks, I recommend taking a look at MSP430Ware. This package provides a large number of examples for MSP430 devices including clock examples and UART examples. Please take a look at them and let me know if you have any further questions. 

    Best regards, 
    Caleb Overbay

**Attention** This is a public forum