
NUC970 Technical Reference Manual
Publication Release Date: Dec. 15, 2015
- 427 -
Revision V1.30
NUC97
0
T
E
CHNIC
A
L
RE
F
E
RE
N
CE
MA
NUA
L
LIN Master Mode
The UART controller supports LIN master mode. In LIN mode, each byte field is initialed by a
start bit with value zero (dominant), followed by 8 data bits (WLS(UA_LCR[1:0]) = 11) and no parity bit,
LSB is first and ended by 1 stop bit (NSB(UA_LCR[2]) = 1) with value one (recessive) in accordance
with the LIN standard. In LIN master mode, software may need some initial process, and the
initialization process flow of LIN master is shown as follows:
1. Select the desired baud-rate by setting the UA_BAUD register.
2. Select LIN function mode by setting UA_FUN_SEL register.
3. Configure the data length to 8 bits by setting (WLS(UA_LCR[1:0]) = 11) and disable parity check by
clearing PBE(UA_LCR[3]) bit and configure the stop bit to 1 by clearing NSB(UA_LCR[2]) bit in
UA_LCR register.
A complete header consists of a break field and sync field followed by a frame identifier (frame
ID). The UART controller can be selected header sending by three header selected mode. The header
selected mode can be “break field” or “break field and sync field” or “break field, sync field and frame
ID field” by setting LIN_HEAD_SEL(UA_LIN_CTL[23:22]).
(1).
If the header selected is “break field”, software must handle the following sequence to sending a
complete header to bus by filled sync data (0x55) and frame ID data to UA_THR register.
(2).
If the header selected is “break field and sync field”, software must handle the sequence to
sending a complete header to bus by filled frame ID data to UA_THR register.
(3). I
f the header selected is “break field, sync field and frame ID field”, hardware will control the
header sending sequence automatically but software must filled frame ID data to
LIN_PID(UA_LIN_CTL[31:25]).
When operating in header selected is “break field, sync field and frame ID field” mode, the
frame ID parity bit can be calculated by software or hardware depending on the
LIN_IDPEN(UA_LIN_CTL[9]) bit setting.
When operating in LIN data transmission, software can monitor the LIN bus transfer state by
hardware or software. User can enable hardware monitoring by setting BIT_ERR_EN
(UA_LIN_CTL[12]), and when operating in LIN transmitter state, if the input pin (SIN) state is not equal
to the output pin (SOUT) state that the hardware wills generator an interrupt to CPU. User also can
monitor the LIN bus transfer state by check the read back data in UA_RBR register. The following
sequence is a program sequence example:
Procedure without software error monitoring in master mode:
1. Choose the hardware transmission header field by setting LIN_HEAD_SEL(UA_LIN_CTL[23:22]]).
2. Request header transmission by setting the LIN_SHD(UA_LIN_CTL[8]) bit.
3. Wait for the TE_FLAG(UA_FSR[28]) flag.
Note1:
The break + delimiter default setting is 13 dominant bits and 1 delimiter bit, software can
change it by setting LIN_BKFL(UA_LIN_CTL[19:16]) and LIN_BS_LEN(UA_LIN_CTL[21:20]), to
change the dominant bits.
Note2:
The break/sync delimiter length default setting is 1 bit time and the inter-byte space is 1 bit
time, software can change it by setting LIN_BS_LEN(UA_LIN_CTL[21:20]) and DLY(UA_TOR[15:8]).