Uart is sending incomplete data

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

Uart is sending incomplete data

164 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by emielzij on Thu Nov 27 01:50:29 MST 2014
I'm trying to get the uart to work. But the lpc11c24 is not sending the complete byte.
This is my code:

#include "LPC11xx.h"

//PIO1_7 TXD pin

void uart_init(void)
{
LPC_IOCON->PIO1_7 |= (1 << 0);        //Select TXD function for GPIO1_7
LPC_IOCON->PIO1_7 &= ~(1 << 4);//Disable internal pull up resistor on GPIO1_7

LPC_UART->LCR |= (1 << 7);//Set DLAB, to configure u0dll u0dlm
LPC_UART->DLL |= 4;
LPC_UART->DLM |= 0;
LPC_UART->LCR &= ~(1 << 7);//Clear DLAB for normal operation

LPC_UART->FDR |= 0b0101;//Set DIVADDVAL = 5
LPC_UART->FDR |= 0b10000000;//Set MULVAL = 8

LPC_UART->FCR =1;//Enable uart FIFO
LPC_UART->LCR |= 0x03;//Select 8-bit data
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 12);//Enable uart
LPC_SYSCON->UARTCLKDIV = 26;//Enable peripheral clock, UARTCLKDIV for 115200 bit/s baud

LPC_UART->TER |= (1 << 3);//Enable transmit
}

int main(void)
{
uart_init();

while( (LPC_UART->LSR & 0x00000020) == 0x00000000){}//While bit 5 THRE in U0LSR is 0 -> containts data -> wait
LPC_UART->LCR &= ~(1 << 7);//Clear DLAB for normal operation
LPC_UART->THR = 85;

while (1)
{

}
}


I did some measurements but only 1010 is send and not the complete byte.
0 Kudos
Reply
0 Replies