Code Monkey home page Code Monkey logo

cantools's Introduction

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

cantools's People

Contributors

mwkpe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.