BAT32G1x9 user manual | Chapter 20 Serial interface IICA
774 / 1149
Rev.1.02
(1)
The master operation of a single-master system
Figure 20-26 The master operation of the single master control system
START
configure PER0 register
Configure Port
IICWLn
,
IICWHn
XXH
SVAn
XXH
IICFn
0XH
Configure STCENn
,
IICRSVn=0
Configure IICCTLn1
IICCTLn0
0XX011XXB
ACKEn=WTIMn=SPIEn=1
IICCTLn0
1XX111XXB
IICEn=1
Configure Port
STCEN=1
?
release serial interface IICA from reset state,
start providing clock.
configure pins and multiplexed ports to be used.
First port configured to be input mode and output latch
set to
"0“
select transmission clock
configure local address
configure start condition
allows I2C bus outupt after configure Port from input mode
to output mode.
in
it
ia
l
c
o
n
fi
g
u
ra
ti
o
n
c
o
m
m
u
n
ic
a
ti
o
n
p
ro
c
e
s
s
No
I2C bus initialization. Note.
SPTn=1
does INTIICAn interrupt
occur?
No
prepare starting
communication. (generate
stop condition)
wait for detection of
stop condition
Yes
Yes
STTn=1
prepare starting
communication. (generate start
condition)
Write IICAn
start communicating. (determined
address and transmission direction)
does INTIICAn interrupt
occur?
No
Yes
ACKDn=1
?
Yes
TRCn=1
?
Yes
Write IICAn
does INTIICAn interrupt
occur?
No
Yes
ACKDn=1
?
Yes
transmission
completes?
?
Yes
restart?
?
Yes
No
No
SPTn=1
END
ACKEn=1
WTIMn=0
WRELn=1
does INTIICAn interrupt
occur?
No
Yes
Write IICAn
transmission
completes?
?
start
transmission
wait for
receiving data
start
transmission
wait for
receiving data
No
Yes
ACKEn=0
WTIMn=1
WRELn=1
does INTIICAn interrupt
occur?
No
Yes
wait for detecing
acknowledgement
Note: The I2C-bus must
be released (
SCLAn
pins and
SDAAn
pins
are high) depending on the specifications of
the product in communication. For example, if
the EEPROM
is in a
state that outputs a low level to the
SDAAn
pin, the
SCLAn
pin must be
set to the output port and
a clock pulse must be output from
the output port before the
SDAAn
pin is fixed high.
Remarks: 1
The formats of the sending and receiving must
Comm
un
ic
ation
proces
si
ng