Chapter 13
Serial Interface
XIII - 68 IIC Communication
13.5.4 Setup Example
Setting Example of Master Communication
Figure:13.5.13 Master communication Setting Flow Diagram
Termination processing of IIC communication
IIC communication completion
Stop condition generation
Continue communication ?
Restart condition detected ?
Transmission data buffer writing
Set data to TXBUFn
Serial reset
SCnMD2.IIC3RSTN=0
YES
YES
YES
NO
YES(*2)
NO
Transmission/reception mode selection
SCnMD3.IIC3REX
Arbitration lost detected ?
SCnIICSTR.IIC3ABT_LST=0?
NO
NO
SCnMD3.IIC3STPC =1
End of serial reset
SCnMD2:IIC3RSTN=1
Initializing monitor flag
SCnIICSTR.IIC3ABT_LST=0
ACK bit detection ?
SCnMD3.SCnACKO=1?
SCnIICSTR.IIC3DATA_ERR=0?
SCnIICSTR.IIC3STRT=1?
Iniial setting (*1)
Start master communication
Master communication completion
Set a slave address and R/W bit toTXBUFn
Communication completion interrupt generation
Select MSB-first or LSB-first
SCnSBCSLV
SCnDIR
Be sure to set it to "0".
(*1) As initial setting, register changed at the time of serial reset is shown below.
Please change it if needed, such as interrupt setting or port setting.
Master setting at slave address transmission
SCnMD0 SCnCE1
SCnCTM
IIC3DEM
SCnMD1 SCnIOM
SCnMST
SCnSBTS
SCnSBIS
SCnSBOS
SCnMD2
SCnIFS
SCnCKPH
SCnSBCSEN
SCnMD3
IIC3STPC
IIC3REX
SCnCMD
IIC3ACKS
Other, SCnMD0, SCnMD3, SCnAD re
ister
SCnMD0
IIC3STE
SCnMD3 IIC3TMD
SCnAD IIC3AD7-0
Be sure to set it to "0".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "1".
Be sure to set it to "1".
Be sure to set it to "0".
Be sure to set it to "0".
Be sure to set it to "0".
Be sure to set it to "1".
Be sure to set it to "1".
Start condition setting
Slave address setting
Communication mode selectioon
Be sure to set it to "0".
Serial transfer clock is needed to be set with BRTM_S_EN, BRTM_S_MD
and so forth.
YES(*2)
YES(*2)
(*2) To avoid communication error, confirm that IIC serial communication
is not executed with IIC3BUSBSY before starting next communication.