I am trying to enable RTS/CTS flow control on LP FLEXCOMM2 UART on a FRDM-MCXN947 with the fsl_lpuart_freertos driver but I am getting kStatus_LPUART_RxRingBufferOverrun.
I believe the pin_mux configuration (below) I have is correct but the logic analyzer never shows change to the RTS line.
/* FUNCTION ************************************************************************************************************
*
* Function Name : UART_Pins
* Description : Configures pin routing and optionally pin electrical features.
*
* END ****************************************************************************************************************/
void UART_Pins(void)
{
/* Enables the clock for PORT4: Enables clock */
CLOCK_EnableClock(kCLOCK_Port4);
/* PORT4_0 (pin P1) is configured as FC2_P0 */
PORT_SetPinMux(UART_PINS_FC2_RX_PORT, UART_PINS_FC2_RX_PIN, kPORT_MuxAlt2);
PORT4->PCR[0] = ((PORT4->PCR[0] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_IBE_MASK)))
/* Input Buffer Enable: Enables. */
| PORT_PCR_IBE(PCR_IBE_ibe1));
/* PORT4_1 (pin P2) is configured as FC2_P1 */
PORT_SetPinMux(UART_PINS_FC2_TX_PORT, UART_PINS_FC2_TX_PIN, kPORT_MuxAlt2);
PORT4->PCR[1] = ((PORT4->PCR[1] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_IBE_MASK)))
/* Input Buffer Enable: Enables. */
| PORT_PCR_IBE(PCR_IBE_ibe1));
/* PORT4_16 (pin R8) is configured as FC2_P2 */
PORT_SetPinMux(UART_PINS_FC2_RTS_PORT, UART_PINS_FC2_RTS_PIN, kPORT_MuxAlt2);
PORT4->PCR[16] = ((PORT4->PCR[16] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_IBE_MASK)))
/* Input Buffer Enable: Enables. */
| PORT_PCR_IBE(PCR_IBE_ibe1));
/* PORT4_17 (pin R9) is configured as FC2_P3 */
PORT_SetPinMux(UART_PINS_FC2_CTS_PORT, UART_PINS_FC2_CTS_PIN, kPORT_MuxAlt2);
PORT4->PCR[17] = ((PORT4->PCR[17] &
/* Mask bits to zero which are setting */
(~(PORT_PCR_IBE_MASK)))
/* Input Buffer Enable: Enables. */
| PORT_PCR_IBE(PCR_IBE_ibe1));
}
Here is the flexcomm configuration in peripherals.c
/***********************************************************************************************************************
* LP_FLEXCOMM2 initialization code
**********************************************************************************************************************/
/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
instance:
- name: 'LP_FLEXCOMM2'
- type: 'lpflexcomm_lpuart'
- mode: 'freertos'
- custom_name_enabled: 'false'
- type_id: 'lpflexcomm_lpuart_2.3.0'
- functional_group: 'BOARD_InitPeripherals'
- peripheral: 'LP_FLEXCOMM2'
- config_sets:
- fsl_lpuart_freertos:
- lpuart_rtos_configuration:
- timingConfig:
- clockSource: 'LPFLEXCOMMFunctionClock'
- lpuartSrcClkFreq: 'BOARD_BootClockPLL150M'
- baudRateBpsStr: '115200'
- parity: 'kLPUART_ParityDisabled'
- stopbits: 'kLPUART_OneStopBit'
- buffer_size: '512'
- enableRxRTS: 'true'
- enableTxCTS: 'true'
- txCtsSource: 'kLPUART_CtsSourcePin'
- txCtsConfig: 'kLPUART_CtsSampleAtStart'
- rx_timeout_constant_ms: '0'
- rx_timeout_multiplier_ms: '0'
- tx_timeout_constant_ms: '0'
- tx_timeout_multiplier_ms: '0'
- interrupt_rx_tx:
- IRQn: 'LP_FLEXCOMM2_IRQn'
- enable_priority: 'false'
- priority: '0'
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */
lpuart_rtos_handle_t LP_FLEXCOMM2_rtos_handle;
lpuart_handle_t LP_FLEXCOMM2_lpuart_handle;
uint8_t LP_FLEXCOMM2_background_buffer[LP_FLEXCOMM2_BACKGROUND_BUFFER_SIZE];
lpuart_rtos_config_t LP_FLEXCOMM2_rtos_config = {
.base = LP_FLEXCOMM2_PERIPHERAL,
.srcclk = LP_FLEXCOMM2_CLOCK_SOURCE,
.baudrate = 115200UL,
.parity = kLPUART_ParityDisabled,
.stopbits = kLPUART_OneStopBit,
.buffer = LP_FLEXCOMM2_background_buffer,
.buffer_size = 512UL,
.enableRxRTS = true,
.enableTxCTS = true,
.txCtsSource = kLPUART_CtsSourcePin,
.txCtsConfig = kLPUART_CtsSampleAtStart,
.rx_timeout_constant_ms = 0UL,
.rx_timeout_multiplier_ms = 0UL,
.tx_timeout_constant_ms = 0UL,
.tx_timeout_multiplier_ms = 0UL
};
If RTS is working correctly then shouldn't the driver never overflow?