AnsweredAssumed Answered

UART0 on LPC11U68

Question asked by lpcware Employee on Jun 15, 2016
Latest reply on Jul 29, 2016 by Ergo Pehtla
Content originally posted in LPCWare by williamjsell on Fri Nov 20 15:06:37 MST 2015
I am struggling to get the UART0 peripheral to work on the LPC11U68.  The problem is getting an interrupt generated when the THR is empty.  Should be simple no?  To just try a simple test, I have configured the UART0 to send out a single character after being initialized.  The nterrupt is called, but the status of the interrupt makes no sense.  When I read the IIR status register inside the interrupt:

    uint32_t status = Chip_UART0_ReadIntIDReg(LPC_USART0);

the value of status is 0xC1.  0x1 indicates "no interrupt pending".  I was expecting to see on the INTID a value of 1, to indicate the THR is empty and ready for another byte.  This is required to start the state machine running.  The 0xC value indicates the FIFO is enabled with 1 character depth. 

Any ideas on what is going on?


bool
xMBPortSerialInit(uint32_t ulBaudRate, eMBParity eParity)
{
//set debug pin as an output
    bool  bInitialized = pdTRUE;
    //UART signals on pins PIO0_14 (FUNC4, U1_TXD) and PIO0_13 (FUNC4, U1_RXD)
    //NOTE: The port initialization is not part of the modbus library.  This allows other
    //processors to be used with the Modbus library. 
Chip_IOCON_PinMuxSet(LPC_IOCON, IOP_GETPORTNUM(pindef_CALRXD), IOP_GETPINNUM(pindef_CALRXD), (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, IOP_GETPORTNUM(pindef_CALTXD), IOP_GETPINNUM(pindef_CALTXD), (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN));
    Chip_UART0_Init(LPC_USART0);
    Chip_UART0_SetBaud(LPC_USART0, 115200);
/* Enable receive data and line status interrupt */
Chip_UART0_IntEnable(LPC_USART0, (UART0_IER_RBRINT | UART0_IER_THREINT));
    Chip_UART0_ConfigData(LPC_USART0, (UART0_LCR_WLEN8 | UART0_LCR_SBS_1BIT | UART0_LCR_PARITY_DIS));
/* Enable UART 0 interrupt */
NVIC_EnableIRQ(USART0_IRQn);
    //stop bits are 1 by default, 2 if no parity is used

    //a simple test
    xMBPortSerialPutByte(0x10);

    return bInitialized;
}

Outcomes