Log LIN data

LIN is a protocol used in most automotives today, often serving as a supplement to CAN bus.

In this section we outline how to log LIN data with your CANedge.

Note

We recommend that you read our LIN intro and LDF intro before proceeding


Configure your device

In most use cases the CANedge acts as a LIN subscriber - sniffing existing LIN traffic being communicated between other LIN nodes. In such cases, you need to specify the correct bit-rate. You will most often also need to configure the ‘LIN-bus frames’ section with the length and checksum type for each LIN frame ID[1].

The bit-rate, frame lengths and checksum information can be found in the LDF (LIN Description File) for your network. Below is an example of this from our HELLA IBS case study:

frame-table-lin-bus-canedge-config

If the LIN bus has no existing LIN master (aka LIN publisher), then the CANedge can take this role. In this case you must configure the CANedge as a LIN publisher and enter your LIN schedule table in the ‘LIN-bus transmit list’ section. The LIN bus schedule can also be found in the LDF. The transmit list may consist of a mix of LIN headers (triggering data to be sent by other LIN nodes) and LIN frames including payloads (when the CANedge is to send information to other nodes). Below is an example from our HELLA IBS case study:

hella-ibs-lin-bus-transmit-list-canedge-master

Record LIN data

To log LIN data you typically need to create a custom wiring harness that matches the CANedge pin-out (see the CANedge Docs). After this, you can follow below steps:

  1. Connect the CANedge to your LIN application via the adapter cable
  2. Verify that the device turns on and logs data (CH1 LED and MEM LEDs blink)
  3. Disconnect the device from power and extract the SD card
  4. Open the MF4 in asammdf and display the raw LIN trace - it should look as below:
asammdf-lin-bus-raw-data-trace

DBC decode LIN data

To DBC decode LIN data you need the associated LDF and/or DBC file. LDF decoding is supported in e.g. the asammdf GUI natively. If you wish to visualize your LIN data in e.g. Grafana dashboards you will need to first create a DBC file. In such cases, you can follow our step-by-step guide to convert your LDF to a DBC file via canmatrix.

You can decode your data via the processing tools - we recommend to start with asammdf.

asammdf-LIN-bus-LDF-data-visualize
[1]Unless configured otherwise, the device assumes that the length of the LIN frame data payload is always defined by the message ID (bits 5 and 6 of the identifier): 00-31 (0x00-0x1F): DLC 2, 32-47 (0x20-0x2F): DLC 4, 48-63 (0x30-0x3F): DLC 8. Supports LIN 1.3 classic checksum and LIN 2.0 enhanced checksum format. By default, all frames except ID 0x3C and 0x3D use enhanced checksum.