Auto Page CPX-3600 Specifikace Strana 125

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 243
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 124
ST72321xx-Auto Serial peripheral interface (SPI)
Doc ID 13829 Rev 1 125/243
14.3.4 Master mode transmit sequence
When software writes to the SPIDR register, the data byte is loaded into the 8-bit shift
register and then shifted out serially to the MOSI pin most significant bit first.
When data transfer is complete:
The SPIF bit is set by hardware
An interrupt request is generated if the SPIE bit is set and the interrupt mask in the
CCR register is cleared.
Clearing the SPIF bit is performed by the following software sequence:
1. An access to the SPICSR register while the SPIF bit is set
2. A read to the SPIDR register.
Note: While the SPIF bit is set, all writes to the SPIDR register are inhibited until the SPICSR
register is read.
14.3.5 Slave mode operation
In slave mode, the serial clock is received on the SCK pin from the master device.
To operate the SPI in slave mode:
1. Write to the SPICSR register to perform the following actions:
a) Select the clock polarity and clock phase by configuring the CPOL and CPHA bits
(see Figure 59).
Note: The slave must have the same CPOL and CPHA settings as the master.
b) Manage the SS
pin as described in Slave select management on page 123 and
Figure 57. If CPHA = 1, SS
must be held low continuously. If CPHA = 0, SS must
be held low during byte transmission and pulled up between each byte to let the
slave write in the shift register.
2. Write to the SPICR register to clear the MSTR bit and set the SPE bit to enable the SPI
I/O functions.
14.3.6 Slave mode transmit sequence
When software writes to the SPIDR register, the data byte is loaded into the 8-bit shift
register and then shifted out serially to the MISO pin most significant bit first.
The transmit sequence begins when the slave device receives the clock signal and the most
significant bit of the data on its MOSI pin.
When data transfer is complete:
The SPIF bit is set by hardware.
An interrupt request is generated if SPIE bit is set and interrupt mask in the CCR
register is cleared.
Clearing the SPIF bit is performed by the following software sequence:
1. An access to the SPICSR register while the SPIF bit is set
2. A write or a read to the SPIDR register
Note: While the SPIF bit is set, all writes to the SPIDR register are inhibited until the SPICSR
register is read.
Zobrazit stránku 124
1 2 ... 120 121 122 123 124 125 126 127 128 129 130 ... 242 243

Komentáře k této Příručce

Žádné komentáře