Programming Model
10-28
ADSP-BF537 Blackfin Processor Hardware Reference
Programming Model
The following sections describe the SPI programming model.
Beginning and Ending an SPI Transfer
The start and finish of an SPI transfer depend on whether the device is
configured as a master or a slave, whether the
CPHA
mode is selected, and
whether the transfer initiation mode (
TIMOD
) is selected. For a master SPI
with
CPHA
= 0
, a transfer starts when either
SPI_TDBR
is written to or
SPI_RDBR
is read, depending on
TIMOD
. At the start of the transfer, the
enabled slave select outputs are driven active (low). However, the
SCK
sig-
nal remains inactive for the first half of the first cycle of
SCK
. For a slave
with
CPHA
= 0
, the transfer starts as soon as the
SPISS
input goes low.
For
CPHA
= 1
, a transfer starts with the first active edge of
SCK
for both
slave and master devices. For a master device, a transfer is considered fin-
ished after it sends the last data and simultaneously receives the last data
bit. A transfer for a slave device ends after the last sampling edge of
SCK
.
The
RXS
bit defines when the receive buffer can be read. The
TXS
bit
defines when the transmit buffer can be filled. The end of a single word
transfer occurs when the
RXS
bit is set, indicating that a new word has just
been received and latched into the receive buffer,
SPI_RDBR
. For a master
SPI,
RXS
is set shortly after the last sampling edge of
SCK
. For a slave SPI,
RXS
is set shortly after the last
SCK
edge, regardless of
CPHA
or
CPOL
. The
latency is typically a few
SCLK
cycles and is independent of
TIMOD
and the
baud rate. If configured to generate an interrupt when
SPI_RDBR
is full
(
TIMOD = 00
), the interrupt goes active one
SCLK
cycle after
RXS
is set.
When not relying on this interrupt, the end of a transfer can be detected
by polling the
RXS
bit.
To maintain software compatibility with other SPI devices, the
SPIF
bit is
also available for polling. This bit may have a slightly different behavior
from that of other commercially available devices. For a slave device,
SPIF
Summary of Contents for Blackfin ADSP-BF537
Page 42: ...Contents xlii ADSP BF537 Blackfin Processor Hardware Reference ...
Page 90: ...Development Tools 1 32 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 138: ...Programming Examples 4 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 340: ...SDC Programming Examples 6 84 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 606: ...Programming Examples 9 94 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 660: ...Programming Examples 10 54 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 720: ...Electrical Specifications 11 60 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 840: ...Programming Examples 13 42 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 876: ...Programming Examples 14 36 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 938: ...Programming Examples 15 62 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 958: ...Programming Examples 17 12 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 986: ...Programming Examples 18 28 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1162: ...G 26 ADSP BF537 Blackfin Processor Hardware Reference ...
Page 1218: ...Index I 56 ADSP BF537 Blackfin Processor Hardware Reference ...