Lecture 10 11 UART Notes
Lecture 10 11 UART Notes
Lecture 10 11 UART Notes
Introduction
• UART (Universal Asynchronous Receiver/Transmitter) is a serial communication protocol in
which data is transferred serially bit by bit at a time. Asynchronous serial communication is widely
used for byte oriented transmission. In Asynchronous serial communication, a byte of data is
transferred at a time.
• UART serial communication protocol uses a defined frame structure for their data byte.
• Frame structure in Asynchronous communication consists :
• START bit: It is a bit with which indicates that serial communication has started and it is always
low.
• Data bits packet: Data bits can be packets of 5 to 9 bits. Normally we use 8 bit data packet, which
is always sent after the START bit.
• STOP bit: This usually is one or two bits in length. It is sent after data bits packet to indicate the
end of frame. Stop bit is always logic high.
Introduction
• UART (Universal Asynchronous Receiver/Transmitter) is a serial communication protocol in
which data is transferred serially bit by bit at a time. Asynchronous serial communication is widely
used for byte oriented transmission. In Asynchronous serial communication, a byte of data is
transferred at a time.
• UART serial communication protocol uses a defined frame structure for their data byte.
• Frame structure in Asynchronous communication consists :
• START bit: It is a bit with which indicates that serial communication has started and it is always
low.
• Data bits packet: Data bits can be packets of 5 to 9 bits. Normally we use 8 bit data packet, which
is always sent after the START bit.
• STOP bit: This usually is one or two bits in length. It is sent after data bits packet to indicate the
end of frame. Stop bit is always logic high.
Introduction
• UART (Universal Asynchronous Receiver/Transmitter) is a serial communication protocol in
which data is transferred serially bit by bit at a time. Asynchronous serial communication is widely
used for byte oriented transmission. In Asynchronous serial communication, a byte of data is
transferred at a time.
• UART serial communication protocol uses a defined frame structure for their data byte.
• Frame structure in Asynchronous communication consists :
• START bit: It is a bit with which indicates that serial communication has started and it is always
low.
• Data bits packet: Data bits can be packets of 5 to 9 bits. Normally we use 8 bit data packet, which
is always sent after the START bit.
• STOP bit: This usually is one or two bits in length. It is sent after data bits packet to indicate the
end of frame. Stop bit is always logic high.
UART Frame Structure
Introduction
• UART (Universal Asynchronous Receiver/Transmitter) is a serial communication protocol in
which data is transferred serially bit by bit at a time. Asynchronous serial communication is widely
used for byte oriented transmission. In Asynchronous serial communication, a byte of data is
transferred at a time.
• UART serial communication protocol uses a defined frame structure for their data byte.
• Frame structure in Asynchronous communication consists :
• START bit: It is a bit with which indicates that serial communication has started and it is always
low.
• Data bits packet: Data bits can be packets of 5 to 9 bits. Normally we use 8 bit data packet, which
is always sent after the START bit.
• STOP bit: This usually is one or two bits in length. It is sent after data bits packet to indicate the
end of frame. Stop bit is always logic high.
UART Frame Structure
UART Frame Structure
• Usually, an asynchronous serial communication frame consists of
• a START bit (1 bit) followed by
• a data byte (8 bits) and then
• a STOP bit (1 bit),
• which forms a 10-bit frame.
• The frame can also consist of 2 STOP bits instead of a single bit, and there can also be a PARITY
bit after the STOP bit.
LPC2148 UART
• LPC2148 has two inbuilt UARTs available i.e. UART0 & UART1.
• So, we can connect two UART enabled devices (GSM module, GPS module,
Bluetooth module etc.) with LPC2148 at a time.
• UART0 and UART1 are identical other than the fact that UART1 has modem
interface included.
• UART1 :
• TXD1 (Output pin): Serial Transmit
data pin.
• RXD1 (Input pin): Serial Receive
data pin.
LPC2148 UART
Pins
• RTS1 (Output pin): Request To Send signal pin.
Active low signal indicates that the UART1 would
like to transmit data to the external modem.
• CTS1 (Input pin): Clear To Send signal pin. Active
low signal indicates if the external modem is ready
to accept transmitted data via TXD1 from the
UART1.
• DSR1 (Input pin): Data Set Ready signal pin. Active
low signal indicates if the external modem is ready
to establish a communication link with the UART1.
• DTR1 (Output pin): Data Terminal Ready signal pin.
Active low signal indicates that the UART1 is ready
to establish connection with external modem.
• DCD1 (Input pin): Data Carrier Detect signal pin.
Active low signal indicates if the external modem
has established a communication link with the
UART1 and data may be exchanged.
• RI1 (Input pin): Ring Indicator signal pin. Active low
signal indicates that a telephone ringing signal has
been detected by the modem.
LPC2148 UART
Pins
• RTS1 (Output pin): Request To Send signal pin.
Active low signal indicates that the UART1 would
like to transmit data to the external modem.
• CTS1 (Input pin): Clear To Send signal pin. Active
low signal indicates if the external modem is ready
to accept transmitted data via TXD1 from the
UART1.
• DSR1 (Input pin): Data Set Ready signal pin. Active
low signal indicates if the external modem is ready
to establish a communication link with the UART1.
• DTR1 (Output pin): Data Terminal Ready signal pin.
Active low signal indicates that the UART1 is ready
to establish connection with external modem.
• DCD1 (Input pin): Data Carrier Detect signal pin.
Active low signal indicates if the external modem
has established a communication link with the
UART1 and data may be exchanged.
• RI1 (Input pin): Ring Indicator signal pin. Active low
signal indicates that a telephone ringing signal has
been detected by the modem.
LPC2148 UART
Pins
• RTS1 (Output pin): Request To Send signal pin.
Active low signal indicates that the UART1 would
like to transmit data to the external modem.
• CTS1 (Input pin): Clear To Send signal pin. Active
low signal indicates if the external modem is ready
to accept transmitted data via TXD1 from the
UART1.
• DSR1 (Input pin): Data Set Ready signal pin. Active
low signal indicates if the external modem is ready
to establish a communication link with the UART1.
• DTR1 (Output pin): Data Terminal Ready signal pin.
Active low signal indicates that the UART1 is ready
to establish connection with external modem.
• DCD1 (Input pin): Data Carrier Detect signal pin.
Active low signal indicates if the external modem
has established a communication link with the
UART1 and data may be exchanged.
• RI1 (Input pin): Ring Indicator signal pin. Active low
signal indicates that a telephone ringing signal has
been detected by the modem.
LPC2148 UART
Pins
• RTS1 (Output pin): Request To Send signal pin.
Active low signal indicates that the UART1 would
like to transmit data to the external modem.
• CTS1 (Input pin): Clear To Send signal pin. Active
low signal indicates if the external modem is ready
to accept transmitted data via TXD1 from the
UART1.
• DSR1 (Input pin): Data Set Ready signal pin. Active
low signal indicates if the external modem is ready
to establish a communication link with the UART1.
• DTR1 (Output pin): Data Terminal Ready signal pin.
Active low signal indicates that the UART1 is ready
to establish connection with external modem.
• DCD1 (Input pin): Data Carrier Detect signal pin.
Active low signal indicates if the external modem
has established a communication link with the
UART1 and data may be exchanged.
• RI1 (Input pin): Ring Indicator signal pin. Active low
signal indicates that a telephone ringing signal has
been detected by the modem.
LPC2148 UART
Pins
• RTS1 (Output pin): Request To Send signal pin.
Active low signal indicates that the UART1 would
like to transmit data to the external modem.
• CTS1 (Input pin): Clear To Send signal pin. Active
low signal indicates if the external modem is ready
to accept transmitted data via TXD1 from the
UART1.
• DSR1 (Input pin): Data Set Ready signal pin. Active
low signal indicates if the external modem is ready
to establish a communication link with the UART1.
• DTR1 (Output pin): Data Terminal Ready signal pin.
Active low signal indicates that the UART1 is ready
to establish connection with external modem.
• DCD1 (Input pin): Data Carrier Detect signal pin.
Active low signal indicates if the external modem
has established a communication link with the
UART1 and data may be exchanged.
• RI1 (Input pin): Ring Indicator signal pin. Active low
signal indicates that a telephone ringing signal has
been detected by the modem.
LPC2148 UART
Pins
• RTS1 (Output pin): Request To Send signal pin.
Active low signal indicates that the UART1 would
like to transmit data to the external modem.
• CTS1 (Input pin): Clear To Send signal pin. Active
low signal indicates if the external modem is ready
to accept transmitted data via TXD1 from the
UART1.
• DSR1 (Input pin): Data Set Ready signal pin. Active
low signal indicates if the external modem is ready
to establish a communication link with the UART1.
• DTR1 (Output pin): Data Terminal Ready signal pin.
Active low signal indicates that the UART1 is ready
to establish connection with external modem.
• DCD1 (Input pin): Data Carrier Detect signal pin.
Active low signal indicates if the external modem
has established a communication link with the
UART1 and data may be exchanged.
• RI1 (Input pin): Ring Indicator signal pin. Active low
signal indicates that a telephone ringing signal has
been detected by the modem.
LPC2148 UART
Pins
• RTS1 (Output pin): Request To Send signal pin.
Active low signal indicates that the UART1 would
like to transmit data to the external modem.
• CTS1 (Input pin): Clear To Send signal pin. Active
low signal indicates if the external modem is ready
to accept transmitted data via TXD1 from the
UART1.
• DSR1 (Input pin): Data Set Ready signal pin. Active
low signal indicates if the external modem is ready
to establish a communication link with the UART1.
• DTR1 (Output pin): Data Terminal Ready signal pin.
Active low signal indicates that the UART1 is ready
to establish connection with external modem.
• DCD1 (Input pin): Data Carrier Detect signal pin.
Active low signal indicates if the external modem
has established a communication link with the
UART1 and data may be exchanged.
• RI1 (Input pin): Ring Indicator signal pin. Active low
signal indicates that a telephone ringing signal has
been detected by the modem.
UART0 Registers
1. UART0 RBR Registers
• Data Registers
• Control Registers
• Status Registers
1. U0RBR (UART0 Receive Buffer
Register)
• It is an 8-bit read only register.
• This register contains the received data.
• It contains the “oldest” received byte in the receive
FIFO.
• If the character received is less than 8 bits, the unused
MSBs are padded with zeroes.
• The Divisor Latch Access Bit (DLAB) in U0LCR must be
zero in order to access the U0RBR. (DLAB = 0)
2. U0THR (UART0 Transmit Holding
Register)
• It is an 8-bit write only register.
• Data to be transmitted is written to this register.
• It contains the “newest” received byte in the transmit
FIFO.
• The Divisor Latch Access Bit (DLAB) in U0LCR must be
zero in order to access theU0THR. (DLAB = 0)
3. U0DLL and U0DLM (UART0 Divisor
Latch Registers)
• U0DLL is the Divisor Latch LSB.
• U0DLM is the Divisor Latch MSB.
• These are 8-bit read-write registers.
• UART0 Divisor Latch holds the value by which the
PCLK(Peripheral Clock) will be divided. This value must be
1/16 times the desired baud rate.
• A 0x0000 value is treated like a 0x0001 value as division
by zero is not allowed.
• The Divisor Latch Access Bit (DLAB) in U0LCR must be one
in order to access the UART0 Divisor Latches. (DLAB = 1)
4. U0FDR (UART0 Fractional Divider
Register)
• It is a 32-bit read write register.
• It decides the clock pre-scalar for baud rate generation.
• If fractional divider is active (i.e. DIVADDVAL>0) and DLM = 0,
DLL must be greater than 3.
• If DIVADDVAL is 0, the fractional baudrate generator will not
impact the UART0 baudrate.
• Reset value of DIVADDVAL is 0.
• MULVAL must be greater than or equal to 1 for UART0 to
operate properly, regardless of whether the fractional baudrate
generator is used or not.
• Reset value of MULVAL is 1.
4. U0FDR (UART0 Fractional Divider
Register)
• 0X83 = 0X1000_0011
• It is an 8-bit read-write register.
• It determines the format of the data character that is to be
transmitted or received.
• Bit 1:0 - Word Length Select
00 = 5-bit character length
01 = 6-bit character length
10 = 7-bit character length
11 = 8-bit character length
7. U0LCR (UART0 Line Control Register)
• Bit 7 : TXEN
0 = Transmission disabled
1 = Transmission enabled
• If this bit is cleared to 0 while a character is being sent,
the transmission of that character is completed, but no
further characters are sent until this bit is set again.
1. Initialization of UART0