1.5.2 MSSP SPI Client Mode

When operating in SPI Client mode, if the incoming SCK clock signal arrives during any of the conditions below, the SSPBUF Transmit Shift Register (TSR) may become corrupted. The byte transmitted to the client cannot be ensured to be correct, and the state of the WCOL bit may or may not indicate a write collision.

These conditions include:
  • A write to an SFR
  • A write to RAM following an SFR read
  • A write to RAM before an SFR read

Work around

Method 1 (Interrupt based using SS):
  1. Connect the SS line to both the SS input and either an INT or IOC input pin.
  2. Enable INT or IOC interrupts (interrupt on falling edge if available, otherwise, check that SS == 0 when the interrupt occurs).
  3. Load SSPBUF with the data to be transmitted.
  4. Continue program execution.
  5. When invoking the Interrupt Service Routine (ISR), do either of the following:
    1. Add a delay that ensures the first SCK clock will be complete, or
    2. Poll SSPSTAT.BF (while(BF == 0)) and wait for the transmission/reception to complete.
Method 2 (Bit polling based using SS):
  1. Load SSPBUF with the data to be transmitted.
  2. Poll the SS line and wait for the SS to go active (while(!PORTx.SS == 0)).
  3. When SS is active (SS == 0), do either of the following:
    1. Add a delay that ensures the first SCK clock will be complete, or
    2. Poll SSPSTAT.BF (while(BF == 0)) and wait for the transmission/reception to complete.

Once one of these two methods is complete, it is safe to return to program execution.

Method 3 (SS not available):
  1. Load SSPBUF with the data to be transmitted.
  2. Poll SSPSTAT.BF (while(BF == 0)) and wait for the transmission/reception to complete.

Affected Silicon Revisions

A3A4
XX