Transcription

KeyStone ArchitectureSerial Peripheral Interface (SPI)User GuideLiterature Number: SPRUGP2AMarch 2012

www.ti.comRelease HistoryReleaseDateDescription/CommentsAMarch 2010Updated SCSFUN field description in SPIPC0 register from two pins to multiple pins (Page 3-9)Updated description as CSHOLD bit is 0 in Chip Select Hold Option section (Page 2-6)Updated the description of CSDEF field in SPIDEF register (Page 3-16)Updated the description of CSHOLD field in SPIDAT1 register (Page 3-11)Updated the description of CSNR field in SPIDAT1 register (Page 3-11)Updated the slave chip select pins number from 2 to n, which is device specific (Page 1-2)Modified the description of CSNR field in the SPIDAT1 register. (Page 3-11)SPRUGP2November 2010Initial Releaseø-iiKeyStone Architecture Serial Peripheral Interface (SPI) User GuideSPRUGP2A—March 2012Submit Documentation Feedback

Contentswww.ti.comContentsRelease History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ø-iiList of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ø-vList of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ø-viPrefaceø-viiAbout This Manual. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ø-viiNotational Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ø-viiRelated Documentation from Texas Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ø-viiiTrademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ø-viiiChapter 1Introduction1.11.21.31.41.51-1Purpose of the Peripheral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2Terminology Used in This Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2Functional Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3Industry Standard(s) Compliance Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3Chapter 2Peripheral Architecture2.12.22.32.42.52-1Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2Operation Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2Programmable Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3Master Mode Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-42.5.1 Master Mode Timing Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52.5.1.1 Chip Select Setup Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52.5.1.2 Chip Select Hold Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52.5.1.3 Automatic Delay Between Transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-62.5.1.4 Chip Select Hold Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-62.6 SPI Operation: 3-Pin Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-72.7 SPI Operation: 4-Pin with Chip Select Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-82.8 Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-92.8.12.8.22.8.32.8.4Character Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9Shift Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-10Clock Phase and Polarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-10SPI Data Transfer Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-122.9 Interrupt Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-132.10 DMA Events Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-132.11 Robustness Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-142.11.1 SPI Internal Loopback Test Mode (Master Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-142.11.2 SPI Transmission Continuous Self-Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-142.12 Reset Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-142.12.1 Software Reset Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-142.12.2 Hardware Reset Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-142.13 Power Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-152.14 Emulation Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-152.15 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-16SPRUGP2A—March 2012Submit Documentation FeedbackKeyStone Architecture Serial Peripheral Interface (SPI) User Guideø-iii

Contentswww.ti.comChapter 3Registers3-13.1 SPI Global Control Register 0 (SPIGCR0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-33.2 SPI Global Control Register 1 (SPIGCR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-43.3 SPI Interrupt Register (SPIINT0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-53.4 SPI Interrupt Level Register (SPILVL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-63.5 SPI Flag Register (SPIFLG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-73.6 SPI Pin Control Register 0 (SPIPC0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-93.7 SPI Transmit Data Register 0 (SPIDAT0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-103.8 SPI Transmit Data Register 1 (SPIDAT1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-113.9 SPI Receive Buffer Register (SPIBUF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-123.10 SPI Emulation Register (SPIEMU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-133.11 SPI Delay Register (SPIDELAY) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-143.12 SPI Default Chip Select Register (SPIDEF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-163.13 SPI Data Format Registers (SPIFMTn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-173.14 SPI Interrupt Vector Register 0 (INTVEC0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-183.15 SPI Interrupt Vector Register 1 (INTVEC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-19Appendix ATiming DiagramsA-1A.1 SPI 3-Pin Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .A-1A.2 SPI 4-Pin with Chip Select Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .A-2ø-ivKeyStone Architecture Serial Peripheral Interface (SPI) User GuideSPRUGP2A—March 2012Submit Documentation Feedback

List of Tableswww.ti.comList of TablesTable 1-1Table 2-1Table 2-2Table 2-3Table 2-4Table 2-5Table 3-1Table 3-2Table 3-3Table 3-4Table 3-5Table 3-6Table 3-7Table 3-8Table 3-9Table 3-10Table 3-11Table 3-12Table 3-13Table 3-14Table 3-15Table 3-16Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2SPI Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2SPI Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3SPI Register Settings Defining Master Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4Allowed SPI Register Settings in Master Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4Clocking Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10SPI Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2SPI Global Control Register 0 (SPIGCR0) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3SPI Global Control Register 1 (SPIGCR1) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4SPI Interrupt Register (SPIINT0) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5SPI Interrupt Level Register (SPILVL) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6SPI Flag Register (SPIFLG) Field Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7SPI Pin Control Register 0 (SPIPC0) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9SPI Data Register 0 (SPIDAT0) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10SPI Data Register 1 (SPIDAT1) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11SPI Buffer Register (SPIBUF) Field Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12SPI Emulation Register (SPIEMU) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13SPI Delay Register (SPIDELAY) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14SPI Default Chip Select Register (SPIDEF) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16SPI Data Format Register (SPIFMTn) Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17SPI Interrupt Vector Register 0 (INTVEC0) Field Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18SPI Interrupt Vector Register 1 (INTVEC1) Field Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19SPRUGP2A—March 2012Submit Documentation FeedbackKeyStone Architecture Serial Peripheral Interface (SPI) User Guideø-v

List of Figureswww.ti.comList of FiguresFigure 1-1Figure 2-1Figure 2-2Figure 2-3Figure 2-4Figure 2-5Figure 2-6Figure 2-7Figure 2-8Figure 2-9Figure 3-1Figure 3-2Figure 3-3Figure 3-4Figure 3-5Figure 3-6Figure 3-7Figure 3-8Figure 3-9Figure 3-10Figure 3-11Figure 3-12Figure 3-13Figure 3-14Figure 3-15Figure 3-16Figure 3-17Figure A-1Figure A-2ø-viSPI Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3SPI 3-Pin Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7SPI 4-Pin Option with SPISCS[n] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8Format for Transmitting 12-Bit Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9Format for 10-Bit Received Word. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9Clock Mode with POLARITY 0 and PHASE 0 (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10Clock Mode with POLARITY 0 and PHASE 1 (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11Clock Mode with POLARITY 1 and PHASE 0 (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11Clock Mode with POLARITY 1 and PHASE 1 (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11SPI Data Transfer, Five Bits per Character (4-Pin with Chip Select Option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12SPI Global Control Register 0 (SPIGCR0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3SPI Global Control Register 1 (SPIGCR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4SPI Interrupt Register (SPIINT0). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5SPI Interrupt Level Register (SPILVL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6SPI Flag Register (SPIFLG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7SPI Pin Control Register 0 (SPIPC0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9SPI Data Register 0 (SPIDAT0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10SPI Data Register 1 (SPIDAT1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11SPI Buffer Register (SPIBUF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12SPI Emulation Register (SPIEMU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13SPI Delay Register (SPIDELAY). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14Example: tC2TDELAY 8 SPI Module Clock Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14Example: tT2CDELAY 4 SPI Module Clock Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15SPI Default Chip Select Register (SPIDEF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16SPI Data Format Register (SPIFMTn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17SPI Interrupt Vector Register 0 (INTVEC0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18SPI Interrupt Vector Register 1 (INTVEC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19SPI 3-Pin Master Mode with WDELAY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1SPI 4-Pin with SPISCS[n] Mode with T2CDELAY, WDELAY, and C2TDELAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2KeyStone Architecture Serial Peripheral Interface (SPI) User GuideSPRUGP2A—March 2012Submit Documentation Feedback

PrefaceAbout This ManualThis document describes the features, architecture and registers associated with theserial peripheral interface (SPI) module.Notational ConventionsThis document uses the following conventions: Commands and keywords are in boldface font. Arguments for which you supply values are in italic font. Terminal sessions and information the system displays are in screen font. Information you must enter is in boldface screen font. Elements in square brackets ([ ]) are optional.Notes use the following conventions:Note—Means reader take note. Notes contain helpful suggestions or referencesto material not covered in the publication.The information in a caution or a warning is provided for your protection. Please readeach caution and warning carefully.CAUTION—Indicates the possibility of service interruption if precautions arenot taken.WARNING—Indicates the possibility of damage to equipment if precautions arenot taken.SPRUGP2A—March 2012Submit Documentation FeedbackKeyStone Architecture Serial Peripheral Interface (SPI) User Guideø-vii

Prefacewww.ti.comRelated Documentation from Texas InstrumentsC66x CorePac User GuideSPRUGW0C66x CPU and Instruction Set Reference GuideSPRUGH7Enhanced Direct Memory Access 3 (EDMA3) for KeyStone Devices User GuideSPRUGS5TrademarksTMS320C66x and C66x, VLYNQ, Packet Accelerator, are trademarks of Texas Instruments Incorporated.All other brand names and trademarks mentioned in this document are the property of Texas InstrumentsIncorporated or their respective owners, as applicable.ø-viiiKeyStone Architecture Serial Peripheral Interface (SPI) User GuideSPRUGP2A—March 2012Submit Documentation Feedback

Chapter 1IntroductionThis document describes the serial peripheral interface (SPI) module.1.11.31.41.5SPRUGP2A—March 2012Submit Documentation Feedback"Purpose of the Peripheral" on page 1-2"Features" on page 1-2"Functional Block Diagram" on page 1-3"Industry Standard(s) Compliance Statement " on page 1-3KeyStone Architecture Serial Peripheral Interface (SPI) User Guide1-1

1.1 Purpose of the PeripheralChapter 1—Introductionwww.ti.com1.1 Purpose of the PeripheralThe SPI is a high-speed synchronous serial input/output port that allows a serial bitstream of programmed length (2 to 16 bits) to be shifted into and out of the device at aprogrammed bit-transfer rate. The SPI is normally used for communication betweenthe device and external peripherals. Typical applications include interface to externalI/O or peripheral expansion via devices such as shift registers, display drivers, SPIEPROMS, and analog-to-digital converters.1.2 Terminology Used in This DocumentTable 1-1 defines the important acronyms used in this document.Table 1-1TerminologyAcronymDefinitionDMADirect Memory AccessLSBLeast significant bitMSBMost significant bitSPISerial peripheral interfaceEnd of Table 1-11.3 FeaturesThe SPI has the following features: 16-bit shift register 16-bit Receive buffer register (SPIBUF) and 16-bit Receive buffer emulation aliasregister (SPIEMU) 16-bit Transmit data register (SPIDAT0) and 16-bit Transmit data and formatselection register (SPIDAT1) 8-bit baud clock generator Serial clock (SPICLK) I/O pin Slave in, master out (SPISIMO) I/O pin Slave out, master in (SPISOMI) I/O pin Multiple slave chip select (SPISCS[n]) I/O pins (4 pin mode only) Programmable SPI clock frequency range Programmable character length (2 to 16 bits) Programmable clock phase (delay or no delay) Programmable clock polarity (high or low) Interrupt capability DMA support (read/write synchronization events) Up to 66 MHz operationNote—Please see the device-specific data manual for the number of slave chipselect pins (SPISCS[n]) supported.1-2KeyStone Architecture Serial Peripheral Interface (SPI) User GuideSPRUGP2A—March 2012Submit Documentation Feedback

1.4 Functional Block DiagramChapter 1—Introductionwww.ti.comThe SPI allows software to program the following options: SPICLK frequency (SPI module clock/2 through SPI module clock/256) 3-pin and 4-pin options Character length (2 to 16 bits) and shift direction (MSB/LSB first) Clock phase (delay or no delay) and polarity (high or low) Delay between transmissions in master mode. Chip select setup and hold times in master mode Chip select hold in master modeThe SPI does not support the following features: Multibuffer mode Parallel mode or parity SPIENA pin SPI slave mode GPIO mode1.4 Functional Block DiagramFigure 1-1 shows the SPI block diagram.Figure 1-1SPI Block DiagramSPISIMOSPISOMIMUXTX Shift RegTXBUFSPIDAT1CPU/DMA WriteRX Shift RegRXBUFSPIBUFCPU/DMA Read(See Note B)MUXSPI Module ClockSPISCS[n]Modeand tyPhase(A)(A)SPINT1 (Interrupt)SPIREVT (EDMA Event)(A)CLKMODSPINT0 (Interrupt)SPIXEVT (EDMA Event)(A)(A) Indicates the log controlled by SPI register bits.(B) Solid line represents data flow for SPI master mode.1.5 Industry Standard(s) Compliance StatementThe programmable configuration capability of the SPI allows it to gluelessly interfaceto a variety of SPI format devices. The SPI does not conform to a specific industrystandard.SPRUGP2A—March 2012Submit Documentation FeedbackKeyStone Architecture Serial Peripheral Interface (SPI) User Guide1-3

1.5 Industry Standard(s) Compliance StatementChapter 1—Introduction1-4KeyStone Architecture Serial Peripheral Interface (SPI) User Guidewww.ti.comSPRUGP2A—March 2012Submit Documentation Feedback

Chapter 2Peripheral ArchitectureThis chapter describes the SPI operation modes. It gives an overview of SPI operationand then provides details on the 3-pin and 4-pin options, as well as more specific detailson the supported data 32.142.15SPRUGP2A—March 2012Submit Documentation Feedback"Clock" on page 2-2"Signal Descriptions" on page 2-2"Operation Modes" on page 2-2"Programmable Registers" on page 2-3"Master Mode Settings" on page 2-4"SPI Operation: 3-Pin Mode" on page 2-7"SPI Operation: 4-Pin with Chip Select Mode" on page 2-8"Data Formats" on page 2-9"Interrupt Support" on page 2-13"DMA Events Support" on page 2-13"Robustness Features " on page 2-14"Reset Considerations " on page 2-14"Power Management " on page 2-15"Emulation Considerations " on page 2-15"Initialization" on page 2-16KeyStone Architecture Serial Peripheral Interface (SPI) User Guide2-1

2.1 ClockChapter 2—Peripheral Architecturewww.ti.com2.1 ClockThe SPI clock (SPICLK) is derived from the SPI module clock. The maximum clock bitrate supported is SPI module clock/2, as determined by the PRESCALE field in the SPIdata format register n (SPIFMTn). The SPICLK frequency is calculated as:SPICLK frequency [SPI module clock] / [SPIFMTn.PRESCALE 1]When SPIFMTn.PRESCALE is cleared to 0, the SPICLK frequency defaults to SPImodule clock/2.2.2 Signal DescriptionsTable 2-1 shows the SPI pins used to interface to external devices.Table 2-1SPI PinsPinTypeFunctionSPISIMOOutputSerial data output in master modeSPISOMIInputSerial data input in master modeSPICLKOutputSerial clock output in master modeOutputSlave chip select output in master modeSPISCS[n]1End of Table 2-11. The value n indicates the SPI pins available; that is, SPISCS[0], SPISCS[1], etc. See the device-specific data manual to determinehow many SPI pins are available.2.3 Operation ModesThe SPI operates in master mode. The SPI bus master is the device that drives theSPICLK, SPISIMO, and optionally the SPISCS[n] signals, and therefore initiates SPIbus transfers. The CLKMOD and MASTER bits in the SPI global control register 1(SPIGCR1) selects master mode. In the master mode, the SPI supports two options: 3-pin option 4-pin with chip select optionThe 3-pin option is the basic clock, data in, and data out SPI interface and uses theSPICLK, SPISIMO, and SPISOMI pins. The 4-pin with chip select option adds theSPISCS[n] pin that is used to support multiple SPI slave devices on a single SPI bus.2-2KeyStone Architecture Serial Peripheral Interface (SPI) User GuideSPRUGP2A—March 2012Submit Documentation Feedback

2.4 Programmable RegistersChapter 2—Peripheral Architecturewww.ti.com2.4 Programmable RegistersA general representation of the SPI programmable registers is shown in Table 2-2. Fordetail

A March 2010 Updated SCSFUN field description in SPIPC0 register from two pins to multiple pins (Page 3-9) Updated description as CSHOLD bit is 0 in Chip Select Hold Option section (Page 2-6) Updated the description of CSDEF field in SPIDEF register (Page 3-16) Updated the description of CSHOLD field in SPIDAT1 register (Page 3-11)