47.7.8.4 TXEMPTY, TDRE and RDRF Behavior

The MCSPI_SR.TXEMPTY, MCSPI_SR.TDRE and MCSPI_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. See Figure 47-23.

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. See Figure 47-24.

TDRE and RDRF behavior can be modified using the Transmit Data Register Empty Mode (TXRDYM) and Receive Data Register Empty Mode (RXRDYM) fields in the MCSPI FIFO Mode register (MCSPI_FMR) to reduce the number of accesses to MCSPI_TDR/RDR. However, for some configurations, the following constraints apply:

  • When the Variable Peripheral Select mode is used (MCSPI_MR.PS=1), MCSPI_FMR.TXRDYM/RXRDYM must be cleared.
  • In Host mode (MCSPI_MR.MSTR=1), MCSPI_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 MCSPI_FMR for the FIFO configuration.

Figure 47-23. TDRE in Single Data Mode and TXRDYM=0
Figure 47-24. RDRF in Single Data Mode and RXRDYM=0