
M0A21/M0A23 Series
May 06, 2022
Page
436
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
Start
bit
LSB
(bit 0)
(bit 1)
(bit 2)
(bit 3)
(bit 4)
(bit 5)
MSB
(bit 7)
(bit 6)
Stop
bit
Byte field
LIN Bus
Figure 6.11-18 Structure of LIN Byte
LIN Master Mode
The UART Controller supports LIN Master mode. To enable and initialize the LIN Master mode, the
following steps are necessary:
1. Set the UART_BAUD register to select the desired baud rate.
2.
Set WLS (UART_LINE[1:0]) to ‘11’ to configure the word length with 8 bits, clearing PBE
(UART_LINE[3]) bit to disable parity check and clearing NSB (UART_LINE[2]) bit to configure
with one stop bit.
3. Set FUNCSEL (UART_FUNCSEL[2
:0]) to ‘001’ to select LIN function mode operation.
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 modes. 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 HSEL (UART_LINCTL[23:22]). If the selected header is “break field”, software must handle the
following sequence to send a complete header to bus by filling sync data (0x55) and frame ID data to
the UART_DAT register. If the selected header is “break field and sync field”, software must handle the
sequence to send a complete header to bus by filling the frame ID data to UART_DAT register, and if
the selected header 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 PID (UART_LINCTL[31:24]).
When operating in header selected mode in which
the selected header is “break field, sync field and
frame ID field”, the frame ID parity bit can be calculated by software or hardware depending on whether
the IDPEN (UART_LINCTL[9]) bit is set or not.
HSEL
Break Field
Sync Field
ID Field
0
Generated by Hardware Handled by Software
Handled by Software
1
Generated by Hardware Generated by Hardware Handled by Software
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.11-12 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 fie
ld 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.