The following list details the
configuration steps that software can perform prior to the transmission or reception
of data in LIN mode. As long as the SWnRST bit in the SCIGCR1 register is cleared to
0 the entire time that the LIN is being configured, the order in which the registers
are programmed is not important.
- Enable LIN by setting RESET bit
(SCIGCR0.0).
- Clear SWnRST to 0 before
configuring the LIN (SCIGCR1.7).
- Enable the LINRX and LINTX pins by setting the RXFUNC and TXFUNC bits.
- Select LIN mode by programming
the LINMODE bit (SCIGCR1.6).
- Select master or slave mode by
programming the CLOCK bit.
- Select the desired frame format
(checksum, parity, length control) by programming SCIGCR1.
- Select multibuffer mode by
programming MBUFMODE bit (SCIGCR1.10).
- Select the baud rate to be used
for communication by programming BRSR.
- Set the maximum baud rate to be
used for communication by programming MBRSR.
- Set the CONT bit to make LIN not
halt for an emulation breakpoint until the LIN current reception or transmission
is complete (this bit is used only in an emulation environment).
- Set LOOPBACK bit (SCIGCR1.16) to
connect the transmitter to the receiver internally if needed (this feature is
used to perform a self-test).
- Select the receiver enable RXENA
bit (SCIGCR1.24), if data is to be received.
- Select the transmit enable TXENA
bit (SCIGCR1.25), if data is to be transmitted.
- Select the RXIDMASK and the
TXIDMASK fields in the LINMASK register.
- Set SWnRST (SCIGCR1.7) to 1 after
the LIN is configured.
- Receive or Transmit data (see
Section 27.3.1.9, Section 27.3.5.1, and Section 27.3.5.2).
Note: If TXENA is set and the SWnRST is released, the LIN will immediately generate a new
DMA request but not a new
transmit interrupt request. If using interrupts, the first transmission must be
started with software by writing data to the transmit buffer, followed by writing
the chosen ID to the LINID register to initiate the transmission.