beautypg.com

Renesas SH7781 User Manual

Page 1123

background image

21. Serial Communication Interface with FIFO (SCIF)

Rev.1.00 Jan. 10, 2008 Page 1093 of 1658

REJ09B0261-0100

(6)

Transmitting and Receiving Serial Data Simultaneously (Clocked Synchronous Mode)

Figure 21.21 shows a sample flowchart for transmitting and receiving data simultaneously.

Use the following procedure for the simultaneous serial transmission/reception of serial data, after
enabling the SCIF transmission/reception.

Read receive data in SCFRDR, and
clear RDF flag in SCFSR to 0

Write transmit data to SCFTDR, and
clear TDFE flag in SCFSR to 0

Start of transmission and reception

Initialization

Read TDFE flag in SCFSR

TDFE = 1 ?

Read ORER flag in SCLSR

ORER = 1 ?

Read RDF flag in SCFSR

RDF = 1 ?

All data received?

Clear TE and RE bits in SCSCR to 0

End of transmission and reception

[1] SCIF initialization:
See Sample SCIF Initialization Flowchart in figure

21.16.

[2] SCIF status check and transmit data write:
Read SCFSR and check that the TDFE flag is set to 1,

then write transmit data to SCFTDR, and clear the
TDFE flag to 0. The transition of the TDFE flag from 0
to 1 can also be identified by a TXI interrupt.

[3] Receive error handling:
Read the ORER flag in SCLSR to identify any error,

perform the appropriate error handling, then clear the
ORER flag to 0. Reception cannot be resumed while
the ORER flag is set to 1.

[4] SCIF status check and receive data read:
Read SCFSR and check that RDF = 1, then read the

receive data in SCFRDR, and clear the RDF flag to 0.
The transition of the RDF flag from 0 to 1 can also be
identified by an RXI interrupt.

[5] Serial transmission and reception continuation

procedure:

To continue serial transmission and reception, read

RDF flag and SCFRDR, and clear the RDF flag to 0
before receiving the MSB in the current frame.
Similarly, read 1 from the TDFE flag to confirm that
writing is possible before transmitting the MSB in the
current frame. Then write data to SCFTDR and clear
the TDFE flag to 0.

Note: When switching from a transmit operation or receive

operation to simultaneous transmission and reception
operations, clear the TE and RE bits to 0, and then set
them simultaneously to 1.

[1]

[2]

[3]

[4]

[5]

Yes

Yes

Yes

Yes

No

No

No

No

Error handling

Figure 21.21 Sample Flowchart for Transmitting/Receiving Serial Data