Does the Processor Expert UART component allow usage of RTS?

cancel
Showing results for 
Search instead for 
Did you mean: 

Does the Processor Expert UART component allow usage of RTS?

857 Views
dave408
Senior Contributor II

The transmit enable line on my RS485 transceiver is connected to UART0_RTS (PTB2) on my MK22F processor.  I can send data from the UART just fine with the line pulled high, but I'd like to be able to leverage hardware flow control to automatically assert this line.  However, the processor expert component doesn't look like it exposes a setting for flow control.

Is there any way to enable this?  I've tried the Advanced view, as well as disabling the Tabs view to see if there's an underlying hidden setting, but I haven't found one.

0 Kudos
2 Replies

223 Views
marek_neuzil
NXP Employee
NXP Employee

Hello,

The RTS/CTS hardware functionality is supported by the Init_UART komponent or fsl_uart_hal component:

Init_UART component properties:

pastedImage_0.png

fsl_uart_hal functions:

/*!

* @brief  Enables the UART receiver request-to-send functionality.

*

* This function allows the user to enable the UART receiver request-to-send (RTS) functionality.

* By enabling, it allows the RTS output to control the CTS input of the transmitting device to

* prevent receiver overrun. RTS is deasserted if the number of characters in the receiver data

* register (FIFO) is equal to or greater than RWFIFO[RXWATER]. RTS is asserted when the

* number of characters in the receiver data register (FIFO) is less than RWFIFO[RXWATER].

* Do not set both RXRTSE and TXRTSE.

*

* @param   base UART module base pointer.

* @param   enable   Enable or disable receiver rts.

*/

static inline void UART_HAL_SetReceiverRtsCmd(UART_Type * base, bool enable)

{

    UART_BWR_MODEM_RXRTSE(base, enable);

}

/*!

* @brief  Enables the UART transmitter request-to-send functionality.

*

* This function allows the user to enable the UART transmitter request-to-send (RTS) functionality.

* When enabled, it allows the UART to control the RTS assertion before and after a transmission

* such that when a character is placed into an empty transmitter data buffer, RTS

* asserts one bit time before the start bit is transmitted. RTS deasserts one bit time after all

* characters in the transmitter data buffer and shift register are completely sent, including

* the last stop bit.

*

* @param   base UART module base pointer.

* @param   enable   Enable or disable transmitter RTS.

*/

static inline void UART_HAL_SetTransmitterRtsCmd(UART_Type * base, bool enable)

{

    UART_BWR_MODEM_TXRTSE(base, enable);

}

/*!

* @brief  Configures the UART transmitter RTS polarity.

*

* This function allows the user configure the transmitter RTS polarity to be either active low

* or active high.

*

* @param base UART module base pointer.

* @param polarity The UART transmitter RTS polarity setting (false - active low,

*                 true - active high).

*/

static inline void UART_HAL_SetTransmitterRtsPolarityMode(UART_Type * base, bool polarity)

{

    UART_BWR_MODEM_TXRTSPOL(base, polarity);

}

/*!

* @brief  Enables the UART transmitter clear-to-send functionality.

*

* This function allows the user to enable the UART transmitter clear-to-send (CTS) functionality.

* When enabled, the transmitter checks the state of CTS each time it is ready to send a character.

* If CTS is asserted, the character is sent. If CTS is deasserted, the signal TXD remains in

* the mark state and transmission is delayed until CTS is asserted. Changes in CTS as a

* character is being sent do not affect its transmission.

*

* @param   base UART module base pointer.

* @param   enable   Enable or disable transmitter CTS.

*/

static inline void UART_HAL_SetTransmitterCtsCmd(UART_Type * base, bool enable)

{

    UART_BWR_MODEM_TXCTSE(base, enable);

}

The fsl_uart component does not support the RTS/CTS functionality. You can use this component together with fsl_uart_hal and enable RTS/CTS by using of RTS/CTS functions (see the list above).

Best Regards,

Marek Neuzil

223 Views
dave408
Senior Contributor II

Thank you, Marek.  Once I figure out this other issue I have with the RX FIFO, I'll revisit this and will replace my workaround (manual control of the TX enable line on my RS485 transceiver) with your suggestion.  At that time, I'll mark your answer accordingly.

0 Kudos