Datasheet

Section 15 Serial Communication Interface (SCI, IrDA)
Rev.7.00 Mar. 18, 2009 page 727 of 1136
REJ09B0109-0700
15.4.4 SCI Initialization (Asynchronous Mode)
Before transmitting and receiving data, you should first clear the TE and RE bits in SCR to 0, then
initialize the SCI as shown in figure 15.5. Do not write to SMR, SCMR, IrCR, or SEMR while the
SCI is operating. This also applies to writing the same data as the current register contents. When
the operating mode, transfer format, etc., is changed, the TE and RE bits must be cleared to 0
before making the change. When the TE bit is cleared to 0, the TDRE flag is set to 1. Note that
clearing the RE bit to 0 does not initialize the contents of the RDRF, PER, FER, and ORER flags,
or the contents of RDR. When the external clock is used in asynchronous mode, the clock must be
supplied even during initialization.
Wait
<Initialization completed>
Start of initialization
Set data transfer format in
SMR and SCMR
[1]
Set CKE1 and CKE0 bits in SCR
(TE, RE bits 0)
No
Yes
Set value in BRR
Clear TE and RE bits in SCR to 0
[2]
[3]
Set TE and RE bits in
SCR to 1, and set RIE, TIE, TEIE,
and MPIE bits
[4]
1-bit interval elapsed?
[1] Set the clock selection in SCR.
Be sure to clear bits RIE, TIE,
TEIE, and MPIE, and bits TE and
RE, to 0.
When the clock is selected in
asynchronous mode, it is output
immediately after SCR settings are
made
.
[2] Set the data transfer format in SMR
and SCMR.
[3] Write a value corresponding to the
bit rate to BRR. (Not necessary if
an external clock is used.)
[4] Wait at least one bit interval, then
set the TE bit
or RE bit in SCR to 1.
Also set the RIE, TIE, TEIE, and
MPIE bits.
Setting the TE and RE bits enables
the TxD and RxD pins to be used.
Figure 15.5 Sample SCI Initialization Flowchart