R01UH0823EJ0100 Rev.1.00
Page 1048 of 1823
Jul 31, 2019
RX23W Group
33. Serial Communications Interface (SCIg, SCIh)
33.5.6
Simultaneous Serial Data Transmission and Reception (Clock Synchronous
Mode)
shows a sample flowchart for simultaneous serial transmit and receive operations in clock synchronous
mode.
After initializing the SCI, the following procedure should be used for simultaneous serial data transmit and receive
operations.
To switch from transmit mode to simultaneous transmit and receive mode, check that the SCI has finished transmission
by reading that the TEND flag in the SSR register is 1, and then initialize the SCR register. Then set the TIE, RIE, TE,
and RE bits in the SCR register to 1 simultaneously by a single instruction.
To switch from receive mode to simultaneous transmit and receive mode, check that the SCI has finished reception, and
then set the RIE and RE bits to 0. Then check that the receive error flags (ORER, FER, and PER in the SSR register) are
0, and then set the TIE, RIE, TE, and RE bits in the SCR register to 1 simultaneously by a single instruction.
Figure 33.32
Example Flowchart of Simultaneous Serial Transmission and Reception in Clock Synchronous
Mode
Yes
End
No
Initialization
Start data transmission/reception
Error processing
Read receive data in RDR
No
Yes
SSR.ORER = 1
All data received?
No
Yes
TXI interrupt
Write transmit data to TDR
No
Yes
RXI interrupt
Read ORER flag in SSR
Clear TIE, RIE, TE, RE, and TEIE
bits in SCR to 0
[ 1 ]
[ 2 ]
[ 3 ]
[ 4 ]
[ 5 ]
[ 1 ]
SCI initialization:
The TXDn pin can act as the output pin for
transmitted data and the RXDn pin can act as the
input pin for received data at the same time.
[ 2 ]
Transmit data write:
Write transmit data to TDR once in the TXI
interrupt handling routine.
[ 3 ]
Receive error processing:
If a receive error occurs, read the ORER flag in
the SSR register, perform the relevant error
processing, and then set the ORER flag to 0.
Data reception cannot be resumed while the
ORER flag is 1.
[ 4 ]
Reading receive data:
Read the receive data in the RDR register once in
the RXI interrupt request handling routine.
[ 5 ]
Serial transmission/reception continuation
procedure:
To continue serial transmission and reception,
before the MSB (bit 7) of the current frame is
received, finish reading the receive data in the
RDR register by the RXI interrupt. Also, before
the MSB (bit 7) of the current frame is transmitted,
write data to the TDR register by the TXI interrupt.
Transmit data can also be written to the TDR
register by activating the DMAC or DTC by a
transmit data empty interrupt (TXI) request.
Similarly, the RDR data can also be read by
activating the DMAC or DTC by a receive data full
interrupt (RXI) request.
Note:
When switching from transmit or receive operation to simultaneous transmit and receive operations first set
the TIE, RIE, TE, RE, and TEIE bits in SCR to 0, and then set TIE, RIE, TE, and RE bits to 1 simultaneously.