BAT32G1x9 user manual | Chapter 20 Serial interface IICA
773 / 1149
Rev.1.02
20.5.16
Communication operation
Here, the following three running steps are represented by a flowchart.
(1) The master operation of a single-master system
The flowchart used as a master device in a single master system is shown below.
This process is broadly divided into "initial setup" and "communication processing". Perform the Initial
Setup section at startup, and if communication with the slave is required, perform the Communication
Processing section after the preparation required to communicate.
(2) Master operation of multi-master system
In a multi-master system of the I2C bus, it is not possible to judge whether the bus is in the release state or
in use during the stage of participating in the communication based on the specifications of the I2C bus. Here,
if the data and clock are high for a certain amount of time (1 frame), the bus participates in
communication as a release state. This process is roughly divided into "initial setup", "communication
waiting" and "communication processing". The processing designated as a slave due to the failure of the
arbitration is omitted here, and only the processing used as the master device is omitted. Join the bus
after performing the Initial Setup section at startup, and then wait for a communication request from the
master device or a designation of the slave device via Communication Wait. The actual communication is
the "Communication Processing" section, which supports arbitration with other master devices in addition
to data sending and receiving with the slave.
(3) Slave run
An example of an I2C bus slave is shown below.
When used as a slave, it starts running with an interrupt. Perform the "Initial Setup" section at startup, then
through "Communication Wait" and wait for the INTIICAn interrupt to occur. If an INTIICAn interrupt
occurs, the communication status is determined and the flag is passed to the main processing
department.
By checking each flag, the required "communication processing" is carried out.
Note n = 0,1