
21 I2C Slave (I2CS)
21-6
EPSON
S1C17602 TECHNICAL MANUAL
21.5 Data Transmit/Receive Control
Before starting data transfer, set up the conditions by the procedure below.
(1) Initialize the I2C slave module. See Section 21.4.
(2) Set up the interrupt conditions if the I2C slave interrupt is used. See Section 21.6.
Note: Make sure that the I2C slave module is disabled (I2C_EN/I2CS_CTL register = 0) before setting
the conditions above.
I2C_EN: I2C Slave Enable Bit in the I2C Slave Control (I2CS_CTL) Register (D7/0x4366)
Enabling data transmission/reception
First, set the I2C_EN bit (D7/I2CS_CTL register) to 1 to enable I2C slave operation. This makes the I2C slave
in ready-to-transmit/receive status in which a START condition can be detected.
Note: Do not set the I2C_EN bit to 0 while the I2C slave module is transmitting/receiving data.
Starting data transmission/reception
To start data transmission/reception, set COM_MODE (D0/I2CS_CTL register) to 1 to enable the data
communication.
COM_MODE: I2C Slave Communication Mode Bit in the I2C Slave Control (I2CS_CTL) Register (D0/0x4366)
When the slave address for this module that has been sent from the master is received after a START condition
is detected, the I2C slave module returns an ACK (SDA1 = low) and starts operating for data reception or data
transmission according to the transfer direction bit that has been received with the slave address.
When COM_MODE is 0 (default), the I2C slave module does not send back a response if the master has sent
the slave address of this module (it is regarded as that the I2C module has returned a NAK to the master).
SDA1 (input)
SDA1 (output)
SCL1 (input)
START condition
1
2
3
4
5
6
7
8
9
ACK
NAK
7-bit slave address
Transfer direction
0: master
→ slave (data reception)
1: slave
→ master (data transmission)
A6
A5
D7
D6
A4
D5
A3
D4
A2
D3
A1
D2
A0
D1
R/W
D0
Figure 21.5.1 Receiving Slave Address and Data Direction Bit
When a START condition is detected, BUSY (D2/I2CS_ASTAT register) is set to 1 to indicate that the I2C
bus is put into busy status. When the slave address of this module is received, SELECTED (D1/I2CS_ASTAT
register) is set to 1 to indicate that this module has been selected as the I2C slave device. Both BUSY and
SELECTED keep 1 until a STOP condition is detected. Furthermore, the value of the transfer direction bit is set
to R/W (D0/I2CS_ASTAT register), so use R/W to select the transmit- or receive-handling.
BUSY: I2C Bus Status Bit in the I2C Slave Access Status (I2CS_ASTAT) Register (D2/0x436a)
SELECTED: I2C Slave Select Status Bit in the I2C Slave Access Status (I2CS_ASTAT) Register (D1/0x436a)
R/W: Read/Write Direction Bit in the I2C Slave Access Status (I2CS_ASTAT) Register (D0/0x436a)
If the slave address of this module is detected when the asynchronous address detection function has been
enabled, ASDET (D2/I2CS_STAT register) is set to 1. The I2C slave module generates a bus status interrupt
and returns NAK to the I2C master to request for resending the slave address. Set the PCLK frequency to eight-
times or higher than the transfer rate and disable the asynchronous address detection function in the interrupt
handler routine. Data transfer will be able to resume normally after the master retries transmission. ASDET can
be cleared by writing 1.
ASDET: Async. Address Detection Status Bit in the I2C Slave Status (I2CS_STAT) Register (D2/0x4368)