Basic Operation
1511
SPNU563A – March 2018
Copyright © 2018, Texas Instruments Incorporated
Multi-Buffered Serial Peripheral Interface Module (MibSPI) with Parallel Pin
Option (MibSPIP)
28.2.6 Advanced Module Configuration Options
28.2.6.1 Data Formats
To support multiple different types of slaves in one SPI network, four independent data word formats are
implemented that allow configuration of individual data word length, polarity, phase, and bit rate. Each
word transmitted can select which data format to use via the bits DFSEL[1:0] in its control field from one of
the four data word formats. Same data format can be supported on multiple chip selects.
Data formats 0, 1, 2, and 3 can be configured through SPIFMTx control registers.
Each SPI data format includes the standard SPI data format with enhanced features:
•
Individually-configurable shift direction can be used to select MSB first or LSB first, whereas the
position of the MSB depends on the configured data word length.
•
Receive data is automatically right-aligned, independent of shift direction and data word length.
Transmit data has to be written right-aligned into the SPI and the internal shift register will transmit
according to the selected shift direction and data word length for correct transfer.
•
To increase fault detection of data transmission and reception, an odd or even parity bit can be added
at the end of a data word. The parity generator can be enabled or disabled individually for each data
format. If a received parity bit does not match with the locally calculated parity bit, the parity error flag
(PARITYERR) is set and an interrupt is asserted (if enabled).
Since the master-mode SPI can drive two consecutive accesses to the same slave, an 8-bit delay counter
is available to satisfy the delay time for data to be refreshed in the accessed slave. The delay counter can
be programmed as part of the data format.
CHARLEN[4:0] specifies the number of bits (2 to 16) in the data word. The CHARLEN[4:0] value directs
the state control logic to count the number of bits received or transmitted to determine when a complete
word is transferred.
Data word length
must
be programmed to the same length for both the
master
and the
slave
. However,
when chip selects are used, there may be multiple targets with different lengths in the system.
NOTE:
Data must be right-justified when it is written to the SPI for transmission irrespective of its
character length or word length.
shows how a 12-bit word (0xEC9) needs to be written to the transmit buffer to be transmitted
correctly.
Figure 28-10. Format for Transmitting an 12-Bit Word
D15
D14
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
x
x
x
x
1
1
1
0
1
1
0
0
1
0
0
1
NOTE:
The received data is always stored right-justified regardless of the character length or
direction of shifting and is padded with leading 0s when the character length is less than 16
bits.
shows how a 10-bit word (0x0A2) is stored in the buffer once it is received.
Figure 28-11. Format for Receiving an 10-Bit Word
D15
D14
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0