Embedded Systems Engineering Lecture 08 (UART)
Embedded Systems Engineering Lecture 08 (UART)
Embedded Systems
Engineering
lecture 08 – Serial
Communication with
MSP430FR5739 -
UART
By Nushara Wedasingha
Mphi(AI) Candidate, Bsc.(Hons) EEE
Department of Electrical and Electronic
Faculty of Engineering
Sri Lanka Institute of Information Technology
WHY
COMMNUICATIO
N IS IMPORTANT?
Data communication
Data Communication
Serial Communication
Universal Asynchronous
Serial Peripheral Interface Inter-Integrated Circuit
Receiver and Transmitter
(SPI) (I2C)
(UART)
Main Registers Offers Serial
Communication in MSP430
MSP430FR5739 Serial
Communication
SPI SPI
Serial Communication MSP430
Architecture
Serial Communication MSP430
Architecture
Universal Asynchronous Receiver
Transmitter (UART)
• UART is one of asynchronous methods sending and receving serial data between two micro controllers.
• The transmition speed of the data between the micro controllers depends on the baud rate.
• Length of a data packet transmitted in UART is 12 bits.
• A bit which acts as a check on a set of binary values, calculated in such a way that
the number of 1s in the set plus the parity bit should always be even or odd.
• A word has even parity if the number of 1’s is even, and odd parity otherwise.
Serial
Communicatio
n MSP430
Architecture
Flow of Setting UART
Pin Configuration
Register Configurations
Baudrate Configuration
Polling Loop
Registers
Name of Register Purpose
UCAxCTL0
Control Registers
UCAxCTL1
UCAxBRW Baud Rate
UCAxMCTL Modulating the Transmitting Signal
UCAxTXBUF Transmitter Buffer
UCAxRXBUF Receiver Buffer
UCAxSTAT Status
UCBUSY Busy
UCAxCTL
0
UCAxCTL
1
UCAMCTL
Baud Rate Calculation
𝐹 𝐵𝑅𝐶𝐿𝐾
𝑁=
𝐵𝑎𝑢𝑑 𝑅𝑎𝑡𝑒
𝑁 − 𝐷𝑖𝑣𝑖𝑠𝑖𝑜𝑛 𝐹𝑎𝑐𝑡𝑜𝑟 , 𝐹𝐵𝑅𝐶𝐿𝐾 − 𝐶𝑙𝑜𝑐𝑘 𝑜𝑓 𝑡h𝑒 𝐵𝑜𝑎𝑟𝑑
Register Configurations
Baudrate Configuration
Polling Loop
An example on uart_a0 –pin
configuration
/* P2.1 is RX*/
/* P2.0 is TX*/
/* hence select SECONDARY FUNCTION for P2.0 and P2.1*/
P2SEL1 |= (BIT1|BIT0);
P2SEL0 &= ~(BIT1|BIT0);
An example on uart_a0 –start
configuring registers
UCA0MCTLW |= UCOS16;
UCA0BRW = 6;
UCA0MCTLW = (0X0011<<8 | 0X0008<<4 |
0x0001<<0);
An example on uart_a0 –start uart
operation
while (1)
{
while (!(UCA0IFG & UCRXIFG));
UCA0TXBUF = UCA0RXBUF;
}
Thank You