25.1.2.1 SPI Host Mode
The Host can initiate the data transfer at any time because it controls the SCK line. The Host determines when the client (Processor 2, Figure 25-3) is to broadcast data by the software protocol.
In Host mode, the data is transmitted/received as soon as the SSPxBUF register is written to. If the SPI is only going to receive, the SDO output may be disabled (programmed as an input). The SSPSR register will continue to shift in the signal present on the SDI pin at the programmed clock rate. As each byte is received, it will be loaded into the SSPxBUF register (interrupts and Status bits appropriately set).
The SPI Data Input Sample (SMP) bit determines when the SDI input is sampled. When SMP is set, input data is sampled at the end of the data output time. When SMP is clear, input data is sampled at the middle of the data output time.
The SPI clock rate (bit rate) is user-programmable to be one of the following:
- FOSC/4 (or TCY)
- FOSC/16 (or 4 * TCY)
- FOSC/64 (or 16 * TCY)
- Timer2 output/2
- FOSC/(4 * (SSPxADD + 1))