enCoRe™ V CY7C643xx, enCoRe™ V LV CY7C604xx TRM, Document No. 001-32519 Rev *H
132
SPI
Figure 18-6. Typical SPIM Timing in Mode 2 and 3
Status Generation and Interrupts.
There are four status
bits in an SPI block: TX Reg Empty, RX Reg Full, SPI Com-
plete, and Overrun.
TX Reg Empty indicates that a new byte can be written to
the TX Buffer register. When the block is enabled, this status
bit is immediately asserted. This status bit is cleared when
the user writes a byte of data to the TX Buffer register. TX
Reg Empty is a control input to the state machine and, if a
transmission is not already in progress, the assertion of this
control signal initiates one. This is the default SPIM block
interrupt. However, an initial interrupt is not generated when
the block is enabled. The user must write a byte to the TX
Buffer register and that byte must be loaded into the shifter
before interrupts generated from the TX Reg Empty status
bit are enabled.
RX Reg Full is asserted on the edge that captures the eighth
bit of receive data. This status bit is cleared when the user
reads the RX Buffer register (DR2).
SPI Complete is an optional interrupt and is generated when
eight bits of data and clock are sent. In modes 0 and 1, this
occurs one-half cycle after RX Reg Full is set; because in
these modes, data is latched on the leading edge of the
clock and there is an additional one-half cycle remaining to
complete that clock. In modes 2 and 3, this occurs at the
same edge that the receive data is latched. This signal may
be used to read the received byte or it may be used by the
SPIM to disable the block after data transmission is com-
plete.
Overrun status is set if RX Reg Full is still asserted from a
previous byte when a new byte is about to be loaded into the
RX Buffer register. Because the RX Buffer register is imple-
mented as a latch, Overrun status is set one-half bit clock
before RX Reg Full status.
See
and
for status timing relation-
ships.
INTERNAL CLOCK/
INPUT CLOCK
TX REG EMPTY
D7
MOSI
D6
D5
D2
D1
D0
D7
User writes first
byte to the TX
Buffer register.
Shifter is loaded
with the first byte.
User writes next
byte to the TX
Buffer register.
SCLK (MODE 2)
Shifter is loaded
with the next
byte.
Last bit of received
data is valid on this
edge and is latched
into RX Buffer.
Free running,
internal bit rate
clock.
Setup time
for the TX
Buffer write.
SCLK (MODE 3)
RX REG FULL
First input bit
is latched.
First shift.