ST7FMC1K2B3 STMICROELECTRONICS [STMicroelectronics], ST7FMC1K2B3 Datasheet - Page 99

no-image

ST7FMC1K2B3

Manufacturer Part Number
ST7FMC1K2B3
Description
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
In master mode, the serial clock is output on the
SCK pin. The clock frequency, polarity and phase
are configured by software (refer to the description
of the SPICSR register).
the polarity selected in the SPICSR register (by
pulling up SCK if CPOL = 1 or pulling down SCK if
CPOL = 0).
To operate the SPI in master mode, perform the
following steps in order:
1. Write to the SPICR register:
2. Write to the SPICSR register:
3. Write to the SPICR register:
ten first, the SPICR register setting (MSTR bit)
may be not taken into account.
The transmit sequence begins when software
writes a byte in the SPIDR register.
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 sig-
nificant bit first.
When data transfer is complete:
Clearing the SPIF bit is performed by the following
software sequence:
1. An access to the SPICSR register while the
2. A read to the SPIDR register
– Select the clock frequency by configuring the
– Select the clock polarity and clock phase by
– Either set the SSM bit and set the SSI bit or
– Set the MSTR and SPE bits
– The SPIF bit is set by hardware.
– An interrupt request is generated if the SPIE
SPIF bit is set
SPR[2:0] bits.
configuring the CPOL and CPHA bits.
59
and CPHA settings as the master.
clear the SSM bit and tie the SS pin high for
the complete byte transmit sequence.
SS is high).
bit is set and the interrupt mask in the CCR
register is cleared.
The idle state of SCK must correspond to
shows the four possible configurations.
The slave must have the same CPOL
MSTR and SPE bits remain set only if
if the SPICSR register is not writ-
(cont’d)
Figure
SPIDR register are inhibited until the SPICSR reg-
ister is read.
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 fol-
2. Write to the SPICR register to clear the MSTR
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 sig-
nificant bit first.
The transmit sequence begins when the slave de-
vice receives the clock signal and the most signifi-
cant bit of the data on its MOSI pin.
When data transfer is complete:
Clearing the SPIF bit is performed by the following
software sequence:
1. An access to the SPICSR register while the
2. A write or a read to the SPIDR register
SPIDR register are inhibited until the SPICSR reg-
ister is read.
The SPIF bit can be cleared during a second
transmission; however, it must be cleared before
the second SPIF bit in order to prevent an Overrun
condition (see
bit and set the SPE bit to enable the SPI I/O
functions.
– The SPIF bit is set by hardware.
– An interrupt request is generated if SPIE bit is
SPIF bit is set
lowing actions:
– Select the clock polarity and clock phase by
– Manage the SS pin as described in
configuring the CPOL and CPHA bits (see
Figure
and CPHA settings as the master.
10.4.3.2
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.
set and interrupt mask in the CCR register is
cleared.
While the SPIF bit is set, all writes to the
While the SPIF bit is set, all writes to the
The slave must have the same CPOL
59).
and
Section
Figure
10.4.5.2).
57. If CPHA = 1 SS must
Section
99/309
1

Related parts for ST7FMC1K2B3