I am trying to get the UART hardware flow control to work on LCP54101.
The RTS does toggle when data sending to the LPC54101 RX, however the RTS polarity seems to be wrong, supposed to be active low? Also observed there is missing data received, the hardware flow control doesn't seems to work properly. Could someone share some idea how to get the hardware flow control to work?
UART initialization call as shown in below
void Init_UART(UART_PORT_SELECTOR port_id, RX_HANDLER rx_handler) {
assert( port_id < UART_LAST_PORT );
Chip_Clock_SetAsyncSysconClockDiv(1);
Chip_SYSCON_Enable_ASYNC_Syscon(true);
Chip_UART_Init(port->uart_port);
Chip_IOCON_PinMuxSet(LPC_IOCON, PORT(port->cts_pin), PIN(port->cts_pin), IOCON_FUNC2 | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
Chip_IOCON_PinMuxSet(LPC_IOCON, PORT(port->rts_pin), PIN(port->rts_pin), IOCON_FUNC2 | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
Chip_UART_ConfigData(port->uart_port, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1 | UART_CFG_CTSEN);
Chip_UART_SetBaud(port->uart_port, port->baud);
Chip_IOCON_PinMuxSet(LPC_IOCON, PORT(port->rx_pin), PIN(port->rx_pin), IOCON_MODE_INACT | IOCON_FUNC1 | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
Chip_IOCON_PinMuxSet(LPC_IOCON, PORT(port->tx_pin), PIN(port->tx_pin), IOCON_MODE_INACT | IOCON_FUNC1 | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
Chip_UART_Enable(port->uart_port);
Chip_UART_TXEnable(port->uart_port);
port->rx_handler = rx_handler;
if(rx_handler) {
Chip_UART_IntEnable(port->uart_port, UART_INTEN_RXRDY );
}
Chip_UART_IntDisable(port->uart_port, UART_INTEN_TXRDY);
NVIC_SetPriority(port->irq_number, INT_PRIORITY_UART);
NVIC_EnableIRQ(port->irq_number);
}
please refer to the UART initialization call as captioned above, wondering if I init the UART hardware flow control correctly.
Hi terence Kong,
I don't find any error in the above code, so I was wondering if you can share a complete demo,
As I know, the UART module provides a Loopback mode which is able to diagnostic loopback testing for USART data, in another word, Un_TXD ,Un_RTS Un_RXD and Un_CTS activity will appear on external pins if these functions are configured to appear on device pins.
Please giving a try.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi terence Kong,
Thank you for your interest in NXP Semiconductor products and
To figure it out, I was wondering if you can share a compilable demo, then I can replicate the issue on my site.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
please refer to the UART initialization call as captioned above, wondering if I init the UART hardware flow control correctly?