
Inter-integrated circuit (I
2
C) interface
RM0008
734/1096
Doc ID 13902 Rev 12
Master transmitter
Following the address transmission and after clearing ADDR, the master sends bytes from
the DR register to the SDA line via the internal shift register.
The master waits until the first data byte is written into I2C_DR (see
Transfer
sequencing EV8_1).
When the acknowledge pulse is received:
●
The TxE bit is set by hardware and an interrupt is generated if the ITEVFEN and
ITBUFEN bits are set.
If TxE is set and a data byte was not written in the DR register before the end of the last data
transmission, BTF is set and the interface waits until BTF is cleared by a read from I2C_SR1
followed by a write to I2C_DR, stretching SCL low.
Closing the communication
After the last byte is written to the DR register, the STOP bit is set by software to generate a
Stop condition (see
Transfer sequencing EV8_2). The interface automatically
goes back to slave mode (M/SL bit cleared).
Note:
Stop condition should be programmed during EV8_2 event, when either TxE or BTF is set.
Figure 272. Transfer sequence diagram for master transmitter
7-bit ma
s
ter tran
s
mitter
10-bit
ma
s
ter tran
s
mitter
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)
EV5:
S
B=1, cle
a
red
b
y re
a
ding
S
R1 regi
s
ter followed
b
y writing DR regi
s
ter with Addre
ss
.
EV6:
ADDR=1, cle
a
red
b
y re
a
ding
S
R1 regi
s
ter followed
b
y re
a
ding
S
R2.
EV
8
_1:
TxE=1,
s
hift regi
s
ter empty, d
a
t
a
regi
s
ter empty, write D
a
t
a
1 in DR.
EV
8
:
TxE=1,
s
hift regi
s
ter not empty, d
a
t
a
regi
s
ter empty, cle
a
red
b
y writing DR regi
s
ter
.
EV
8
_2:
TxE=1, BTF = 1, Progr
a
m
S
top re
qu
e
s
t. TxE
a
nd BTF
a
re cle
a
red
b
y h
a
rdw
a
re
b
y the
S
top condition
EV9:
ADD10=1, cle
a
red
b
y re
a
ding
S
R1 regi
s
ter followed
b
y writing DR 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
EV5
EV6
EV
8
_1
EV
8
EV
8
EV
8
EV
8
_2
S
He
a
der
A
Addre
ss
A
D
a
t
a
1
A
.....
D
a
t
a
N
A
P
EV5
EV9
EV6
EV
8
_1
EV
8
EV
8
EV
8
_2
a
i15
88
1
b
Note
s
: 1- The EV5, EV6, EV9, EV
8
_1
a
nd EV
8
_2 event
s
s
tretch
S
CL low
u
ntil the end of the corre
s
ponding
s
oftw
a
re
s
e
qu
ence.
2- The EV
8
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. In c
as
e EV
8
s
oftw
a
re
s
e
qu
ence c
a
n not
b
e m
a
n
a
ged
b
efore the c
u
rrent
b
yte end of tr
a
n
s
fer, it i
s
recommended to
us
e BTF in
s
te
a
d
of TXE with the dr
a
w
ba
ck of
s
lowing the comm
u
nic
a
tion.