USB LIN Converter
LIN (Local interconnect network) USB Converter (LUC) can work with your PC without additional drivers. It creates a virtual COM port that handles LIN communication.
Features supported:
- LIN 2.1 support
- Monitor mode for all frame reception and sending single frames.
- Master mode, with up to 15 frame slots
- selectable baud rate
- Optical isolation for LIN
- External 4.5 V to 28 V is needed for the LIN network
- The device size is 31×18 mm (without a USB connector)
- Termination resistors controlled by software
- USB DFU compatible bootloader for new software
- SLCAN compatible works with LINUX socket-can and some of the CAN-utils
Drivers: For proper work on Windows, you must install virtual com drivers from the ST site or download them here.
COM port Commands
Below is a list of all available commands. USART baud rate is virtual so it can be any. All commands are in ASCI format. Commands are terminated with newline character CR (0xD). In error, the device responds with a 0x7 value.
Command | Description |
O | Opens device in master mode. |
C | Close the LIN port on the device; the frame will not be received. |
Sx | Baud rate selection: S2 – 9600 S1,S3-S8 – 19200 |
V | Get the hardware version. |
v | Get a firmware version. |
N | Get the serial number. |
L | Open the device in slave mode for LIN slave simulation. |
l | Open the device in monitor mode and message analyzer mode, with a single frame sending possibility. |
tiiildd | In Monitor mode, it transmits a full header and data frame. In Master mode, update the table set with a new frame In Slave mode, updates table set with new data 0ii: Identifier in hexadecimal format (000-0FF) l: Data length (0-8) dd: Data byte value in hexadecimal format (00-FF) |
r0iil | Monitor mode transmits the header only with a set ID and length; the subscribed slave should answer the header. In Master mode, put or update the table set with this ID for continuous sending. In Slave mode, updates table set with reception slot Proper timing is set according to LIN standards. 0ii: Identifier in hexadecimal format (000-0FF) l: Data length (0-8) |
r1ff0 | In Master mode, it starts sending frames from the table. |
r2ff0 | In Master, Slave mode clears the schedule table. |
xm | Switch checksum for classic x2 for enhanced x1 |
Example workflow for Monitor Mode
000005: C (send close command) 000006: v (ask for firmware version) 000007: v0102 (get version number from device) 000008: V (ask for hardware version) 000009: V0101 000010: N 000011: N16000000 000012: W2D00 000013: 000014: S0 (speed setting, 19200) 000015: 000016: L (open in monitor mode) 000017: 000018: r0128 (transmit header with 8 data bytes request, id 0x12) 000019: z 000020: t01280011223344556677 (slave responded for header request with 8 byte data frame)
Example workflow for Master Mode
000015: 000016: O (open in master mode) 000017: 000018: r0018 (add to schedule table frame transmission header with 8 data bytes request, id 0x01) 000019: z 000018: r0022 (add to schedule table frame transmission header with 2 data bytes request, id 0x02) 000019: z 000020: t01280011223344556677 (add to schedule table frame transmission header + data (slave task) with 8 data bytes, id 0x12) 000021: z 000022: r1ff0 (start sending frames) 000023: z
Custom frame timing
You can tweak the timing in master mode. Just type the upper letter T instead of t or R instead of r then the format is similar
T 0 id id t1 t1 t2 t2 len d0 d0 d1 d1 d2 d2
where:
id – frame id same as standard
t1 – frame offset in ms
t2 – response wait time in ms
Len – frame length
d0 …. – data
example frame with id 1 5 ms offset and 1 ms wait time after sending 3 bytes of data AA BB CC
T0005013AABBCC
Hardware
We are using ST STM32f04264 microcontroller. The device PCB is designed in ki-cad. All source files are available on GitHub here.
Software
Uploading new software
ULC has embedded a DFU USB bootloader for usage see UsbCANConverter(UCCB) project. See tutorial.
Tools
Python support
A dedicated Python library for LUC (uCANLinTools) has LDF parsing support, LIN frame (PIDs) encoding/decoding, LIN master, and slave support. See uCANLinTools for more info, source code, and examples. See here
Serial Port
You can use LUC on any operating system with a serial terminal program, for example, putty. A description of all available commands can be found in the About section. All commands are the same as for the USB-CAN converter so that all tools can be reused; see the UCAN USB-CAN converter project for libs and tools. LUC is also compatible with LINUX CAN-UTILS and SOCKET CAN. The device has its terminal written in JAVA, uCCBViewer.
UCCBViewer is a GUI program for both uCAN CAN and LIN converters. For the USB-LIN converter, uCCBViewer functionalities are frame reception, transmission, and master table setup. To run this program, Java Runtime Environment (JRE) needs to be installed. To run UCCBViewer on Linux, remember to run this program as a superuser. Sudo java -jar uCCBViewer-2.1.jar
 The newest release of UCCBViewer
Reviews
There are no reviews yet.