Correct UART Init PLEASE HELP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Correct UART Init PLEASE HELP

358 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by drvrh on Thu Jul 23 03:47:21 MST 2015
Hello,

I initialization and send data over UART, but on my computer (FTDi convert) nothing come.

This is my initialization:
void SerialInit(uint32_t baudrate){
uint32_t DL;

LPC_IOCON -> PIO1_7= (1 << 1);
LPC_SYSCON -> SYSAHBCLKCTRL|= (1 << 12);
LPC_SYSCON -> UARTCLKDIV= 0x01;//
DL = (SystemCoreClock * LPC_SYSCON -> SYSAHBCLKDIV)/(16 * baudrate * LPC_SYSCON -> UARTCLKDIV);
LPC_UART->LCR = 0b10000011;  //  8-bit character length, DLAB enable ( DLAB = 1)
LPC_UART->DLM = DL / 256;    //  Determines the baud rate of the UART (MSB Register)     (Access DLAB = 1)
LPC_UART->DLL = DL % 256;    //  Determines the baud rate of the UART (LSB Register)     (Access DLAB = 1)
LPC_UART->LCR = 0b00000011;  //  8-bit character length , DLAB disable ( DLAB = 0)
LPC_UART->FCR = 0b00000111;
}



Here is my function for send UART
void SendSerial(unsigned char send){
while(!(LPC_UART -> LSR & (1 << 5)));
LPC_UART -> THR = send;
}


I don't know what I set uncorrect.
In main program call function SerialInit(57600). 

Please Help.
Thank you for answer.
Labels (1)
0 Kudos
1 Reply

318 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Fri Jul 24 08:02:47 MST 2015
Hi drvrh,

Any particular reason you are not using our software examples in our LPCOpen software platform? At the very least you can use it as a reference as we have our own UART initialization :)

https://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc11xx-packages-0
0 Kudos