Arduino library to add dual LIN support on SAM3X based boards with a TJA1021/TJA1027 transceiver
Switch branches/tags
Nothing to show
Clone or download
rocketjosh Merge pull request #6 from adamvoss/publicDomainExamples
Release examples into the public domain using CC0
Latest commit b8410b3 Sep 4, 2017

README.md

LIN Library

Library and examples for LIN (Local Interconnect Network) on Arduino. Developed for the Macchina M2. Can be modified for any Arduino board with UART available and any LIN slave.

Install

  1. Download the files
  2. Move the folder LIN to your Arduino Libraries

EXAMPLES

Several example sketches are included in the LIN Library to demonstrate typical usage:

  • Lin2Lin M2 acts as the Sniffer – when traffic on one LIN channel is detected, incoming data is saved and then sent to another LIN channel with no modification. Arduino Due with simple 1-bit ADC is used as Master Node on first LIN bus and Ambient Light Module is used as a slave on another LIN bus.

  • Master works with Microchip’s Ambient Light Module. User builds an array of bytes, which is the length of the message and contains packages to be send to the module. Package is built out of Control Byte (control intensity, dim and ramp functions for the RGB LED), Red, Green and Blue Color Bytes and Zone Byte. Checksum calculation is supported in v2.0 library. There is no need to calculate checksum and include in it package.

  • Slave M2 acts like sniffer: when traffic is detected on LIN bus, incoming data is saved and processed. Arduino Due with simple 1-bit ADC is used as master. Master Node needs to be programmed with Master example Slave_Master

Data processing: If Identification Byte is correct, Checksum Byte is compared with Checksum calculated from received data. If Checksum Byte is correct, data is printed on Serial Monitor via SerialUSB. Otherwise error is printed on Serial Monitor and data cleared.

  • Sniffer M2 monitors traffic on LIN bus periodically. When traffic is detected, Sniffer reads incoming data and prints it on Serial Monitor via SerialUSB.

NOTES

LIN Stack was developed using the following:

More information about LIN can be found in those documents.