R01UH0822EJ0100 Rev.1.00
Page 684 of 1041
Jul 31, 2019
RX13T Group
23. Serial Communications Interface (SCIg, SCIh)
23.7.4
SCI Initialization (Simple I
2
C Mode)
Before transferring data, write the initial value (00h) to SCR and initialize the interface following the example shown in
When changing the operating mode, transfer format, and so on, be sure to set SCR to its initial value before proceeding
with the changes.
In simple I
2
C mode, the open-drain setting for the communication ports should be made on the port side.
Figure 23.50
Example of the Flowchart of SCI Initialization (for Simple I
2
C Mode)
Start of transmission or reception
Start of initialization
Set up the transfer or reception format in
SMR and SCMR
Set the values in SEMR, SNFR, SIMR1,
SIMR2, and SPMR
Set the TIE, RIE, TE, RE, TEIE and
CKE[1:0] bits in SCR to 0
Set the I/O port functions
Set the SCR.RE and TE bit to 1 and set the
SCR.TIE, RIE and TEIE bits
Set the IICSDAS[1:0] and IICSCLS[1:0] bits
in SIMR3 to 11b
[ 1 ]
[ 2 ]
[ 3 ]
[ 6 ]
[ 7 ]
[ 1 ] Make I/O port settings that allow use (on N-channel
open-drain output pins) of the SSCLn and SSDAn pin
functions.
[ 2 ] Place the SSCLn and SSDAn pins in the high-
impedance state until a start condition is to be
generated.
[ 3 ] Set the format for transmission and reception in SMR
and SCMR.
In SMR, set the CKS[1:0] bits to the desired value and
set the other bits to 0.
In SCMR, set the SDIR bit to 1 and the SINV and SMIF
bits to 0.
[ 4 ] Write the value for the desired bit rate to BRR.
[ 5 ] Write the value obtained by correcting a bit rate error in
MDDR. This step is not necessary if the BRME bit in
SEMR is cleared to 0.
[ 6 ] Set the values in SEMR, SNFR, SIMR1, SIMR2, and
SPMR.
In SEMR, set the NFEN bit. Set the NFEN and BRME
bits in SEMR.
In SNFR, set the NFCS[2:0] bits.
In SIMR1, set the IICM bit to 1 and the IICDL[4:0] bits
as required.
In SIMR2, set the IICACKT and IICCSC bits to 1 and
the IICINTM bits as required.
In SPMR, set all the bits to 0.
[ 7 ] Set the RE and TE bits in the SCR to 1. Then, set the
SCR.TIE, RIE, and TEIE bits (for transmission and
when the SIMR2.IICINTM bit is 1, set the RIE bit to 0).
Setting the TE and RE bits to 1 makes the SSCLn and
SSDAn pin functions available.
Set the value in BRR
[ 4 ]
Set a value in MDDR
[ 5 ]
Note:
Set the SCR.RE and TE bits to 0 or 1 at the same time.