hexLIN USB LIN-BUS adapter with db9 connector

1   Improving Car Development with Open Source Tools

#

All new cars are shipped with open source software, so why not extend the use of open source to the tools used in development as well? Open source delivers the freedom to modify: This is essential for research and development: making changes, finding bugs, testing things.

 

hexLIN Linux LIN USB connected to a car, showing wireshark trace of LIN frames

 

Adopting open source means better profits through cost-saving opportunities. But more than that, an access to a strong technical community can provide valuable insights. It also offers an enriching personal experience through the ability to learn, grow, and contribute to the development of innovative solutions.

There is so much potential for open source tools to empower developers to meet their needs for efficiency, autonomy, and innovation.

At hexDEV, we are building open source LIN-BUS tools.

2   LIN-BUS

#

LIN, the Local Interconnect Network (ISO 17987) is common in the automotive industry for connecting low-level devices like side mirrors, seats, ambient lights, etc.

The LIN bus is a lower-cost bus system with a subset of features of CAN. Its earlier specification (before ISO) is publicly accessible.

hexLIN USB LIN-BUS adapter, isometric and connector view

3   Open Source Tool:  hexLIN

#
  • hexLIN is a USB LIN-BUS adapter for Linux. It allows Linux systems to communicate with a LIN bus. It can be used in both master and slave mode, and is primarily intended for use in research and development. It is a prototype product and work is ongoing to improve and refine it (like getting a mainline linux kernel driver).

  • hexLIN currently uses SocketCAN for LIN, as LIN is considered a subset of CAN from a Linux kernel perspective. This means that Linux userland tools for CAN, such as canutils and wireshark, can already be used for LIN. With hexLIN, you can use LIN as easily as you can use CAN. You can send and receive data, set the bitrate, and even configure LIN slave tables. In the near future, it will also be possible to use ISOTP over LIN.

  • From a Linux kernel standpoint, there are two drivers for LIN: a glue driver and a device driver. The glue driver adapts CAN on one side while offering its LIN abstraction on the other side. The device driver makes use of this LIN abstraction and can communicate over USB with the actual hardware (the hexLIN adapter).

The documentation offers a detailed, technical understanding of the product.

hexLIN USB LIN-BUS adapter, top view

4   Open Source Tool:  hexLINSER

#

Besides our hexLIN USB LIN-BUS adapter, this UART LIN-Adapter offers a lightweight solution to equip UART devices with LIN bus capabilities, particularly suited for embedded Linux systems. It also supports:

  • 12V LIN Supply Voltage: Capable of generating a 12V supply voltage for LIN (from 5V), simplifying connectivity for bench testing and prototyping.

  • Dynamic Role Configuration: Features a GPIO-controllable master/slave mode switch.

  • Solid Foundation: Integrating a Microchip MCP2003-compatible LIN transceiver.

  • High Compatibility: Designed with a Raspberry Pi compatible connector, ensuring wide compatibility with various development boards and embedded systems.

Device Tree configuration example for enabling the UART LIN adapter:

&uart2 {
  status = "okay";
  linbus {
    compatible = "hexdev,hex-linser";
  };

};
 
hexLIN Linux LIN USB wireshark trace, LIN frames

5   "Hello World" in LIN

#
This is a minimal usage example that can be seen in action in the screenshot, it displays a trace by wireshark featuring frame checksums.
 
From LIN-id 0x01 send following 4 bytes 0xaa 0xbb 0xcc 0xdd:
   $ cansend can0 101##1aabbccdd
 
From LIN-id 0x02 send following 5 bytes 0xaa 0xbb 0xcc 0xdd 0xee:
   $ cansend can0 102##1aabbccddee
 
As master send request on LIN-id 0x03:
   $ cansend can0 103##0

hexLIN Linux LIN USB wireshark trace, LIN frames

6   Video animation: Inside LIN

#
Check out this fly by video of the hexLIN adapter: