
NUC126
Aug. 08, 2018
Page
875
of 943
Rev 1.03
NUC12
6 S
E
RI
E
S
T
E
CH
NI
CA
L R
E
F
E
RE
NCE
MA
NUA
L
2
Generated by Hardware Generated by Hardware
Generated by Hardware
(But Software needs to fill ID to PID
(UART_LINCTL[31:24]) first)
Table 6.23-11 LIN Header Selection in Master Mode
When UART is operated in LIN data transmission, LIN bus transfer state can be monitored by
hardware or software. User can enable hardware monitoring by setting BITERREN (UART_LINCTL
[12]) to “1”, if the input pin (UART_RX) state is not equal to the output pin (UART_TX) state in LIN
transmitter state that hardware will generate an interrupt to CPU. Software can also monitor the LIN
bus transfer state by checking the read back data in UART_DAT register. The following sequence is a
program sequence example.
The procedure without software error monitoring in Master mode:
1.
Fill Protected Identifier to PID (UART_LINCTL[31:24]).
2.
Select the hardware transmission header field including “break field + sync field + protected
identifier field” by setting HSEL (UART_LINCTL [23:22]) to “10”.
3. Set SENDH (UART_LINCTL[8]) bit to 1 for requesting header transmission.
4. Wait until SENDH (UART_LINCTL[8]) bit cleared by hardware.
5. Wait until TXEMPTYF (UART_FIFOSTS[28]) set to 1 by hardware.
Note1:
The default setting of break field is 12 dominant bits (break field) and 1 recessive bit
break/sync delimiter. Setting BRKFL (UART_LINCTL [19:16]) and BSL (UART_LINCTL[21:20]) to
change the LIN break field length and break/sync delimiter length.
Note2:
The default setting of break/sync delimiter length is 1-bit time and the inter-byte spaces default
setting is also 1-bit time. Setting BSL (UART_LINCTL[21:20]) and DLY(UART_TOUT[15:8]) can
change break/sync delimiter length and inter-byte spaces.
Note3:
If the header includes the “break field, sync field and frame ID field”, software must fill frame ID
to PID (UART_LINCTL[31:24]) before trigger header transmission (setting the SENDH
(UART_LINCTL[8]). The frame ID parity can be generated by software or hardware depending on
IDPEN (UART_LINCTL[9]) setting. If the parity generated by software with IDPEN (UART_LINCTL[9])
is set to ‘0’, software must fill 8 bit data (include 2 bit parity) in this field. If the parity generated by
hardware with IDPEN (UART_LINCTL[9]) is set to ‘1’ , software fill ID0~ID5 and hardware calculates
P0 and P1.
The procedure with software error monitoring in Master mode:
1.
Choose the hardware transmission header field to only include “break field” by setting HSEL
(UART_LINCTL [23:22])] to ‘00’.
2. Enable break detection function by setting BRKDETEN (UART_LINCTL[10]).
3. Request break + break/sync delimiter transmission by setting the SENDH (UART_LINCTL[8]).
4. Wait until the BRKDETF (UART_LINSTS[8]) flag is s
et to “1” by hardware.
5. Request sync field transmission by writing 0x55 into UART_DAT register.
6.
Wait until the RDAIF (UART_INTSTS[0]) is set to “1” by hardware and then read back the
UART_DAT register.
7. Request header frame ID transmission by writing the protected identifier value to UART_DAT
register.
8.
Wait until the RDAIF (UART_INTSTS[0]) is set to “1” by hardware and then read back the
UART_DAT register.
LIN Break and Delimiter Detection