Development tool for CAN bus simulation
Most of automotive projects need to have an access to the Controller Area Network (CAN) bus. There are plenty of commercial frameworks that provides CAN stacks and hardware/software tools necessary to develop proper CAN networks. They are very comprehensive and thus expensive. CANdevStudio aims to be cost-effective replacement for CAN simulation software. It can work with variety of CAN hardware interfaces (e.g. Microchip, Vector, PEAK-Systems) or even without it (vcan and cannelloni) . CANdevStudio enables to simulate CAN signals such as ignition status, doors status or reverse gear by every automotive developer. Thanks to modularity it is easy to implement new, custom features.
Checkout CANdevStudio on YouTube
Access to CAN bus is based on Qt framework. Current list of supported CAN interfaces can be found here.
Current list of devices compatible with SocketCAN (Linux only) can be found here.
CANdevStudio project uses GitHub Actions as continuous integration environment. You can check build.yml for details.
To lower maintenance effort and allow for usage of modern C++ features, since v1.2.0 CANdevStudio dropped "official" support for legacy compilers like gcc5.3, vs2015 or MinGW. Current CI configuration uses the latest compilers available for each GitHub Actions environment:
sudo apt install qtbase5-dev libqt5serialbus5-dev libqt5svg5-dev qtdeclarative5-dev
git clone https://github.com/GENIVI/CANdevStudio.git
cd CANdevStudio
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make
cd CANdevStudio/build
rm -rf *
export CC=clang
export CXX=clang++
cmake ..
make
If CMake failed to find Qt in your system:
cd CANdevStudio/build
rm -rf *
cmake .. -DCMAKE_PREFIX_PATH=/home/genivi/Qt5.12.0/5.12.0/gcc_64
make
git clone https://github.com/GENIVI/CANdevStudio.git
cd CANdevStudio
git submodule update --init --recursive
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 16 2019" -A x64
cmake --build .
brew install qt5 cmake ninja
git clone https://github.com/GENIVI/CANdevStudio.git
cd CANdevStudio
git submodule update --init --recursive
cmake -S. -Bbuild -GNinja -DCMAKE_PREFIX_PATH=$(brew --prefix qt5)/lib/cmake
cd build
ninja
Each GitHub Actions job stores prebuilt packages for 90 days. Additionally official releases are stored on GitHub Releases page.
CANdevStudio-X.Y.ZZZZZZZ-SYS[-standalone]
X - major version number of previous stable version
Y - minor version of previous stable version
Z - SHA commit ID
SYS - either win64, Linux or Darwin
standalone - bundle version that contains Qt libraries and all relevant plugins.
All packages are being built on ubuntu-latest environment. Refer to this page to determine the exact Ubuntu version. You may experience problems with missing or incompatible libraries when trying to run the package on other distros.
To run standalone version use CANdevStudio.sh script.
Install AUR package: candevstudio-git
Packages built with Visual Studio 2019.
Standalone version contains Qt. Installation of VS2019 redist packages may be still required.
Package is a DMG installer.
General instructions to start your first simulation:
Steps required to use specific CAN hardware or virtual interfaces require some additional steps listed in following sections.
The list below shows hardware that has been successfully used with CANdevStudio.
ip link
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up
sudo ip link set can0 type can termination 1
sudo ip link set can0 type can termination 120
CanDevice backend: socketcan
Configuration:
sudo slcand -o -c -s8 -S1000000 /dev/ttyUSB0 can0
sudo ip link set can0 up
CanDevice backend: socketcan
CanDevice settings example:
backend: peakcan
interface: usb0
configuration: BitRateKey = 250000
CanDevice settings example for PEAK-PCAN:
backend: passthrucan
configuration: BitRateKey = 250000
interface: PCANPT32
CanDevice settings example for SIE_CANUSB:
backend: passthrucan
configuration: BitRateKey = 250000
interface: CANUSB
CanDevice settings example for Kvaser USBcan:
backend: passthrucan
configuration: BitRateKey = 250000
interface: J2534 (kline) for Kvaser Hardware
CANdevStudio can be used without actual CAN hardware thanks to Linux's built-in emulation.
Configuration:
sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
CanDevice backend: socketcan
A SocketCAN over Ethernet tunnel. Available for Linux only.
Let's consider setup as before:
Target configuration:
sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
cannelloni -I can0 -R 192.168.0.1 -r 30000 -l 20000
PC configuration:
Target configuration:
sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
cannelloni -I can0 -R 192.168.0.1 -r 30000 -l 20000
PC configuration:
sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
cannelloni -I can0 -R 192.168.0.2 -r 20000 -l 30000
As of v1.1 CANdevStudio supports creation of QML based scripts. Scripts can be developed and loaded dynamically without a need to restart the main applications. Scripting adds a lot of different possibilities to CANdevStudio that includes:
Try it yourself by loading one of the examples into QMLExecutor component. You are welcome to share your scripts via Pull Requests!
CANdevStudio provides support for CAN signals handling. DBC database description format is supported. Reverse engineered DBC files can be found in opendbc project.
Support for others CAN database formats can be added via extension of CANdb.
CanDevice component can be configured using "configuration" property:
E.g.
BitRateKey=100000;ReceiveOwnKey=false;LoopbackKey=true
CanRawFilter component enables to filter (i.e. accept or drop) incoming and outgoing frames:
Examples:
222|333
^[23]..$
^$
^.{4}$
cd build
cmake .. -DWITH_TOOLS=ON
make
./tools/templategen/templategen -n MyNewComponent -o ../src/components -g
cmake ..
make