Content originally posted in LPCWare by SodaAnt on Fri Aug 15 20:20:21 MST 2014
So I've finally gotten the transmit side of one of the UARTS working, but for some reason I can never get the UART to receive anything. I've tried two different USB to UART adapters, and even connecting the TX and RX pins directly on the board, however I still get absolutely no data, and the interrupt is never triggered.
Here's the code I'm using:
void UART_INIT(void)
{
LPC_CGU->BASE_UART0_CLK |= 0x9 << 24;
LPC_CCU2->CLK_APB0_USART0_CFG |= 0x1;
LPC_USART0->LCR |= (1 << 7 | 3);// Set USART0 word length to 8-bit
LPC_USART0->DLL = 36;
LPC_USART0->DLM |= 0;// Eq 6 in manual
LPC_USART0->LCR &= ~(1 << 7);
LPC_USART0->FDR |= (13 << 4 | 7);
LPC_USART0->FCR |= 1;
LPC_USART0->IER |= 1;
NVIC_SetPriority(USART0_IRQn, 13);
NVIC_EnableIRQ(USART0_IRQn);
}
Any idea what's going wrong?