AnsweredAssumed Answered

Making UART receive work on LPC18xx

Question asked by vamshi krishna on Jul 14, 2016
Latest reply on Jul 14, 2016 by David E Seymour

Hi folks,


I am running the sample examples from lpcopen_2_18_lpcxpresso_nxp_lpcxpresso_1837, I see the UART receive function is not working. I have connected FTDI UART to usb cable, and connected the RX, TX & GND lines to U0_TXD, U0_RXD and GND lines.


I am able to see the following prints on Gtkterm/Cutecom


LPC18xx/43xx UART example using ring buffers

Press a key to echo it back or ESC to quit


But when I enter any key on the keyboard it is not able to receive.


Instead I went to use UART1, it worked fine with the following modifications.

Change it in uart_rb.c file of periph_uart_rb project


#if (defined(BOARD_NXP_LPCXPRESSO_4337) || defined(BOARD_NXP_LPCXPRESSO_1837))

#define UARTx_IRQn  UART1_IRQn
#define UARTx_IRQHandlerUART1_IRQHandler



In board.c file I have added code to do pin muxing based on the requested UART port


void Board_UART_Init(LPC_USART_T *pUART)


    if (pUART == LPC_USART0) {

        Chip_SCU_PinMuxSet(0x6, 4, (SCU_MODE_INACT | SCU_MODE_FUNC2));                    /* P6,4 : UART0_TXD */

        Chip_SCU_PinMuxSet(0x2, 1, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC1));/* P2.1 : UART0_RXD */

    }else {

        Chip_SCU_PinMuxSet(0x1, 13, (SCU_MODE_INACT | SCU_MODE_FUNC1));                    /* P1.13 : UART1_TXD */

        Chip_SCU_PinMuxSet(0x1, 14, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC1));/* P1.14 : UART1_RXD */



After the above modification I am able to send the data over UART, I have used U1_TXD, U1_RXD & GND pins on the RDK for connecting to FTDI UART to USB cable.


Thanks & Regards,

Vamshi G.