Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

© 2007 Microchip Technology Inc. Advance Information DS39699B-page 23-2
Section 23. Serial Peripheral Interface (SPI)
Serial Peripheral
Interface (SPI)
23
23.1 INTRODUCTION
The Serial Peripheral Interface (SPI) module is a synchronous serial interface useful for commu-
nicating with other peripheral or microcontroller devices. These peripheral devices may be serial
EEPROMs, shift registers, display drivers, A/D converters, etc. The SPI module is compatible
with Motorola’s SPI and SIOP interfaces.
Depending on the variant, the PIC24 family offers one or two SPI modules on a single device.
The modules, designated SPI1 and SPI2, are functionally identical. The SPI2 module is available
in many of the higher pin count packages, while the SPI1 module is available on all devices.
The SPIx serial interface consists of four pins:
SDIx: Serial Data Input
SDOx: Serial Data Output
SCKx: Shift Clock Input or Output
SSx
/FSYNCx: Active-Low Slave Select or Frame Synchronization I/O Pulse
The SPIx module can be configured to operate using 2, 3 or 4 pins. In the 3-pin mode, SSx
is not
used. In the 2-pin mode, both SDOx and SSx
are not used.
A block diagram of the module is shown in Figure 23-1.
Figure 23-1: SPIx Module Block Diagram (Standard Mode)
Note: In this section, the SPI modules are referred to together as SPIx, or separately as
SPI1 and SPI2. Special Function Registers will follow a similar notation. For
example, SPIxCON refers to the control register for the SPI1 or SPI2 module.
Internal Data Bus
SDIx
SDOx
SSx
/FSYNCx
SCKx
SPIxSR
bit 0
Shift
Control
Edge
Select
F
CY
Primary
1:1/4/16/64
Enable
Prescaler
Sync
Clock
Control
SPIxBUF
Control
Transfer
Transfer
Write SPIxBUF
Read SPIxBUF
16
SPIxCON1<1:0>
SPIxCON1<4:2>
Master Clock
Secondary
Prescaler
1:1 to 1:8

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh