
Mini57
Apr. 06, 2017
Page 392 of 475
Rev.1.00
MINI5
7
S
E
RI
E
S
TECH
NIC
A
L R
E
F
E
RE
N
CE
MA
N
UA
L
Control flow
The on-chip I
2
C ports support three operation modes, Master, Slave, and General Call Mode.
In a given application, I
2
C port may operate as a master or as a slave. In Slave mode, the I
2
C port
hardware looks for its own slave address and the general call address. If one of these addresses
is detected, and if the slave is willing to receive or transmit data from/to master(by setting the AA
bit), acknowledge pulse will be transmitted out on the 9th clock, hence an interrupt is requested
on both master and slave devices if interrupt is enabled. When the microcontroller wishes to
become the bus master, hardware waits until the bus is free before entering Master mode so that
a possible slave action is not be interrupted. If address arbitration is lost in Master mode, I
2
C port
switches to Slave mode immediately and can detect its own slave address in the same serial
transfer.
To control the I
2
C bus transfer in each mode, user needs to set UI2C_PROTCTL,
UI2C_PROTIEN, TXDAT registers according to current status of UI2C_PROTSTS register. In
other words, for each I
2
C bus action, user needs to check current status by UI2C_PROTSTS
register, and then set UI2C_PROTCTL, UI2C_PROTIEN, TXDAT registers to take bus action.
Finally, check the response status by UI2C_PROTSTS.
The bits, STA, STO and AA in UI2C_PROTCTL register are used to control the next state of the
I
2
C hardware after interrupt signal is cleared. Upon completion of the new action, a new status will
be updated in UI2C_PROTSTS register will be set. If the I
2
C interrupt control bit of
UI2C_PROTIEN is set, appropriate action or software branch of the new status can be performed
in the Interrupt service routine.
Figure 6.14-8 shows the current I
2
C STARIF (UI2C_PROTSTS [8]) is set to 1 by hardware, and
then set TXDAT = SLA+W (Slave address + Write bit), (PTRG, STA, STO, AA) = (1, 0, 0, x) to
send the address to I
2
C bus, and write 1 to STARIF (UI2C_PROTSTS [8]) to clear flag. If a slave
on the bus matches the address and response ACK, the UI2C_PROTSTS will be updated by
ACKIF (UI2C_PROTSTS [13]) setting.
TXDAT
(SLA+W)
ACK
Last Status
STARIF = 1
Updated Status
ACKIF = 1
Register Control
TXDAT = SLA+W
(PTRG,STA,STO,AA)=(1,0,0,x)
Write 1 to STARIF
Master to Slave
Slave to Master
S
Figure 6.14-8 Control I
2
C Bus according to Current I
2
C Status
Содержание Mini57 Series
Страница 376: ...Mini57 Apr 06 2017 Page 376 of 475 Rev 1 00 MINI57 SERIES TECHNICAL REFERENCE MANUAL 1 Receive buffer is full ...
Страница 472: ...Mini57 Apr 06 2017 Page 472 of 475 Rev 1 00 MINI57 SERIES TECHNICAL REFERENCE MANUAL 1 3 20 Pin TSSOP 4 4x6 5x0 9 mm ...
Страница 473: ...Mini57 Apr 06 2017 Page 473 of 475 Rev 1 00 MINI57 SERIES TECHNICAL REFERENCE MANUAL 9 1 33 pin QFN33 4x4x0 8 mm ...