AnsweredAssumed Answered

End of byte transfer in slave-bidirectional half-duplex mode

Question asked by youssefi.shahbaz on Nov 21, 2013
Latest reply on Dec 9, 2013 by youssefi.shahbaz
Hi,

I have an STM8S003F3 that is configured as a slave in a bidirectional half-duplex mode.

During the time it receives bytes, I can wait on the RXNE flag to know the byte has been completely received. However, I want to know the same time for when it is transmitting. TXE doesn't help.

Let me demonstrate. When there is a transfer, imagine this is the clock.

(TXE)-_-_-_-_-_-_-_-_(RXNE)

TXE at the beginning of the clocking of the byte becomes true because the TX buffer gets copied to the shift register. This happens of course only in transmit mode. But this shows the _beginning_ of the transmission.

RXNE at the end of the clocking of the byte becomes true because the RX buffer gets copied to from the shift register. This happens only in receive mode.

I want to be able to poll the same moment polling RXNE would, but in transmit mode.

I have tried (and it seems to be ok) to use the BSY flag. However, the datasheet itself says:

Note: Do not use the BSY flag to handle each data transmission or reception. It is better to use TXE and RXNE flags instead.

If I can't use the BSY flag, what can I use then (Since RXNE doesn't get set in transmit mode)?

Outcomes