How to flush the uart FIFO with CTS enabled for S32K146

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to flush the uart FIFO with CTS enabled for S32K146

Jump to solution
710 Views
snowy
Contributor I

Hi support team,

We're using UART Tx FIFO function with CTS feature enabled. After having checked with the errata file of S32K146, we find that the ERR051629 is related to our case. My understanding of this issue is that if the CTS pin is changed to low during the tx FIFO is flushing with CTS feature enabled, the transmit complete bit will not be set, the workaround is to clear the MODIR[TXCTSE] bit before setting FIFO[TXFLUSH] bit to 1 if the CTS feature is enabled, and then set the MODIR[TXCTSE] bit again, such as the following code changes based on the NXP RTD code:

/**
* @brief : Flush Tx Buffer
*
* This function causes all data that is stored in the transmit FIFO/buffer to be flushed.
* *
* @Param Base LPUART Base pointer
*/
static inline void Lpuart_Uart_Ip_FlushTxBuffer(LPUART_Type * Base)
{
Base->MODIR &= 0xFFFFFFFEu; /*Clear (MODIR[TXCTSE]) bit*/
Base->FIFO |= 0x00008000u; /*reset the transmit FIFO (FIFO[TXFLUSH] = 0b1)*/
Base->MODIR |= 0x00000001u; /*Set (MODIR[TXCTSE]) bit*/
}

Is my understanding correct? If it's not correct, how should I handle this problem? 

0 Kudos
Reply
1 Solution
634 Views
danielmartynek
NXP TechSupport
NXP TechSupport

HI @snowy,

CTS_B is asserted when the input voltage level goes LOW.

The CTS_B pin must assert for longer than one bit period to guarantee that a new transmission is started when the transmitter is idle.

The transmitter checks the state of the CTS signal each time it is ready to send a character. If
CTS is asserted, the character is sent. If CTS is deasserted, the TXD signal remains in the mark state and transmission is delayed until CTS is asserted.

So, it will not stop transmitting, it will send the data present in the FIFO.

 

Regards,

Daniel

View solution in original post

0 Kudos
Reply
3 Replies
655 Views
snowy
Contributor I

Hi Daniel,

Thank you very much for your reply.

Could you please help check the following question?

If the CTS pin is changed to low during writing data into tx FIFO, will the data stop transmitting until the CTS pin be changed back to high? Or the tx will be abort directly with data lost?

0 Kudos
Reply
635 Views
danielmartynek
NXP TechSupport
NXP TechSupport

HI @snowy,

CTS_B is asserted when the input voltage level goes LOW.

The CTS_B pin must assert for longer than one bit period to guarantee that a new transmission is started when the transmitter is idle.

The transmitter checks the state of the CTS signal each time it is ready to send a character. If
CTS is asserted, the character is sent. If CTS is deasserted, the TXD signal remains in the mark state and transmission is delayed until CTS is asserted.

So, it will not stop transmitting, it will send the data present in the FIFO.

 

Regards,

Daniel

0 Kudos
Reply
674 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Helle @snowy,

Yes, this is correct.

If you have any specific question, let me know,

 

BR, Daniel

0 Kudos
Reply