https://github.com/sufst/can-defs
Common definitions of messages on the CAN bus and various associated utility scripts
https://github.com/sufst/can-defs
can dbc
Last synced: 4 months ago
JSON representation
Common definitions of messages on the CAN bus and various associated utility scripts
- Host: GitHub
- URL: https://github.com/sufst/can-defs
- Owner: sufst
- License: gpl-3.0
- Created: 2022-12-18T15:52:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-05T04:21:26.000Z (7 months ago)
- Last Synced: 2025-12-08T11:58:49.057Z (7 months ago)
- Topics: can, dbc
- Language: C
- Homepage:
- Size: 232 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CAN Definitions
This repository defines the messages on the CAN bus in the car in the form of
a DBC database and provides various utilities for generating system
configuration files and source code from its contents.
## Using Generated Configurations
Generated configurations are stored in this repository in the `/out` folder.
Configurations are version controlled so that we can ensure each part of the
system is referring to the same configurations.
To use the generated configuration in a project, add this repo as a submodule.
For example:
```sh
cd
git submodule add https://github.com/sufst/can-defs
```
Note that the use of submodules will require the following commands to be run
when cloning a project for the first time:
```sh
git submodule init
git submodule update
```
For more information on submodules, see the [Git submodule documentation](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
## DBC Files
[DBC](https://www.csselectronics.com/pages/can-dbc-file-database-intro) ("Data
Base CAN") is an industry standard file format for defining the content of
messages on a CAN bus. Many device vendors provide DBC files for the CAN traffic
generated by their devices.
STAG 9 has two CAN buses:
1. CAN-C ("critical systems") bus.
2. CAN-S ("sensor/non-critical systems") bus.
There are many tools for working with DBC files. We suggest the use of
[Vector CANdb++](https://www.vector.com/int/en/products/products-a-z/software/candb/)
which can be downloaded for free as part of the demo version of
[Vector CANAnalyzer](https://www.vector.com/int/en/know-how/can/?gclid=CjwKCAiAr4GgBhBFEiwAgwORrSS5noGQYSs2JXWZldSavdWmvrEMF7twi48yqAelNUjuDMdQizQXYxoCqrMQAvD_BwE)
(Windows only). Note also that DBC files can often be imported by CAN datalogger configuration
software. We can use this for our MoTeC L120 datalogger to automatically
configure the parsing and logging of CAN data.
## Telemetry System GENerator (TSGEN)
### About
TSGEN is a Python module which generates various parts of the telemetry system
based on the DBC for the car. This includes:
- The telemetry and sensor schema for the [intermediate server](https://github.com/sufst/intermediate-server).
- C source code for unpacking CAN messages using the [`cantools` module](https://pypi.org/project/cantools/),
which will be used in the on-car telemetry system.
- Parts of the embedded code for on-car telemetry.
The output of this generator is the `/out` folder, the contents of which can be used by other repositories by including this repository as a submodule.
> Do not edit the `/out` folder directly. If changes are needed, the generator
code must be modified.
### Setup
Install the dependencies in `tsgen/requirements.txt` to your chosen Python
environment.
### Usage
From the command line:
```sh
python -m tsgen
```
### Releases
After a new set of configurations are generated, the corresponding commit to `main` should be tagged with a new version number:
```sh
git tag v1.1.2
git push --tags
```
Other repos using the generated outputs should be updated to the latest release **at the same time** to ensure they are using the same definitions.