
MOTOROLA
Chapter 15. Queued Serial Multi-Channel Module
15-37
Queued Serial Peripheral Interface
After pins are assigned and configured, write appropriate data to the command queue. If
data is to be transmitted, write the data to transmit RAM. Initialize the queue pointers as
appropriate.
QSPI operation is initiated by setting the SPE bit in SPCR1. Shortly after SPE is set, the
QSPI executes the command at the command RAM address pointed to by NEWQP. Data at
the pointer address in transmit RAM is loaded into the data serializer and transmitted. Data
that is simultaneously received is stored at the pointer address in receive RAM.
When the proper number of bits have been transferred, the QSPI stores the working queue
pointer value in CPTQP, increments the working queue pointer, and loads the next data for
transfer from transmit RAM. The command pointed to by the incremented working queue
pointer is executed next, unless a new value has been written to NEWQP. If a new queue
pointer value is written while a transfer is in progress, that transfer is completed normally.
When the CONT bit in a command RAM byte is set, PCS pins are continuously driven to
specified states during and between transfers. If the chip-select pattern changes during or
between transfers, the original pattern is driven until execution of the following transfer
begins. When CONT is cleared, the data in register PORTQS is driven between transfers.
The data in PORTQS must match the inactive states of SCK and any peripheral chip-selects
used.
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.
15.6.5.1 Clock Phase and Polarity
In master mode, data transfer is synchronized with the internally-generated serial clock
SCK. Control bits, CPHA and CPOL, in SPCR0, control clock phase and polarity.
Combinations of CPHA and CPOL determine upon which SCK edge to drive outgoing data
from the MOSI pin and to latch incoming data from the MISO pin.
15.6.5.2 Baud Rate Selection
Baud rate is selected by writing a value from two to 255 into the SPBR field in SPCR0. The
QSPI uses a modulus counter to derive the SCK baud rate from the MCU IMB3 clock.
The following expressions apply to the SCK baud rate:
or
SCK Baud Rate
f
SYS
2xSPBR
-----------------------
=
SPBR
f
SYS
2xSCK Baud Rate Desired
-----------------------------------------------------------------------
=