LIN bus API (LINlib)


The LINlib library is used to interact with the LIN bus. Similar to the CAN bus API (CANlib), it holds functions to set bus parameters, go bus on/off and read/write LIN messages.

Using the LIN Bus

Using the LIN bus requires special hardware, e.g. Kvaser Leaf Professional LIN, Kvaser Hybrid 2xCAN/LIN or Kvaser Hybrid Pro 2xCAN/LIN.

The CAN API calls are not directly suitable for the LIN bus. Instead, a new API is provided that enables you to use the LIN bus as easily as you use the CAN bus. The function calls in the LIN API all have names starting with lin, e.g linReadMessage().

You will need to

#include linlib.h

in your programs, and link with linlib.dll (which, in turn, uses canlib32.dll).
On Linux, the files are called and respectively.

LIN Frame Identifiers

LIN frame identifiers range from ID 0x00 to 0x3F. IDs 0x3E and 0x3F are reserved for future use.

IDs 0x3C and 0x3D are used for diagnostics frames and behave somewhat differently compared to the regular frames.
0x3C is called the master request frame and 0x3D is called the slave response frame.
Diagnostic frames should contain eight bytes of data and use the classic checksum (even if LIN_ENHANCED_CHECKSUM is specified).
0x3D is single shot and its slave message buffer is automatically cleared upon reception of a 0x3C or 0x3D.

Where to go from here

For more details, see the module LINlib.