I am trying to learn about UART Serial communication of the MSP430FR6989 from Texas Instruments.
I doing a program where my UART will send a character through the TX pin of my microcontroller and receives it through the RX pin.
If we take a look at the Block Diagram of the MSP430's UART module (eUSCI - UART Mode), it will look like this
(Page 766/1021 of UG)
A 32.768 kHz Auxiliary Clock Source will be the source of the BRCLK (Baud Rate Clock), I will enable the Parity bit (UCPEN = 1), and set it to count even 1s (UCPAR = 1). I will put a value of odd 1s into the Transmission buffer (UCA0TXBUF = 1001 0111). Now I expect the Parity Error Flag to be set (UCPE 0-> 1).
(Page 784/1021 of UG)
(Page 787/1021 of UG)
This is a snippet of the code
int main(void)
{
//code
set_Clock_Signals (); //sets f(ACLK) = 32.768 kHz
set_UART_Pins (); //P4.2 and P4.3 are UART RX and TX
set_UART_Baud_Rate ();
UCA0CTLW0 = UCSWRST; //put UART in reset mode
UCA0CTLW0 = UCA0CTLW0 | UCPEN | UCPAR | UCSSEL0;
//enables parity, parity is even, selects ACLK CS
UCA0CTLW0 = UCA0CTLW0 & (~UCSWRST);
//we can send and recieve data now
UCA0TXBUF = 0x57; //Line A
//0101 0111
while(1);
return 0;
}
I build program, and started debugging it, what I expected was when the debugger steps into Line A, and steps out of it, I will see UCPE bit to be set, but instead I didn't get an error.
Steps into the next line, no error, and it works fine.