Frequently Asked Question

Does Typhoon HIL supports LIN protocol?
Last Updated 2 months ago

Yes. Typhoon HIL supports the LIN protocol via the CAN-LIN gateway FRC-EP-170.

The following tutorial covers a step-by-step guide to configuring the gateway for the CAN-LIN protocol. For a complete loopback test, two gateways must be used.

All the schematic and SCADA files are attached to this knowledgebase.

1. Introduction

LIN (Local Interconnect Network) is a serial network protocol used for communication between components in vehicles. It is a single-wire, serial network protocol that supports communications up to 19.2 Kbit/s at a bus length of 40 meters. It is important to interface CAN and LIN protocols in automotive applications, and that`s where the Ixxat gateway comes into the scene.  The FRC-EP170 comes with a variety of different automotive communication interfaces. It is ideal for applications in which several bus systems are to be merged into a single device with its own processing power. 

2. LIN protocol

LIN Bus is a supplement to the CAN bus protocol. It offers lower performance and reliability, but also drastically lower costs. Following is a comparison between CAN and LIN protocols:

  • Low-cost option (if speed/fault tolerance is not critical)
  • Often used in vehicles for windows, wipers, air condition and acessories
  • LIN clusters consist of 1 master and up to 16 slave nodes
  • Single wire (and GND) with 1-20 kbit/s at max 40 m bus length
  • Time-triggered scheduling with guaranteed latency time
  • Variable data length (2, 4, 8 bytes)
  • LIN supports error detection, checksums, and configuration
  • Operating voltage of 12V
  • Physical layer based on ISO 9141 (K-line)
  • Sleep mode and wakeup support
  • Most of the recent vehicles have 10+ LIN nodes

LIN communication is relatively simple and robust. A master node loops through each of the slave nodes, sending a request for information, and each slave responds with data when polled. The data bytes contain LIN bus signals (in raw form).


Figure 1 – LIN bus nodes

In simple terms, the LIN bus message frame consists of a header and a response. Typically, the LIN master transmits a header to the LIN bus. This triggers a slave, which sends up to 8 data bytes in response.


Figure 2 – LIN Bus Frame

2.1. LIN Description File (LDF) and DBC file

For a better understanding of further concepts, the difference between LDF and DBC is spotlighted in this chapter. Figure 3 shows the main differences between those two formats.


Figure 3 – LDF vs DBC file format

A more detailed explanation of each section of the file is described below.

  • LIN ID: Which LIN frame ID contains the LIN bus signal
  • Message Name: The LIN signal name
  • Bit start: Start position of the LIN signal in the payload
  • Length: Length of the LIN bus signal
  • Endianness: LIN signals are little-endian (Intel byte order)
  • Scale: The scale factor of the decimal value of the LIN signal bits
  • Offset: LIN signal value offset value
  • Unit/Min/Max: Additional supporting information (optional)

2.2. CAN - LIN gateway implementation

In this knowledgebase tutorial, CAN to LIN and LIN to CAN bus loopback is implemented using one HIL device and two FRC-EP170 gateways. The communication between the two end nodes is controlled via Typhoon HIL SCADA. Figure 4 shows the block diagram of the connected devices:

Figure 4 – LDF vs DBC file format

The steps by which the message was mapped:

  • Slave node messages are sent by CAN1 (CAN2 for master node) on HIL 404 (other versions of HIL can also be used)
  • The message is received on Ixxat_1(Ixxat_2 for master node) Gateway CAN bus
  • Ixxat_1 maps the message to the LIN bus for slave nodes, and for the master node, the direction is reversed
  • Message is sent to Ixxat_2(Ixxat_1) Gateway via LIN bus
  • Ixxat_2(Ixxat_1) maps the message back to CAN
  • The message is received on HIL via CAN2(CAN1 for master node) bus

3. Materials and methods

To set up the LIN communication with the gateway the following materials are required:

  • PC running Typhoon HIL Control Center
  • Typhoon HIL device 404, 602+, 604 or 606
  • 2x Ixxat FRC-EP-170
  • USB A to USB B cable
  • 4x 120 ohms resistors
  • Multiple jumper wires

3.1. Pinout

Pin-out of CAN and LIN bus communication protocols is shown in figure 5.

Figure 5 – CAN and LIN wired connection

  • Red wires represent the CAN Low signal and blue wires represent the CAN High signal.
  • All devices share the same ground for communication to be valid.
  • Green wire represents LIN Signal wire.
  • Terminating resistors (120 ohms) must be placed between CAN signals for every connector.

4. Configuration of Gateways and HIL

After wiring all the devices as described in the previous chapter, the number of messages and their structure has to be defined in Typhoon HIL Schematic Editor (detailed description: CAN Bus protocol).

For signal and message mappings, Ixxat tools are required which can be obtained from Ixxat's official site:

Ixxat tools used for this tutorial:

  • Ixxat-act-setup-5.17.5436.1 CM
  • Ixxat-ixadmin-setup-2.17.2760.0
  • Ixxat VCI Setup 4.0.939.0
  • Ixxat-frc-adk-setup-1-0-77-1

After downloading and installing all the tools, the configuration has to be downloaded on all Gateways (using the Ixxat ACT tool), that configuration has to be analog with the message/signal structure that is set in Schematic Editor (same number of messages, length of the message has to be same, signal order in one message can be mapped to a different order but the type has to be the same (uint, int, real) ).

In this example, the message structure is selected from the LDF file (after installing Ixxat ACT, it is located in "Public Documents\HMS\Ixxat ACT\Examples\Vehicles\CAR_LIN_Sample.ldf").

4.1. CAR_LIN_Sample.ldf file description

  • This file represents an example of an LIN description file.
  • The structure consists of one master node “DOOR MASTER“, and two slave nodes “FRONT_LEFT“ and “FRONT_RIGHT“
  • Master polls value from slave nodes every 20 ms
  • The speed of LIN communication is set to 19.2 kbps
  • There are 3 messages “STATUS_LEFT“, “STATUS_RIGHT“, “WINDOW_COMMAND“
  • “STATUS_LEFT“ consists of 3 signals: CRC_LEFT (8 bit long, bit position 0), ALIV_LEFT(4 bit long, bit position 8), WINDOW_POSITION_LEFT(8 bit long, bit position 16)
  • Message structure of “STATUS_RIGHT“ is analog to “STATUS_LEFT“
  • “WINDOW_COMMAND“ message have two signals, “MOVE_WINDOW_LEFT“(bit length 2, bit position 0) and “MOVE_WINDOW_RIGHT“(bit length 2, bit position 2)
  • The master node sends a “WINDOW_COMMAND“ message and slave nodes respond with “STATUS_RIGHT“ and “STATUS_LEFT“messages

Figure 6 – CAR_LIN_Sample.ldf messages, signals, and nodes

Figure 7 – CAR_LIN_Sample.ldf Node attributes and schedule tables

Figure 8 – CAR_LIN_Sample.ldf Signal encoding types

4.2. Gateway configuration

Following are the configuration steps of Ixxat device “Ixxat_2”, using ACT tool:

  • Creating a new project

    Figure 9 – Creation of new project in Ixxat ACT tool

    • Choose a Target Platform

      Figure 10 – Tagret Platform Window

      • Bus Configuration

      Figure 11 – Bus configuration window

      Please note that CAN 1 (or any other communication Connector that is to be mapped) needs a Database (.dbc file for CAN mapping). To make DBC file from LDF file, the steps described in chapter XXX LIN Description File (LDF) to DBC File have to be followed. After both .dbc and .ldf files are ready, the mapping configuration can be finished.

      • Project Description

      Figure 12 – Project Description window

      The generated message structure for every Bus and every ECU can be acknowledged in the Source window (Figure 13):

      Figure 13 – Message and signals structure

      • Signal mapping

      The same message/signal structure has to be used for all mapping buses (same name, data type(uint,int,float)), although the signal order can be different.

      Figure 14 – Signal mapping

      Figure 15 – Select Destination Signal

      • Mapping window with all mapping signals

      Figure 16 – Mapping window

      • Build Configuration

      Figure 17 – Build Configuration

      • Download Configuration to the Target Device. A USB-B to USB-A cable is used to connect Ixxat_2 to the personal computer.

      Figure 18 – Download Configuration to Target Device

      • Download and Start the configuration

      Figure 19 – Download and Start Application

      Ixxat_1 is now to be connected to the personal computer with a USB cable, all steps above have to be repeated until the fifth step (note that this time LIN will be the Slave node). In the fifth step, the slave node signals from the CAN 2 bus are mapped to LIN, and master node signals are mapped from LIN to CAN 2, the mapping window looks like Figure 20.

      Figure 20 – Mapping window of Ixxat_1

      The rest of the steps are to be followed to complete configuration Ixxat_1.

      4.2. LIN Description File (LDF) to DBC File

      For the purposes of mapping LIN and CAN buses, it is necessary to create the same structure of messages and signals for both buses. One way of importing message structures in the Ixxat ACT tool is through LDF and DBC files. It is assumed that there is an LDF file, for which a corresponding DBC file should be created. To facilitate this process follow the steps:

      1. Create a new project in the Ixxat ACT tool and follow all the steps for Ixxat_2 from the "Gateway configuration“ chapter up to the seventh step (Mapp all signals from LIN to CAN_2). For this procedure, .dbc file is not necessary. It will be generated.
      2. In the project folder navigate to DeviceConfig/0 then find and open the *.dbc file
      3. *.dbc file structure should look like Figure 21

      Figure 21 – DBC file

      4. Edit the DBC file so the message is placed in the Rx/Tx group of the appropriate ECU

      5. For this particular example, the .dbc file should look like Figure 22 after the edition:

        Figure 22 – Final DBC file

        6. Save the file and open it as a Database for the appropriate CAN bus in the Ixxat ACT tool and use it to map signals

          Typhoon HIL schematic supports setting messages in send/receive CAN Bus components via DBC files. In the next few steps it will be shown how to set up one CAN Receive/Send component using dbc file, this way of setting is helpful if the dbc file is already provided.

          1. Double click on the CAN Bus Send/Receive component in Schematic Editor
          2. Choose the CANdb file as Data Input

          Figure 23 – Choose the Data input

          3. Click on Choose file option and select the DBC file

            Figure 24 – Choose the DBC file

            4. Choose the message that will be simulated on the chosen component

            Figure 25 – Select the desired message

            In the following chapter, the configuration of the CAN components in the Typhoon HIL Schematic editor will be explained so that it matches the message structure in Ixaat ACT. It will be explained how to access the settings through the dialog window.

            4.3. Configuration in Schematic Editor

            Following the CAN_LIN_Sample.ldf file, the message structure is now created in Typhoon HIL Schematic Editor, shown in Figure 26.

            Figure 26 – Schematic Editor model for the CAN-LIN-CAN gateway

            Brief description:

            • CAN Bus Send represents the Master node, and it sends a “WINDOW_COMMAND” message(which is received by slave nodes)
            • CAN Bus Receive receives messages sent by CAN Bus Send, so it shows what messages slaves received
            • CAN Bus Send1 represents the slave node and sends a “STATUS_LEFT” message
            • CAN Bus Receive1 receives messages sent by CAN Bus Send1, so it shows what message the master node received
            • CAN Bus Send2 represents the slave node and sends a “STATUS_RIGHT” message
            • CAN Bus Receive2 receives messages sent by CAN Bus Send2, so it shows what message the master node received

            The Baud Rate has to be the same for all configured devices. Default Baud Rade for Ixxat FRC-EP170 is 500kbit/s.

            Figure 27 – CAN Bus Send component configuration

            Figure 28 – CAN Bus Send1 component configuration

            Figure 29 – CAN Bus Send2 component configuration

            Figure 30 – CAN Bus Receive component configuration

            Figure 31 – CAN Bus Receive1 component configuration

            Figure 32 – CAN Bus Receive2 component configuration

            5. Manual testing with SCADA

            To test the whole hardware and software configuration, HIL SCADA is used. To open the configuration from the Schematic editor in HIL SCADA, press the “Compile and (re)load model in HIL SCADA“ button. After the SCADA window is opened, inputs and outputs are lined up like in Figure 33. If the received value is the same as the sent value (pay attention to the configuration of the bits), loopback is successfully implemented.

            Figure 33 – HIL SCADA window

            Please Wait!

            Please wait... it will take a second!