Communication Processor Module
MOTOROLA
MPC823 USER’S MANUAL
16-451
I2
C
COMMUNICATION
16
PROCESSOR
MODULE
When communicating to either slave device, set the R bit in the TX buffer descriptor(s) to
prepare them for transmission. Set the I bit in the TX and RX buffer descriptors to enable
the transmission and reception status to be updated in the I2CE register, and to enable I2C
interrupts to the core. Set the E bit on the RX buffer descriptor(s) to prepare them for
reception. Finally, set the STR bit in the I2COM register to initiate transmission. The data
starts transmitting once the SDMA channel loads the transmit FIFO with data and the I2C
bus is not busy.
16.13.3.1.3 I2C Loopback Configuration. Loopback on the I2C controller is a special case
of master mode operation with a device that does not contain internal addresses. Refer to
you need to prepare a TX buffer descriptor with a data buffer N+1 bytes in length, where N
is the number of data bytes to be written back to the I2C controller. You also need to prepare
one or more RX buffer descriptors to receive back the N bytes of data.
The first byte of the TX buffer descriptor should contain the address of the MPC823 I2C
device’s own address, as contained in the I2CADD register, followed by the write bit
asserted (R/W = 0). The remaining N bytes of the TX buffer descriptor contain the data to
be sent and received by the I2C controller.
Next, set the R bits on the TX buffer descriptor and the E bits in the RX buffer descriptors.
The TX buffer descriptor control and status field should have the W and L bits set. The
setting of the L bit will cause a stop condition to be issued after this buffer is transmitted to
conclude the operation. Set the I bit in the TX and RX buffer descriptors to enable the
transmission and reception status to be updated in the I2CE register, and to enable I2C
transmit and receive interrupts to the core. You should then set the STR bit in the I2COM
register to initiate the loopback operation.
16.13.3.2 I2C SLAVE MODE. When the I2C controller functions in slave mode, it receives
messages from an I2C master and, in turn, sends back a reply. Once the I2C controller is
configured for slave mode operation by clearing the M/S bit in the I2COM register, the SCL
signal becomes an input driven by the external master. The I2C controller can operate with
an SCL of any frequency from DC to beyond 400kHz.
After the start condition, the first transmitted byte to the I2C slave device contains the 7-bit
slave device address and the read/write bit. The I2C controller will compare the transmitted
slave device address with its own programmed address. If there is a match, the read/write
bit is evaluated.
You must the clear the M/S bit in the I2COM register to configure the controller as a slave.
You do not program the I2MOD and I2BRG registers to set the SCL frequency, as SCL is
an input to the slave. Program the I2ADD register with the 7-bit I2C address of the slave.
Enable the I2C controller by setting the EN bit in the I2MOD register.