Tool/software: Code Composer Studio
Hi all,
I have a project with MSP430FR2532 that will need to use UART at baud rate of 57600 because the default baud rate of the other side is at 57600. During development, communication between MSP430FR2532 and FTDI USB-UART adapter (FT232R) works perfectly fine at 9600, 19200, 38400. But once I increased baud rate to 57600, message sent from FR2532 to FT232R can always be recognized, but message sent back from FT232R to MSP430 is corrupted from time to time, particularly the first chunk of message, usually first 10 bytes or so.
The following is code I used to initialize clock and UART
// Setup clock __bis_SR_register(SCG0); // disable FLL CSCTL3 |= SELREF__REFOCLK; // Set REFO as FLL reference source CSCTL0 = 0; // clear DCO and MOD registers CSCTL1 &= ~(DCORSEL_7); // Clear DCO frequency select bits first CSCTL1 |= DCORSEL_3; // Set DCO = 8MHz CSCTL2 = FLLD_0 + 242; // DCODIV = 8MHz __delay_cycles(3); __bic_SR_register(SCG0); // enable FLL while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz, default DCODIV as MCLK and SMCLK source // Initialize UART1 UCA1CTLW0 |= UCSWRST; UCA1CTLW0 |= UCSSEL__SMCLK; // Baud Rate calculation // 8000000/57600 = 138.889 // OS16 = 1, UCBR1 = 8, UCBRF1 = 10 // Fractional portion = 0.889 // User's Guide Table 21-4: UCBRSx = 0xF7 UCA1BR0 = 8; // 8000000/57600/16 UCA1BR1 = 0x00; UCA1MCTLW = 0xF700 | UCOS16 | UCBRF_10; UCA1CTLW0 &= ~UCSWRST; // Initialize eUSCI UCA1IE |= UCRXIE; // Enable USCI_A1 RX interrupt
Not sure if it is related, MCU will stay in LPM3, wake up either every 100ms or one message is received from UART1/FT232R.
What could I be missing here? Some other posts reported FR2532 works just fine at 57600 or even at 115200.