I have discovered a problem when using the SPI peripheral in slave mode on an Atmel SAM4S. Occasionally words can become bit-shifted. I can force this condition by enabling the peripheral some number of clocks after
NSS goes active. I do this by waiting for NSSR, then using a delay loop to wait a specific time before I enable the peripheral. I have confirmed on a scope that when the peripheral is enabled
n clocks after
NSS goes active, the words are shifted by
When the peripheral gets in this state, the only way to recover is to perform a reset (i.e. set the
SWRST in the control register). Disabling and re-enabling is not sufficient.
This issue has also been observed on a SAM9G45 MPU.