项目作者: karlding

项目描述 :
CAN DBC file for the Tritium WaveSculptor 20 motor controller
高级语言: Shell
项目地址: git://github.com/karlding/wavesculptor-20-dbc.git
创建时间: 2018-10-16T04:15:59Z
项目社区:https://github.com/karlding/wavesculptor-20-dbc

开源协议:MIT License

下载


Tritium WaveSculptor 20 CAN DBC

Build Status

A CAN DBC file for the Tritium WaveSculptor 20 motor controller.

Note: This assumes that your motor controller has a base address of
0x80 (the Device Identifier 0x4 shifted left by 5). If this is not the
case, just edit the addresses to match your configuration.
Kvaser Database Editor is a pretty
good option for a free DBC GUI editor.

The CAN Frame ID format (using 11-bit CAN IDs) is as follows:

  1. +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  2. | x | x | x | x | x | d | d | d | d | d | d | m | m | m | m | m |
  3. +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  4. 0xf 0xe 0xd 0xc 0xb 0xa 0x9 0x8 0x7 0x6 0x5 0x4 0x3 0x2 0x1 0x0
  5. m = Message ID
  6. d = Device ID
  7. x = unused

Requirements

These instructions use eerimoq/cantools
over SocketCAN to decode messages with the DBC. If you’re using PCAN-Explorer
or something similar, feel free to ignore those steps/requirements and
directly import the DBC.

  1. # Ensure that can-utils is installed
  2. sudo apt-get update
  3. sudo apt-get install can-utils
  4. # Start the slcand userspace daemon and create slcan0 interface
  5. # We assume 500 kbps bitrate, see (https://elinux.org/Bringing_CAN_interface_up)
  6. sudo slcand -o -c -s6 /dev/ttyUSB0 slcan0
  7. # Bring up the SocketCAN interface
  8. sudo ifconfig slcan0 up
  9. # Install cantools (either in a virtualenv or something).
  10. pip install cantools

Usage

  1. # View the DBC file
  2. cantools dump dbc/wavesculptor_20.dbc
  3. # Decode CAN messages with the DBC
  4. candump slcan0 | cantools decode --single-line dbc/wavesculptor_20.dbc

I’ve included a demo with some data collected using candump.

  1. # Load kernel modules and stuff
  2. sudo modprobe can
  3. sudo modprobe can_raw
  4. sudo modprobe vcan
  5. # Bring up vcan interface
  6. sudo ip link add dev vcan0 type vcan
  7. sudo ip link set up vcan0
  8. # Check to make sure we can see the interface
  9. ip link show vcan0
  10. # Replay data out on vcan0
  11. canplayer -I examples/candump-2019-01-09_224207.log vcan0=slcan0
  12. # Decode the data
  13. candump vcan0 | cantools decode --single-line dbc/wavesculptor_20.dbc
  14. # Or we can monitor the data
  15. cantools monitor --single-line dbc/wavesculptor_20.dbc