Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
mikrocont / MC68HC705C8A.pdf
Источник:
Скачиваний:
60
Добавлен:
06.01.2022
Размер:
2.49 Mб
Скачать

Serial Peripheral Interface (SPI)

Multiple-SPI Systems

Example:

LDA #$1C ; MSTR = 1, CPOL = 1, CPHA = 1, ; SPR1 = SPR0 = 0

STA SPCR ; SPI control register

LDA #$4C ; MSTR = 0, SPE = 1, CPOL = 1, CPHA = 1, ; SPR1 = SPR0 = 0

STA SPCR ; SPI control register

11.5 Multiple-SPI Systems

In a multiple-SPI system, all PD4/SCK pins are connected together, all PD3/MOSI pins are connected together, and all PD2/MISO pins are connected together.

Before a transmission, one SPI is configured as master and the rest are configured as slaves. Figure 11-4 is a block diagram showing a single master SPI and three slave SPIs.

MASTER MCU

 

 

 

 

 

 

 

 

 

 

 

 

PD2/MISO

 

 

 

 

 

 

 

 

 

 

 

 

PD3/MOSI

 

 

 

 

 

 

 

 

 

 

 

 

PD4/SCK

 

 

 

 

 

 

 

 

 

 

 

 

PD5/SS

VDD

 

 

 

 

 

 

 

 

 

 

 

 

2

 

 

 

 

 

 

 

 

 

 

 

 

I/O

1

 

 

 

 

 

 

 

 

 

 

 

 

PORT

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PD5/SS

PD4/SCK

PD3/MOSI

PD2/MISO

PD5/SS

PD4/SCK

PD3/MOSI

PD2/MISO

PD5/SS

PD4/SCK

PD3/MOSI

PD2/MISO

 

 

SLAVE MCU 2

SLAVE MCU 1

SLAVE MCU 0

Figure 11-4. One Master and Three Slaves Block Diagram

Figure 11-5 is another block diagram with two master/slave SPIs and three slave SPIs.

MC68HC705C8A —

Rev. 3

Technical Data

 

 

 

MOTOROLA

Serial Peripheral Interface (SPI)

145

Serial Peripheral Interface (SPI)

MASTER/SLAVE

MASTER/SLAVE

MCU 1

 

 

MCU 2

PD2/MISO

PD2/MISO

PD3/MOSI

PD3/MOSI

PD4/SCK

PD4/SCK

PD5/SS

PD5/SS

 

0

0

 

I/O

1

1

I/O

PORT

2

2

PORT

 

 

 

3

3

 

 

 

PD5/SS

PD4/SCK

PD3/MOSI

PD2/MISO

 

 

PD5/SS

PD4/SCK

PD3/MOSI

PD2/MISO

 

 

 

PD5/SS

PD4/SCK

PD3/MOSI

PD2/MISO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SLAVE MCU 2

 

 

SLAVE MCU 1

 

 

 

SLAVE MCU 0

Figure 11-5. Two Master/Slaves and Three Slaves Block Diagram

11.6 Serial Clock Polarity and Phase

To accommodate the different serial communication requirements of peripheral devices, software can change the phase and polarity of the SPI serial clock. The clock polarity bit (CPOL) and the clock phase bit

(CPHA), both in the SPCR, control the timing relationship between the serial clock and the transmitted data. Figure 11-6 shows how the CPOL and CPHA bits affect the clock/data timing.

CPHA

CPOL

SS

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

SCK (A)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

0

SCK (B)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

SCK (C)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

1

SCK (D)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SDO/SDI

 

 

 

 

MSB

 

 

BIT 6

 

 

BIT 5

 

 

 

BIT 4

 

 

BIT 3

 

 

BIT 2

 

 

BIT 1

 

 

LSB

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CAPTURE STROBE

Figure 11-6. SPI Clock/Data Timing

Technical Data

 

MC68HC705C8A — Rev. 3

 

 

 

146

Serial Peripheral Interface (SPI)

MOTOROLA

Соседние файлы в папке mikrocont