Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22172

MSP430FR6047: No echo received while running the example code msp430fr60x7_eusci_uart_standard_transceiver.c

$
0
0
Part Number: MSP430FR6047

Hi all, 

I am playing around with example code msp430fr60x7_eusci_uart_standard_transceiver.c.

In the code I tried with baud rate 9600 and then changed the baud rate to 115200 but when I send a character via UART it is returning as shown below for both baud rate.

My serial port settings is shown below.

The UART settings in this example code is shown below

.

void initUART()
{
// Configure USCI_A0 for UART mode
UCA0CTLW0 = UCSWRST; // Put eUSCI in reset

#if UART_MODE == SMCLK_115200

UCA0CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK

// Baud Rate Setting
// Use Table 30-5 in Family User Guide
UCA0BR0 = 8;
UCA0BR1 = 0;
UCA0MCTLW |= UCOS16 | UCBRF_10 | 0xF700; //0xF700 is UCBRSx = 0xF7

#elif UART_MODE == SMCLK_9600

UCA0CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK

// Baud Rate Setting
// Use Table 30-5 in Family User Guide
UCA0BR0 = 104;
UCA0BR1 = 0;
UCA0MCTLW |= UCOS16 | UCBRF_2 | 0xD600; //0xD600 is UCBRSx = 0xD6

#elif UART_MODE == ACLK_9600

UCA0CTLW0 |= UCSSEL__ACLK; // CLK = ACLK
// Baud Rate calculation
// 32768/(9600) = 3.4133
// Fractional portion = 0.4133
// Use Table 24-5 in Family User Guide
UCA0BR0 = 3; // 32768/9600
UCA0BR1 = 0;
UCA0MCTLW |= 0x9200; //0x9200 is UCBRSx = 0x92

#else
# error "Please specify baud rate to 115200 or 9600"
#endif

UCA0CTLW0 &= ~UCSWRST; // Initialize eUSCI
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
}

Thanks 
Antony


Viewing all articles
Browse latest Browse all 22172

Trending Articles