
RM0008
Inter-integrated circuit (I
2
C) interface
Doc ID 13902 Rev 12
731/1096
Slave receiver
Following the address reception and after clearing ADDR, the slave receives bytes from the
SDA line into the DR register via the internal shift register. After each byte the interface
generates in sequence:
●
An acknowledge pulse if the ACK bit is set
●
The RxNE bit is set by hardware and an interrupt is generated if the ITEVFEN and
ITBUFEN bit is set.
If RxNE is set and the data in the DR register is not read before the end of the next data
reception, the BTF bit is set and the interface waits until BTF is cleared by a read from
I2C_SR1 followed by a read from the I2C_DR register, stretching SCL low (see
Transfer sequencing).
Figure 271. Transfer sequence diagram for slave receiver
Closing slave communication
After the last data byte is transferred a Stop Condition is generated by the master. The
interface detects this condition and sets,
●
The STOPF bit and generates an interrupt if the ITEVFEN bit is set.
Then the interface waits for a read of the SR1 register followed by a write to the CR1 register
(see
Transfer sequencing EV4).
26.3.3 I
2
C master mode
In Master mode, the I
2
C interface initiates a data transfer and generates the clock signal. A
serial data transfer always begins with a Start condition and ends with a Stop condition.
Master mode is selected as soon as the Start condition is generated on the bus with a
START bit.
7-bit
s
lave receiver
10-bit
s
lav e receiver
Le
g
end:
S
=
S
t
a
rt,
S
r
= Repe
a
ted
S
t
a
rt, P=
S
top, A= Acknowledge,
EVx= Event (with interr
u
pt if ITEVFEN=1)
EV1:
ADDR=1, cle
a
red
b
y re
a
ding
S
R1 followed
b
y re
a
ding
S
R2
EV2:
RxNE=1 cle
a
red
b
y re
a
ding DR regi
s
ter.
EV4:
S
TOPF=1, cle
a
red
b
y re
a
ding
S
R1 regi
s
ter followed
b
y writing to the CR1 regi
s
ter
S
Addre
ss
A
D
a
t
a
1
A
D
a
t
a
2
A
.....
D
a
t
a
N
A
P
EV1
EV2
EV2
EV2
EV4
S
He
a
der
A
Addre
ss
A
D
a
t
a
1
A
.....
D
a
t
a
N
A
P
EV1
EV2
EV2
EV4
a
i15
88
4
b
Note
s
: 1- The EV1 event
s
tretche
s
S
CL low
u
ntil the end of the corre
s
ponding
s
oftw
a
re
s
e
qu
ence.
2- The EV2
s
oftw
a
re
s
e
qu
ence m
us
t complete
b
efore the end of the c
u
rrent
b
yte tr
a
n
s
fer.