Forums

lpc2387 uart2 problem

Started by "sum...@yahoo.com [lpc2000]" September 4, 2015
below is my UART2 code is not working please suggest me what I am missing

PCONP |= 1<<24;
PINSEL0 = 0x00500000;

U2FCR = 0x07; /* Enable and reset TX and RX FIFO. */
U2LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
Fdiv = ( Fpclk / 16 ) / baudrate ; /*baud rate */
U2DLM = Fdiv / 256;
U2DLL = Fdiv % 256;

U2LCR = 0x03;

An Engineer's Guide to the LPC2100 Series

From the User Manual, there are 6 steps in the initialization process. One of which turns to PCLK on for the UART.

The baud rate calculation doesn't look right. Even if the registers are loaded, all you're going to get is a baud rate 1/16 of PCLK and that's usually pretty fast. Then there is the fraction divider...

Take a look at the relevant chapter in the User Manual and see if it helps.