AnsweredAssumed Answered

LPCXpresso 54628 UART4 communication

Question asked by Ramesh pyla on Dec 4, 2018

I am using OM13098 (LPCXpresso 54628) Board. I need to receive/transmit data through UART4 (P3_26_FC4_RXD/P3_27_FC4_TXD) connector J13, Pin 15/16, at 115200 baud rate. It works fine in UART0 (P0_29/P0_30) through connector P4, but I don’t get any data output from UART4. Below is the code I use:

1.       I define the USART Ports:

#define DEMO_USART USART4

#define DEMO_USART_CLK_SRC kCLOCK_Flexcomm4

#define DEMO_USART_CLK_FREQ CLOCK_GetFreq(kCLOCK_Flexcomm4)

#define DEMO_USART_IRQHandler FLEXCOMM4_IRQHandler

#define DEMO_USART_IRQn FLEXCOMM4_IRQn

2.       I initialize the Pins 3_ 26, P3_27

const uint32_t port3_pin26_config = (

         IOCON_PIO_FUNC1 |                                      

         IOCON_PIO_MODE_INACT |                                   

         IOCON_PIO_INV_DI |                                      

         IOCON_PIO_DIGITAL_EN |                                  

         IOCON_PIO_INPFILT_OFF |                                 

         IOCON_PIO_SLEW_STANDARD |                               

         IOCON_PIO_OPENDRAIN_DI                                   

       );

       IOCON_PinMuxSet(IOCON, 3U, 26U, port3_pin26_config); /* PORT3 PIN26 is configured as FC4_RXD_SCL_MISO */

       const uint32_t port3_pin27_config = (

         IOCON_PIO_FUNC1 |                                       

         IOCON_PIO_MODE_INACT |                                  

         IOCON_PIO_INV_DI |                                       

         IOCON_PIO_DIGITAL_EN |                                  

         IOCON_PIO_INPFILT_OFF |                                 

         IOCON_PIO_SLEW_STANDARD |                               

         IOCON_PIO_OPENDRAIN_DI                                  

       );

       IOCON_PinMuxSet(IOCON, 3U, 27U, port3_pin27_config); /* PORT3 PIN27 is configured as FC4_TXD_SCL_MISO */

3.       I attach the clock for FC4

CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);

4.       I Intialize the UART

USART_GetDefaultConfig(&config);

    config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;

    config.enableTx = true;

    config.enableRx = true;

    USART_Init(DEMO_USART, &config, DEMO_USART_CLK_FREQ);

5.       I send the string through the UART (This is in the infinite while loop so that I can check for data continuously)

USART_WriteBlocking(DEMO_USART, g_tipString, sizeof(g_tipString) / sizeof(g_tipString[0]));

lpc54628 uart lpcxpresso 54618

Outcomes