49.7.7.5 TXEMPTY, TDRE and RDRF Behavior

SPI_SR.TXEMPTY, SPI_SR.TDRE and SPI_SR.RDRF flags display a specific behavior when FIFOs are enabled.

The TXEMPTY flag is cleared as long as there are characters in the Transmit FIFO or in the internal shift register. TXEMPTY is set when there are no characters in the Transmit FIFO and in the internal shift register.

TDRE indicates if a data can be written in the Transmit FIFO. Thus the TDRE flag is set as long as the Transmit FIFO can accept new data. Refer to figure TDRE in Single Data Mode and TXRDYM=0.

RDRF indicates if an unread data is present in the Receive FIFO. Thus the RDRF flag is set as soon as one unread data is in the Receive FIFO. Refer to figure RDRF in Single Data Mode and RXRDYM=0.

TDRE and RDRF behavior can be modified using the TXRDYM and RXRDYM fields in the SPI FIFO Mode Register (SPI_FMR) to reduce the number of accesses to SPI_TDR/RDR. However, for some configurations, the following constraints apply:

  • When the Variable Peripheral Select mode is used (SPI_MR.PS=1), SPI_FMR.TXRDYM/RXRDYM must be cleared.
  • In Host mode (SPI_MR.MSTR=1), SPI_FMR.RXRDYM must be cleared.

As an example, in Host mode, the Transmit FIFO can be loaded with multiple data in the same access by configuring TXRDYM>0.

See section SPI FIFO Mode Register for the FIFO configuration.

Figure 49-19. TDRE in Single Data Mode and TXRDYM=0
Figure 49-20. RDRF in Single Data Mode and RXRDYM=0