Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
34
Добавлен:
27.04.2015
Размер:
1.98 Mб
Скачать

SPI Architecture

7.1 SPI Architecture

Figure 7-2 on page 7-3 shows a block diagram of the SPI subsystem. When an SPI transfer occurs, a byte is shifted out one data pin, while a different byte is simultaneously shifted in a second data pin. Another way to view this transfer is that an 8-bit shift register in the master device and another 8-bit shift register in the slave are connected as a circular 16-bit shift register. When a transfer occurs, this distributed shift register is shifted 8 bit positions; thus, the bytes in the master and slave are effectively exchanged.

PGDB

Internal

Peripheral Data Bus

Phi Clock

16-bit

 

 

 

 

 

 

Clock

 

SCK

SPI Control Register

 

Logic

 

 

 

1

 

 

 

 

SPI Status Register

 

 

 

 

 

Control and

 

 

 

 

State Machines

 

 

 

 

 

 

Slave

 

8 Zeros and 8 Bits Data

 

 

Select

SS

 

 

Logic

1

 

 

 

8-Bit Receive

SPDR

 

 

 

Data Buffer

 

 

 

 

M

 

 

 

 

 

 

 

 

S

Pin

MISO

 

 

 

 

 

 

1

 

1

 

Control

 

 

 

 

 

Logic

 

Transmit/Receive

 

S

 

 

 

 

8-Bit Shift Reg

 

 

MOSI

1

M

 

 

 

1

 

 

 

 

8 LSBs

 

 

 

AA0145

Figure 7-2. SPI Block Diagram

 

The central element in the SPI system is the block containing the shift register and receive data buffer. The system is single-buffered in the transmit direction and double-buffered in the receive direction. This means that new data for transmission cannot be written to the shifter until the previous transfer is complete.

However, received data is transferred into a parallel read data buffer, so the shifter is free to accept a second serial byte. As long as the first byte is read out of the read data buffer before the next serial byte is ready to be transferred, no overrun condition occurs. A single memory address is used for reading data from the read buffer and writing data to the shifter.

The SPI status block represents the SPI status functions (transfer complete, write collision, and mode fault) located in the SPI status register (SPSR). The SPI control block contains the SPI control register (SPCR) used to set up and control the SPI system.

Figure 7-3 on page 7-4 and Figure 7-4 on page 7-4 illustrate the different transfer formats. SCK (the serial clock) is shown for each polarity (selected by CPL). Both master and slave timing are shown. Master in/slave out (MISO) and master out/slave in (MOSI) pins are connected between the master and slave. MISO is the slave output and MOSI is the master output. The slave select pin (SS) shown is for the slave. The master’s SS pin is held high but is not shown.

Serial Peripheral Interface

7-3

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