Tool/software:
Hello Team,
please help to fix the issue in sending data over uart, i am using MSP430fr6047 EVM board, rev A with Rev B chip.
Thank you.
Venkatarramana
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.
Tool/software:
Hello Team,
please help to fix the issue in sending data over uart, i am using MSP430fr6047 EVM board, rev A with Rev B chip.
Thank you.
Venkatarramana
what is the actual value to be set to send data over UART with 9600 baud rate please.
Hi Venkat,
Below is the example for your reference:
And you can refer to the UG for how to calculate the Baud Rate: (The demo also show it in the comments)
B.R.
Sal
let me check and update. however, i have found another working example from TI website, its working.
#include <msp430.h>
void uartSendStr(char*);
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog
// Configure GPIO
P1SEL0 |= BIT2 | BIT3; // USCI_A1 UART operation
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// Startup clock system with max DCO setting ~8MHz
CSCTL0_H = CSKEY_H; // Unlock CS registers
CSCTL1 = DCOFSEL_3 | DCORSEL; // Set DCO to 8MHz
CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
CSCTL0_H = 0; // Lock CS registers
// Configure USCI_A0 for UART mode
UCA1CTLW0 = UCSWRST; // Put eUSCI in reset
UCA1CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK
// Baud Rate calculation
// 8000000/(16*9600) = 52.083
// Fractional portion = 0.083
// User's Guide Table 24-4: UCBRSx = 0x04
// UCBRFx = int ( (52.083-52)*16) = 1
UCA1BRW = 52; // 8000000/16/9600
UCA1MCTLW |= UCOS16 | UCBRF_1 | 0x4900;
UCA1CTLW0 &= ~UCSWRST; // Initialize eUSCI
// UCA1IE |= UCRXIE; // Enable USCI_A0 RX interrupt
// __bis_SR_register(GIE); // Enter LPM3, interrupts enabled
uartSendStr("\r\nramaSita\r\n");
// __bis_SR_register(LPM3_bits + GIE); // Enter LPM3, interrupts enabled
//uartSendStr("ramaSita");
__no_operation(); // For debugger
}
/*
unsigned char temp;
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=EUSCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(EUSCI_A1_VECTOR))) USCI_A1_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA1IV, USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
while(!(UCA1IFG&UCTXIFG));
temp = UCA1RXBUF;
UCA1TXBUF = temp;
// UCA1TXBUF = temp;
__no_operation();
break;
case USCI_UART_UCTXIFG:
break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
default: break;
}
}
*/
void uartSendStr(char *s)
{
while(*s)
{
UCA1TXBUF = *s;
while(!(UCA1IFG & UCTXIFG));
s++;
}
}
**Attention** This is a public forum