Operation of the SPI module is controlled by the following registers:
- SPIxCON0: Used to enable/disable
the SPI module, select LSb or MSb first data exchange, specify whether the
device is a master or slave, and contains the bit length mode select bit
(BMODE)
- SPIxCON1: Used to configure the
polarity of the SS, SDI, SDO, SDK lines, enable fast
start, select leading clock edge on CKE, and set the sample phase control
bit.
- SPIxCON2: Used to configure slave select settings, and contains the TXR and RXR
control bits.
- SPIxTWIDTH: SPI Transfer Width
Register
- SPIxBAUD: SPI Baud Rate Generator
Control Register
- SPIxINTE: Interrupt Enable Register
- SPIxINTF: Interrupt Flag Register
- SPIxTCTH/L: SPI Transfer Counter
Register Pair
- SPIxSTATUS: FIFO Status Register
- SPIxRxB: Receive Buffer Register
- SPIxTxB: Transmit Buffer Register
- SPIxCLK: Clock Source Selection
Register
Table 2-1. Registers Associated with
SPIName | Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 |
---|
SPIxINTF | SRMTIF | TCZIF | SOSIF | EOSIF | - | RXOIF | TXUIF | - |
SPIxINTE | SRMTIE | TCZIE | SOSIE | EOSIE | - | RXOIE | TXUIE | - |
SPIxTCNTH | - | - | - | - | - | TCNT10 | TCNT9 | TCNT8 |
SPIxTCNTL | TCNT7 | TCNT6 | TCNT5 | TCNT4 | TCNT3 | TCNT2 | TCNT1 | TCNT0 |
SPIxTWIDTH | - | - | - | - | - | TWIDTH2 | TWIDTH1 | TWIDTH0 |
SPIxBAUD | BAUD7 | BAUD6 | BAUD5 | BAUD4 | BAUD3 | BAUD2 | BAUD1 | BAUD0 |
SPIxCON0 | EN | - | - | - | - | LSBF | MST | BMODE |
SPIxCON1 | SMP | CKE | CKP | FST | - | SSO | SDIP | SDOP |
SPIxCON2 | BUSY | SSFLT | - | - | - | SSET | TXR | RXR |
SPIxSTATUS | TXWE | - | TXBE | - | RXRE | CLRBF | - | RXBF |
SPIxRXB | RXB7 | RXB6 | RXB5 | RXB4 | RXB3 | RXB2 | RXB1 | RXB0 |
SPIxTXB | TXB7 | TXB6 | TXB5 | TXB4 | TXB3 | TXB2 | TXB1 | TXB0 |
SPIxCLK | - | - | - | - | CLK3 | CLK2 | CLK1 | CLK0 |
Table 2-2. Registers Associated with IO ControlName | Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 |
---|
SPIxSCKPPS | - | - | - | SPIxSCKPPS4 | SPIxSCKPPS3 | SPIxSCKPPS2 | SPIxSCKPPS1 | SPIxSCKPPS0 |
SPIxSSPPS | - | - | - | SPIxSSPPS4 | SPIxSSPPS3 | SPIxSSPPS2 | SPIxSSPPS1 | SPIxSSPPS0 |
SPIxSDIPPS | - | - | - | SPIxSDIPPS4 | SPIxSDIPPS3 | SPIxSDIPPS2 | SPIxSDIPPS1 | SPIxSDIPPS0 |