This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280025: How to deal with TX EMPTY on LIN as SCI mode for half-duplex RS485?

Part Number: TMS320F280025

Dear champs,

I am asking this for our customer.

The user uses LIN as SCI with a half-duplex RS485 transceiver.

Because of the half-duplex RS485 transceiver, the user has to ensure the transmission is done before he enables the reception.

On the LIN module used as SCI, there is a TX EMPTY register, but it does not have interrupt capability.

Instead, there is only TXRDY interrupt.

In TRM, it says "The transmit ready (TXRDY) flag is set when the SCI transfers the contents of SCITD to the shift register, SCITXSHF. The TXRDY flag indicates that SCITD is ready to be loaded with more data. In addition, the SCI sets the TX EMPTY bit if both the SCITD and SCITXSHF registers are empty.”

By using only TXRDY interrupt, it's possible the last byte is stuck in the shift register when RX is enabled on RS485, so the byte is lost in the communication.

The goal is to ensure the last byte is always sent and then RS485 is switch from TX-enable to RX-enable.

The user needs to use interrupt-based codes rather than polling-based codes and wants the transmission to be continuous without delay.

That is, the user does not want to do it in TXRDY interrupt with codes like below, which may cause a considerable delay.

while(LinaRegs.SCIFLR.bit.TXEMPTY == 0);

while(LinaRegs.SCIFLR.bit.TXRDY == 0);

Therefore, do you have any suggestion for us to deal with it?

Wayne Huang