LPC1837 receiving data on UART

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

LPC1837 receiving data on UART

705 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jb111 on Thu Jan 29 18:07:04 MST 2015
Hi,

Im using the LPC1837 with LPCExpresso. So far Ive been able to send characters via UART0, but I am unable to receive any characters. Ive been using the uart functions from the header lpc18xx_uart.h in the CMSIS driver library.

I think I have narrowed it down to a  problem in software, as I've scoped the receive line when I send data. I also set the RX pin as a GPIO and was able to scope the pin toggling. I don't think its a baud rate issue since i can send data and read it on the other side.

Even when I send data the Line Status Register(LSR) doesn't show any change on the RDR bit (ie that its empty).

I've scoured the user manual and cant find anything... I think Im not setting a register correctly but don't know which one. My USART0 registers are all zero except for:
IIR = 0x01
LCR= 0x3
FDR=0xa1
OSR=0xf0
TER=0x1

My code is as follows:

// Set Pin mode to RX
LPC_SCU->SFSP2_1 = (0x07 & 0x01);


//Condfigure Uart0 with fucntions from lpc18xx_uart.h
UART_CFG_Type  uartCfg;
UART_ConfigStructInit(&uartCfg);
UART_Init(LPC_USART0,&uartCfg);

while(1) {


lsr= UART_GetLineStatus(LPC_USART0);
a= UART_ReceiveByte(LPC_USART0);

//check if has received anything on LSR RBR bit
b=lsr & 1;
if(b)
{
//send data back
UART_TxCmd(LPC_USART0,ENABLE);
UART_SendByte(LPC_USART0,a);
}
}



Any help would be greatly appreciated.
Thanks
Labels (1)
0 Kudos
3 Replies

544 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jb111 on Sun Feb 01 20:14:16 MST 2015
Thanks for the help. I got the lpcopen example running and found that I wasnt setting the Input buffer enable.
0 Kudos

544 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Fri Jan 30 08:28:58 MST 2015
Hi jb111,

Please take a look at our LPCOpen Software Platform, as TheFallGuy suggests. These are updated drivers that we actively support:

http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc18xx-packages-0

I would start by downloading the LPCOpen package for the Keil MCB1800 since the other two packages are for flashless chips. We have a UART example that you can try out yourself. Keep in mind that the software example will be tailored towards the Keil MCB1800 board so you may need to enable the UART that you are interested in using.

Let me know if you have any more questions!
0 Kudos

544 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Fri Jan 30 01:27:12 MST 2015
How about starting from a working example, as found in LPCOpen?
0 Kudos