Skip to content
/ cantools Public

A collection of CLI tools for the CAN bus network

License

Notifications You must be signed in to change notification settings

mwkpe/cantools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Nov 23, 2021
700ec3a · Nov 23, 2021

History

81 Commits
Jun 17, 2018
Sep 13, 2017
Sep 13, 2017
Nov 23, 2021
Feb 25, 2021
Oct 20, 2017
Nov 8, 2017
Oct 21, 2017
Oct 18, 2017
Oct 20, 2017
Sep 11, 2017
Oct 20, 2017
Nov 2, 2017
Oct 15, 2017
Oct 15, 2017
Oct 21, 2017
Oct 18, 2017

Repository files navigation

cantools

A collection of CLI tools for receiving and transmitting CAN frames using Linux SocketCAN

Description

These tools can be used - and were developed - using a Raspberry Pi 3 with a PiCAN2 HAT.

  • cantx: one-time or cyclic transmission of a single frame
  • canprint: printing frames into the console
  • cangw: routing frames between CAN and UDP

Build

Use make to build all tools or make cangw etc.

Usage

Tool Options Short Required Default Description
cantx device
id
payload
cycle
realtime
-d
-i
-p
-c
-r





can0

00
-1 (send once)
false
CAN device
Frame ID
Hex data string
Repetition time in ms
Enable realtime scheduling policy
canprint device -d can0 CAN device
cangw listen
send
realtime
timestamp
device
ip
port
-l
-s
-r
-t
-d
-i
-p
-l-s
-l-s






false
false
can0


Route frames from CAN to UDP
Route frames from UDP to CAN
Enable realtime scheduling policy
Prefix payload with 8-byte timestamp (ms)
CAN device
IP of remote device
UDP port

Examples:

# Send frame each 100 ms
$ ./cantx --device=can0 --id=42 --data=0807060504030201 --cycle=100

# Route frames from CAN to UDP
$ ./cangw --listen --ip=192.168.1.5 --port=30001

# Same but using short options
$ ./cangw -li 192.168.1.5 -p 30001

# Route frames between interfaces and add timestamps to UDP payload
$ ./cangw -lsti 192.168.1.5 -p 30001

Acknowledgements

cxxopts for parsing command line options

About

A collection of CLI tools for the CAN bus network

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published