Content originally posted in LPCWare by jb111 on Tue Jan 27 20:01:52 MST 2015
Hi,
I am using a LPC1837JET100 and trying to get UART0 working. I am using LPCXpresso. The U0_TXD pin is held high. It is not a hardware problem as I was able to toggle the pin when I set it as a GPIO (it was GPIO5[0]). At the moment I'm not concerned about baud rate and other options so I used the defaults provided in UART_ConfigStructInit(). I just want to be able to see the pin changing.
I am using the uart driver provided in the lpc18xx_uart.h header. Below is my code, it compiles fine and Im not doing anything else.
Any help would be greatly appreciated.
Thanks in advanced
//Initialing UART0 with functions given in lpc18xx_uart.h
UART_CFG_Type uartCfg;
UART_ConfigStructInit(&uartCfg);
UART_Init(LPC_USART0,&uartCfg);
//set gpio to flash led
GPIO_SetDir(PORT1,LED0,GPIO_DIR_OUT);
while(1)
{
//send character and flash LED
UART_SendByte(LPC_USART0,(uint8_t)'a');
GPIO_ToggleValue(PORT1,LED0);
//wait
int i=0;
for(i;i<1000000;i++)
{
}
}