You are on page 1of 4

Embedded Processor

Experiment no. 1 (b)


Aim: Interfacing UART of LPC2148 to transmit and receive message.
Appratus: LPC 2148 kit.
Software used:
 Keil uVision4
 Flash Magic
 Circuit Schematic:

Theory:
The LPC2148 devices have two UART (universal asynchronous receive transmit). UART0
and UART1 are both identical and conform to the ‘industry 550 standard’, only UART1 has
modem capability. They both have built in baud rate generator and 16 byte FIFO.
UART (Universal Asynchronous Receiver/Transmitter) is one of the earliest mode of
communication applied to computer (somewhere in 1960s). The information is transmitted
one binary bit at a time; as such it is a serial communication method. These bits are grouped
together in the form of ‘Frames’ (a set format) for conveying one meaningful piece of data
(e.g. character byte). UART is asynchronous because it doesn’t require a transmitter provided
clock to synchronize the transmission and receipt of data at different devices with same baud.

S.C.O.E. Department of E&TC Engineering (2021-22)


Embedded Processor

Fig. 1 Data frame in serial communication

Serial Data Transmission in UART: Just because there is no clock signal per se, a
start bit is added sent first to tell the receiver to listen out for data. The receiver monitors for a
logic HIGH falling to logic LOW. The receiver synchronizes its own bus clock to that make
up the word being sent, with bit zero, the least significant bit (LSB) being sent first. The bits
are sent as pulses on the wire at specific time intervals, set at both ends of links to previously
agreed values. The receiver looks at the voltage on the wire at these times; if it sees logic
high, it records a binary digit 1 or 0 if the line is low. The receiver checks half way between
the start and the end of the pulse to ensure it does not miss-read the voltage on the line during
the brief interval while the voltage is rising or falling.
If two devices use a parity bit for rudimentary error checking, that is calculated and sent next,
in sync with data that has been transmitted thus far. Finally, one stop bit is sent by the
transmitter. Word length, parity availability and type, and numbers of stop bits all have to be
agreed in advance for successful communication because UART uses two wires. The
transmitter of device-A connected to receiver of device-B and receiver of device-A connected
to transmitter of device-B. This is how devices can send data simultaneously to each other, a
mode of communication called ‘full duplex’.
LPC214x has 2 UART blocks which are UART0 and UART1. For UART0 the TxD pin is
P0.0 and RxD pin is P0.1 and similarly for UART 1 the TxD pin is P0.8 and RxD pin is P0.9.

S.C.O.E. Department of E&TC Engineering (2021-22)


Embedded Processor

UART Registers

Baudrate Calculation
LPC2148 generates the baud rate depending on the values of DLM,DLL.

DivAddVal/MulVal == 0
Using the above parameters , DLL/DLM is calculated as below.
(256 * DLL + DLM) = PCLK / (16* Baudrate).
Steps for Configuring UART0
Below are the steps for configuring the UART0.
 Configure the GPIO pin for UART0 function using PINSEL register.
 Configure the FCR for enabling the FIFO and Reset both the Rx/Tx
FIFO.
 Configure LCR for 8-data bits, 1 Stop bit, Disable Parity and Enable
DLAB.
 Calculate the DLM,DLL values for required baudrate from PCLK.

S.C.O.E. Department of E&TC Engineering (2021-22)


Embedded Processor

 Update the DLM,DLL with the calculated values.


 Finally clear DLAB to disable the access to DLM,DLL.

After this, the UART will be ready to Transmit/Receive Data at the specified
baudrate.

Interfacing details
UART1 COM 1 Pin details
LPC 2148 Description
RXD1 P0.9 UART1 Receive
TXD1 P0.8 UART1Transmit

UART0 ( USB to Serial) Pin details


DGBU LPC 2148 Description
RXD0 P0.1 UART0 Receive
TXD0 P0.0 UART0 Transmit

Procedure:
After dumping the hex file into the microcontroller, follow these steps:
1. Open the HyperTerminal.

2. Go to Run/ Exec mode and Press reset on the kit.

3. Verify that you are able to send and receive data to and from the terminal.

Conclusion:
_______________________________________________________________
____________________________________________________________
____________________________________________________________
____________________________________________________________
____________________________________________________________

S.C.O.E. Department of E&TC Engineering (2021-22)

You might also like