433
16.6 Operation of the Multi-address I
2
C
I
Start Condition
When the master is not connected to the bus (the logic of SCL and SDA is "H") in states where
the bus is released, the master generates a start condition. As indicated in Figure 16.6-1 "Data
Transfer Example", a start condition is generated when the SDA line is changed from "H" to "L"
in states where SCL is at the "H" level. At this time, new data transfer starts and master/slave
operation starts. The two methods for generating a start condition are shown as follows.
Writing "1" to the MBCR: MSS bit in states where the multi-address I
2
C bus is not used
(MBCR: MSS = 0, MBSR: BB = 0, MBCR: INT = 0, MBSR: AL = 0). Thereafter, MBSR: BB
is set to "1" to indicate bus busy.
Writing "1" to the MBCR: SCC bit in interrupt states in bus master mode (MBCR: MSS = 1,
MBSR: BB = 1, MBCR: INT = 1, MBSR: AL = 0) and generates a repeated start condition.
Even if "1" is written to the MBCR: MSS bit or "1" is written to the MBCR: SCC bit under
conditions other than the above conditions, it is ignored. If "1" is written to the MBCR: MSS bit
when another system is using the bus (in idle state), the MBSR: AL bit is set to "1".
I
Addressing
In master mode, the BB and TRX bits in the MBSR register are set to 1 after a start condition is
generated and the contents of the MDAR register in the slave address are output from the MSB
in turn. This address data consists of 8-bits with a seven-bit slave address, followed by a R/W
bit indicating the data transfer direction (Bit 0 in MDAR).
After the address data is transmitted, the master receives acknowledge from the slave. The
SDA line is set to "L" by the 9th clock and the master receives the acknowledge bit from the
receiving end (see Figure 16.6-1 "Data Transfer Example"). At this time, the R/W bit (MDAR: bit
0) is reversed and stored in the MBSR: TRX bit.
In slave mode, the BB and TRX bits in the MBSR register are set to "1" and "0", respectively,
after a start condition is detected and data from the master is received by the MDAR register.
After receiving the address data, the MDAR and MADR1 to 6 registers are compared. If the
values match, MBSR: AAS is set to "1" and acknowledge is transmitted to the master.
Thereafter, bit 0 of the received data (bit 0 in the MDAR register) is stored in the MBSR: TRX
bit.
I
Data Transfer
After addressing of the slave is achieved, data can be transmitted and received in byte units in
the direction determined by the R/W bit sent by the master.
Each byte output to the SDA line is fixed to 8-bits. As shown in Figure 16.6-1 "Data Transfer
Example", the receiving device transmits acknowledge to the transmitting device by stabilizing
the SDA line to the "L" level when the acknowledge clock pulse is "H". With the MSB at the
head, each bit of data is transmitted in one clock pulse. Each time a byte is transferred,
acknowledge must be transmitted and received. Therefore, 9 clock pulses are required to
transfer one complete data byte.
I
Acknowledge
Acknowledge is transmitted from the receiving end for the 9th clock of data byte transfer from
the transmitting end.
When data is received, the acknowledge bit can be enabled (MBCR: ACK = 1) or disabled
(MBCR: ACK = 0) with the MBCR: ACK bit.
When transmitting data, acknowledge from the receiving end is stored in the MBSR: LRB bit.