657
SAM4CP [DATASHEET]
43051E–ATPL–08/14
33.7.3.9 Peripheral Deselection with PDC
PDC provides faster reloads of the SPI_TDR compared to software. However, depending on the system activity, it is not
guaranteed that the SPI_TDR is written with the next data before the end of the current transfer. Consequently, data can
be lost by the de-assertion of the NPCS line for SPI slave peripherals requiring the chip select line to remain active
between two transfers. The only way to guarantee a safe transfer in this case is the use of the CSAAT and LASTXFER
bits.
When the CSAAT bit is configured to 0, the NPCS does not rise in all cases between two transfers on the same
peripheral. During a transfer on a Chip Select, the TDRE flag rises as soon as the content of the SPI_TDR is transferred
into the internal shift register. When this flag is detected, the SPI_TDR can be reloaded. If this reload occurs before the
end of the current transfer and if the next transfer is performed on the same chip select as the current transfer, the Chip
Select is not de-asserted between the two transfers. This can lead to difficulties to interface with some serial peripherals
requiring the chip select to be de-asserted after each transfer. To facilitate interfacing with such devices, the SPI_CSR
can be programmed with the Chip Select Not Active After Transfer (CSNAAT) bit to 1. This allows the chip select lines to
be de-asserted systematically during a time “DLYBCS” (the value of the CSNAAT bit is processed only if the CSAAT bit
is configured to 0 for the same chip select).
Figure 33-11
shows different peripheral deselection cases and the effect of the CSAAT and CSNAAT bits.
Figure 33-11. Peripheral Deselection
A
NPCS[0..3]
Write SPI_TDR
TDRE
NPCS[0..3]
Write SPI_TDR
TDRE
NPCS[0..3]
Write SPI_TDR
TDRE
DLYBCS
PCS = A
DLYBCS
DLYBCT
A
PCS = B
B
DLYBCS
PCS = A
DLYBCS
DLYBCT
A
PCS = B
B
DLYBCS
DLYBCT
PCS=A
A
DLYBCS
DLYBCT
A
PCS = A
A
A
DLYBCT
A
A
CSAAT = 0 and CSNAAT = 0
DLYBCT
A
A
CSAAT = 1 and CSNAAT= 0 / 1
A
DLYBCS
PCS = A
DLYBCT
A
A
CSAAT = 0 and CSNAAT = 1
NPCS[0..3]
Write SPI_TDR
TDRE
PCS = A
DLYBCT
A
A
CSAAT = 0 and CSNAAT = 0