
481
16.3.2
Master Transmit Operation
In I
2C bus format master transmit mode, the master device outputs the transmit clock and
transmit data, and the slave device returns an acknowledge signal. The transmission procedure
and operations are described below.
[1] Set the ICE bit in ICCR to 1. Set bits MLS, WAIT, and CKS2 to CKS0 in ICMR, and bit
IICX in STCR, according to the operating mode.
[2] Read the BBSY flag in ICCR to confirm that the bus is free, then set bits MST and TRS to 1
in ICCR to select master transmit mode. Next, write 1 to BBSY and 0 to SCP. This changes
SDA from high to low when SCL is high, and generates the start condition. The TDRE
internal flag is then set to 1, and the IRIC and IRTR flags are also set to 1. If the IEIC bit in
ICCR has been set to 1, an interrupt request is sent to the CPU.
[3] With the I
2C bus format (when the FS bit in SAR or the FSX bit in SARX is 0), the first
frame data following the start condition indicates the 7-bit slave address and transmit/receive
direction. Write the data (slave address + R/W) to ICDR. The TDRE internal flag is then
cleared to 0. The written address data is transferred to ICDRS, and the TDRE internal flag is
set to 1 again. This is identified as indicating the end of the transfer, and so the IRIC flag is
cleared to 0. The master device sequentially sends the transmit clock and the data written to
ICDR using the timing shown in figure 16.6. The selected slave device (i.e. the slave device
with the matching slave address) drives SDA low at the 9th transmit clock pulse and returns
an acknowledge signal.
[4] When one frame of data has been transmitted, the IRIC flag is set to 1 at the rise of the 9th
transmit clock pulse. If the TDRE internal flag has been set to 1, after one frame has been
transmitted SCL is automatically fixed low in synchronization with the internal clock until
the next transmit data is written.
[5] To continue transfer, write the next data to be transmitted into ICDR. After the data has been
transferred to ICDRS and the TDRE internal flag has been set to 1, clear the IRIC flag to 0.
Transmission of the next frame is performed in synchronization with the internal clock.
Data can be transmitted sequentially by repeating steps [4] and [5]. To end transmission, clear
the IRIC flag, write H'FF dummy data to ICDR after the last data has been transmitted (when
ICDRT does not contain the next transmit data), and then write 0 to BBSY and SCP in ICCR
when the IRIC flag is set again. This changes SDA from low to high when SCL is high, and
generates the stop condition.