20.7.8
Sample Flowcharts for UART2, UART3 in LIN
Communication (Operation Mode 3)
This section contains sample flowcharts for UART2, UART3 in LIN communication.
■ UART2, UART3 as Master Device
START
Initial setting :
Set operation mode 3
Serial data output enabled
Baud rate setting
Synch break length setting
TXE=1, TIE=0
RXE=1, RIE=1
Send Message?
YES
RXE=0
Synch break interrupt enabled
Synch break transmission :
ECCR2/ECCR3 : LBR=1
Synch field transmission :
TDR2/TDR3=55
H
LBD=1
Synch break interrupt
Reception enabled
LBD=0
Synch break interrupt disabled
RDRF=1
Reception interrupt
*1
Synch field reception
Identify field set : TDR2/TDR3=ID
RDRF=1
Reception interrupt
*1
ID field reception
*1: Perform an error processing when an error has occurred.
*2: • If FRE and ORE bits are "1", write "1" to the CRE bit in the SCR to clear the error flag.
• If LBD bit in the ESCR is "1", execute UART reset.
Note: Perform the error detection in each process and give proper care.
Figure 20.7-18 UART2, UART3 LIN Master Flow Chart
NO
Wake up?
NO
(80
reception)
H
*1
YES
*1
YES (reception)
Data field reception?
RDRF=1
Reception interrupt
Data 1 reception
RDRF=1
Reception interrupt
Data N reception
Without error
YES
CHAPTER 20 UART2, UART3
NO (transmission)
Transmission data 1 set :
TDR2/TDR3=Data 1
Transmission interrupt
enabled
TDRE=1
Transmission interrupt
Transmission data N set :
TDR2/TDR3=Data N
Transmission interrupt
disabled
RDRF=1
Reception interrupt
*1
Data 1 reception
Data 1 reading
RDRF=1
Reception interrupt
*1
Data N reception
Data N reading
*2
NO
Error processing
399