#can #socketcan #iso-tp #isotp #iso-15762-2


A common application of ISO-TP or ISO 15762-2 is for example Unified Diagnostic Services (UDS) used in automotive ECUs for diagnostics

2 releases

0.1.1 Feb 18, 2020
0.1.0 Dec 10, 2019

#6 in #socketcan


402 lines

📦✨ socketcan-isotp

Socketcan IsoTP Rust crate

Build Status crates.io crates.io


Built with 🦀

SocketCAN ISO-TP crate. Based on socketcan-rs and isotp.h.

The Linux kernel supports using CAN-devices through a network-like API. This crate allows easy access to this functionality without having to wrestle libc calls.

ISO-TP or ISO 15762-2 allows sending data packets that exceed the eight byte of a default CAN frame. A common application of ISO-TP is for example Unified Diagnostic Services (UDS) used in automotive ECUs for diagnostics.

can-isotp is an ISO-TP kernel module that takes care of handling the ISO-TP protocol. Instructions on how the can-isotp kernel module can be build and loaded can be found at https://github.com/hartkopp/can-isotp.

use socketcan_isotp::{self, IsoTpSocket};

fn main() -> Result<(), socketcan_isotp::Error> {
    let mut tp_socket = IsoTpSocket::open(

    loop {
        let buffer = tp_socket.read()?;
        println!("read {} bytes", buffer.len());

        // print TP frame data
        for x in buffer {
            print!("{:X?} ", x);


Dev Setup

Setup Isotp Kernel Module: https://github.com/hartkopp/can-isotp

Setup virtual can interface.

sudo modprobe vcan && \
sudo ip link add dev vcan0 type vcan && \
sudo ip link set up vcan0


~41K SLoC