![](http://datasheet.mmic.net.cn/290000/XPC801ZP25_datasheet_16187868/XPC801ZP25_399.png)
Serial Communication Modules
16-28
MPC801 USER’S MANUAL
MOTOROLA
16
16.3.3.2 CLOCKING AND PIN FUNCTIONS .
The I
2
C controller can be configured as a
master for the serial channel to generate the clock signal and initiate and terminate the
transfer. As a slave, it can be configured so that the clock signal is an input to the I
2
C
controller. When the I
2
C controller is a master, the I
2
C baud rate generator is used to
generate the transmit and receive clocks. The I
2
C baud rate generator takes its input from
the baud rate generator clock, which is generated in the clock synthesizer of the MPC801.
The bidirectional serial data (SDA) and serial clock (SCL) pins are connected to a positive
supply voltage via an external pull-up resistor. When the bus is free, both lines are high.
When the I
2
C controller is a master, the SCL pin is the clock output signal that shifts in the
received data and shifts out the transmitted data from or to the SDA pin. Additionally, the
transmitter arbitrates for the bus during the transmission and aborts it if it loses arbitration.
When the I
2
C controller is a slave, the SCL pin is the clock input signal that shifts in the
received data and shifts out the transmitted data from or to the SDA pin.
16.3.3.3 I
2
C CONTROLLER TRANSMISSION AND RECEPTION PROCESS.
Since the
I
2
C is a character-oriented communication unit, the core is responsible for packing and
unpacking the receive/transmit frames. The core supplies and collects words to or from the
I
2
C as requested. The core receives data by reading the I2CRD register. It resets the F bit
in the I2CER to free the I2CRD register for the next operation. The core transmits data by
writing it into the I2CTD register when a FIRST or LAST word indication occurs.
The I
2
C core handshake protocol can be implemented using a polling or interrupt
mechanism. With a polling mechanism, the core reads the I2CER in a predefined frequency
and acts according to the value of the I2CER bits. The polling frequency depends on the SPI
serial channel frequency. When an interrupt mechanism is used, setting either the E or F
bits of the I2CER causes an interrupt to the core. The interrupt level is determined by the
I2CRL bits of the I2CMR.The core then reads the I2CER and acts appropriately. There are
two basic modes of I
2
C operation—master and slave mode.
16.3.3.3.1 I
2
C Master Mode.
When the I
2
C controller functions in master mode, the I
2
C
master initiates a transaction by transmitting a message to the peripheral or I
2
C slave. This
message specifies a read or write operation. If it is a read operation, the direction of the
transfer is changed at the moment of the first acknowledgment and the slave receiver
becomes a slave transmitter. To begin the data exchange, the core writes the data to be
transmitted into the I2CTD register and sets the STR and M/S bits in the I2COM register to
start transmitting. The I
2
C master begins transmitting once the shift register is loaded with
data and the I
2
C bus is not busy.
The I
2
C controller generates a start condition on the SDA and SCL pins and, at the same
time, a programmable clock pulses on the SCL pin for each data bit shifted out on the SDA
pin. For each bit shifted out, the transmitter monitors the level of the SDA pin to detect a
possible collision with other I
2
C master transmitters. If a collision is detected (the data bit
transmitted was 1, but the SDA pin was 0), the transmission is aborted and the channel
reverts to slave mode. A maskable interrupt is generated to the core to enable the software
to try retransmitting later. After each byte, the master transmitter monitors the
acknowledgment indication. If the receiver fails to acknowledge a byte, the transmission is
aborted and the stop condition is generated by the master.