English
Language : 

SAM4L Datasheet, PDF (598/1185 Pages) ATMEL Corporation – ATSAM ARM-based Flash MCU
ATSAM4L4/L2
– This error is generated if no valid message appears within the TFrame_Maximum
time frame slot, while the USART is expecting a response from another node
(NACT=SUBSCRIBE).
• Checksum Error (CSR.LINCE)
– This error is generated if the received checksum is wrong. This error can only be
generated if the checksum feature is enabled (CHKDIS=0).
• Identifier Parity Error (CSR.LINIPE)
– This error is generated if the identifier parity is wrong. This error can only be
generated if parity is enabled (PARDIS=0).
• Inconsistent Sync Field Error (CSR.LINISFE)
– This error is generated in slave mode if the Sync Field character received is not
0x55. Synchronization procedure is aborted.
• Bit Error (CSR.LINBE)
– This error is generated if the value transmitted by the USART on Tx differs from the
value sampled on Rx. If a bit error is detected, the transmission is aborted at the
next byte border.
24.6.11 LIN Frame Handling
24.6.11.1
Master Node Configuration
• Configure the baud rate by writing to BRGR.CD and BRGR.FP
• Configure the frame transfer by writing to the LINMR fields NACT, PARDIS, CHKDIS,
CHKTYPE, DLM, FSDIS, and DLC
• Select LIN mode and master node by writing 0xA to MR.MODE
• Write a one to CR.TXEN and CR.RXEN to enable both transmitter and receiver
• Wait until CSR.TXRDY is one
• Send the header by writing to LINIR.IDCHR
The following procedure depends on the LINMR.NACT setting:
• Case 1: LINMR.NACT is 0x0 (PUBLISH, the USART transmits the response)
– Wait until CSR.TXRDY is one
– Send a byte by writing to THR.TXCHR
– Repeat the two previous steps until there is no more data to send
– Wait until CSR.LINTC is one
– Check for LIN errors
• Case 2: LINMR.NACT is 0x1 (SUBSCRIBE, the USART receives the response)
– Wait until CSR.RXRDY is one
– Read RHR.RXCHR
– Repeat the two previous steps until there is no more data to read
– Wait until CSR.LINTC is one
– Check for LIN errors
• Case 3: LINMR.NACT is 0x2 (IGNORE, the USART is not concerned by a response)
– Wait until CSR.LINTC is one
– Check for LIN errors
42023C–SAM–02/2013
598