15-42
MPC561/MPC563 Reference Manual
MOTOROLA
Queued Serial Peripheral Interface
Before slave mode operation is initiated, DDRQS must be written to direct data flow on the
QSPI pins used. Configure the MOSI, SCK and PCS0/SS pins as inputs. The MISO pin
must be configured as an output.
After pins are assigned and configured, write data to be transmitted into transmit RAM.
Command RAM is not used in slave mode, and does not need to be initialized. Set the queue
pointers, as appropriate.
When SPE is set and MSTR is clear, a low state on the slave select PCS0/SS pin begins
slave mode operation at the address indicated by NEWQP. Data that is received is stored at
the pointer address in receive RAM. Data is simultaneously loaded into the data serializer
from the pointer address in transmit RAM and transmitted. Transfer is synchronized with
the externally generated SCK. The CPHA and CPOL bits determine upon which SCK edge
to latch incoming data from the MISO pin and to drive outgoing data from the MOSI pin.
Because the command RAM is not used in slave mode, the CONT, BITSE, DT, DSCK, and
peripheral chip-select bits have no effect. The PCS0/SS pin is used only as an input.
The SPBR, DT and DSCKL fields in SPCR0 and SPCR1 bits are not used in slave mode.
The QSPI drives neither the clock nor the chip-select pins and thus cannot control clock rate
or transfer delay.
Because the BITSE option is not available in slave mode, the BITS field in SPCR0 specifies
the number of bits to be transferred for all transfers in the queue. When the number of bits
designated by BITS[3:0] has been transferred, the QSPI stores the working queue pointer
value in CPTQP, increments the working queue pointer, and loads new transmit data from
transmit RAM into the data serializer. The working queue pointer address is used the next
time PCS0/SS is asserted, unless the RCPU writes to NEWQP first.
The QSPI shifts one bit for each pulse of SCK until the slave select input goes high. If SS
goes high before the number of bits specified by the BITS field is transferred, the QSPI
resumes operation at the same pointer address the next time SS is asserted. The maximum
value that the BITS field can have is 16. If more than 16 bits are transmitted before SS is
negated, pointers are incremented and operation continues.
The QSPI transmits as many bits as it receives at each queue address, until the BITS value
is reached or SS is negated. SS does not need to go high between transfers as the QSPI
transfers data until reaching the end of the queue, whether SS remains low or is toggled
between transfers.
When the QSPI reaches the end of the queue, it sets the SPIF flag. If the SPIFIE bit in
SPCR2 is set, an interrupt request is generated when SPIF is asserted. At this point, the
QSPI clears SPE and stops unless wraparound mode is enabled.
Slave wraparound mode is enabled by setting the WREN bit in SPCR2. The queue can wrap
to pointer address 0x0 or to the address pointed to by NEWQP, depending on the state of
the WRTO bit in SPCR2. Slave wraparound operation is identical to master wraparound
operation.