RX610 Group
22. I
2
C Bus Interface (RIIC)
R01UH0032EJ0120 Rev.1.20
Page 729 of 1006
Feb 20, 2013
22.3.3
Master Transmitter Operation
In master transmitter operation, the RIIC outputs the SCL (clock) and transmitted data signals as the master device, and
the slave device returns acknowledgements. Figure 22.6 shows an example of usage of master transmission and figures
22.7 to 22.9 show the timing of operations in master transmission.
The following describes the procedure and operations for master transmission.
1. Set the IICRST bit in ICCR1 to 1 (internal reset) and then clear the IICRST bit to 0 (canceling reset) with the ICE bit
in ICCR1 cleared to 0 (disabling the interface). This initializes the internal state and the various flags of ICSR1. After
that, set registers SARLy, SARUy, ICSER, ICMR1, ICBRH, and ICBRL (y = 0 to 2), and set the other registers as
necessary (for initial settings of the RIIC, see figure 22.5). When the necessary register settings have been completed,
set the ICE bit to 1 (to enable transfer). This step is not necessary if initialization of the RIIC has already been
completed.
2. Read the BBSY flag in ICCR2 to check that the bus is open, and then set the ST bit in ICCR2 to 1 (start condition
issuance request). Upon receiving the request, the RIIC issues a start condition. At the same time, the BBSY flag and
the START flag in ICSR2 are automatically set to 1 and the ST bit is automatically cleared to 0. At this time, if the
start condition is detected and the internal levels for the SDA output state and the levels on the SDAn line have
matched while the ST bit is 1, the RIIC recognizes that issuing of the start condition as requested by the ST bit has
been successfully completed, and the MST and TRS bits in ICCR2 are automatically set to 1, placing the RIIC in
master transmitter mode. The TDRE flag in ICSR2 is also automatically set to 1 in response to setting of the TRS bit
to 1.
3. Check that the TDRE flag in ICSR2 is 1, and then write the value for transmission (the slave address and the R/W#
bit) to ICDRT. Once the data for transmission are written to ICDRT, the TDRE flag is automatically cleared to 0, the
data are transferred from ICDRT to ICDRS, and the TDRE flag is again set to 1. After the byte containing the slave
address and R/W# bit has been transmitted, the value of the TRS bit is automatically updated to select master
transmitter or master receiver mode in accord with the value of the transmitted R/W# bit. If the value of the R/W# bit
was 0, the RIIC continues in master transmitter mode.
Since the ICSR2.NACKF flag being 1 at this time indicates that no slave device recognized the address or there was
an error in communications, write 1 to the ICCR2.SP bit to issue a stop condition.
For data transmission with an address in the 10-bit format, start by writing 1111 0b, the two higher-order bits of the
slave address, and W to ICDRT as the first address transmission. Then, as the second address transmission, write the
eight lower-order bits of the slave address to ICDRT.
4. After confirming that the TDRE flag in ICSR2 is 1, write the data for transmission to the ICDRT register. The RIIC
automatically holds the SCLn line low until the data for transmission are ready or a stop condition is issued.
5. After all bytes of data for transmission have been written to the ICDRT register, wait until the value of the TEND flag
in ICSR2 returns to 1, and then set the SP bit in ICCR2 to 1 (stop condition issuance request). Upon receiving a stop
condition issuance request, the RIIC issues the stop condition.
6. Upon detecting the stop condition, the RIIC automatically clears the MST and TRS bits in ICCR2 to 00b and enters
slave receiver mode. Furthermore, it automatically clears the TDRE and TEND flags to 0, and sets the STOP flag in
ICSR2 to 1.
7. After checking that the ICSR2.STOP flag is 1, clear the ICSR2.NACKF and STOP flags to 0 for the next transfer
operation.
Summary of Contents for RX600 Series
Page 1006: ...RX610 Group R01UH0032EJ0120 ...