Hi,
Got things working? USART0 is different from USART1-4.
Be sure to enable clocks:
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
Chip_GPIO_Init(LPC_GPIO);
Then:
Chip_IOCON_PinMuxSet(LPC_IOCON, Port, Pin, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, Port, Pin, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
//Where Port and pins are dependent on your HW, and FUNC1 is just an assumption too here. See actual table from user manual.
Init:
Chip_UART0_Init(LPC_USART0);
Chip_UART0_SetBaud(LPC_USART0, 115200);
Chip_UART0_ConfigData(LPC_USART0, (UART0_LCR_WLEN8 | UART0_LCR_SBS_1BIT));
Chip_UART0_TXEnable(LPC_USART0);
Chip_UART0_IntEnable(LPC_USART0, UARTN_INTEN_RXRDY);
NVIC_EnableIRQ(USART0_IRQn);
Then inteerupt appears on RX byte.
In interrupt handler you should do smth like this:
IIRValue = LPC_USART0->IIR;
if(IIRValue & UART0_IIR_INTID_RLS)
{
LSRValue = LPC_USART0->LSR;
if (LSRValue & (LSR_OE | LSR_PE | LSR_FE | LSR_RXFE | LSR_BI))
{
Dummy = (uint8_t)LPC_USART0->RBR; // Dummy read on RX to clear interrupt
return;
}
if (LSRValue & LSR_RDR) // Receive Data Ready
{
variable = ((uint8_t)LPC_USART0->RBR);
}
}
else if(IIRValue & UART0_IIR_INTID_RDA)
{
variable = ((uint8_t)LPC_USART0->RBR);
}
BR,
Ergo