1. Before you start
Every parameter in this guide has a name (for example input_opt) and a 16-bit id (for example 0x0309). Both are listed in the Parameter Reference, which the Workbench opens from the help button in the parameter list. Change parameters in the Workbench parameter list, the CAN view or the text terminal (set name value, then save). A change applies at once. It survives a reboot only after it is stored to flash.
Choosing an input
| Input | Best for | Section |
|---|---|---|
| Analog (ADC1 to ADC4) | Throttle grips, pedals, potentiometers, 0-5 V signals from a PLC, analog position sensors | 2 |
| RC PWM | RC receivers, flight controllers, servo testers (1000-2000 µs pulses) | 3 |
| CAN | Vehicle networks, PLCs, multi-axis systems, anything that also needs telemetry | 4 to 12 |
| UART / USB | The Workbench and host scripts (on by default) |
Enabling inputs (input_opt)
An input only drives the motor when its bit is set in input_opt (0x0309). Add the values of the inputs you want.
| Value | Input | Notes |
|---|---|---|
| 1 | ADC1 | |
| 2 | ADC2 | |
| 4 | RC PWM | Boards with a PWM capture timer only |
| 8 | UART / USB | The default |
| 16 | Killswitch pin | Boards with a killswitch pin only; pin low blocks the motor |
| 32, 64 | CAN ADC1, CAN ADC2 | Reserved, not implemented |
| 128 | ADC1-ADC2 differential | Reserved, not implemented |
| 256 | CAN | Required for any CAN setpoint, under every protocol |
| 512 | ADC3 | Boards with four analog inputs only |
| 1024 | ADC4 | Boards with four analog inputs only |
Example: ADC1 as throttle, ADC2 as brake, plus USB for the Workbench: 1 + 2 + 8 = 11. CAN only: 256.
CAN setpoints are refused until you add 256. The default is 8 (UART only). The Dynamesys protocol answers a refused setpoint with error reason 6 (not allowed). Writing 0 to input_opt falls back to 8.
How inputs become a request
The controller reads the inputs 1000 times a second and adds them together. There is no priority between sources: two throttles at full give twice the request. Enable only the sources you really use.
The control mode (opt_cont_type, 0x0176: 0 current, 1 speed, 2 duty, 3 position, 6 voltage) sets what the sum means. A CAN command can also switch the mode (see Driving the motor over CAN).
| Mode | Analog and PWM inputs (-1 to +1) | CAN and UART |
|---|---|---|
| Current (torque) | Iq = input × par_i_max (positive) or × |par_i_min| (negative) | Current setpoints in amps are added |
| Speed | speed = input × speed_req_max_pos (positive) or × speed_req_max_neg (negative) | Speed setpoints are added |
| Duty | duty = input, clamped to ±1 | Duty setpoints are added |
| Position | Ignored | Position targets only |
| Voltage | Ignored | UART only |
With the Vehicle app (opt_app_type = 1) the controller only runs in current mode and starts in NEUTRAL. It goes to DRIVE when every input has been at rest for 10 ms and the Go to Drive input (start_input, 0x0CBB, default off) is pressed, if one is set: the brake, an analog input, RC PWM or a digital input. The Go to Neutral input (neutral_input, 0x0CBE), such as a side stand switch, holds NEUTRAL while it acts.
The throttle and the brake are smoothed: input_filter_mode (0x0CC6) 0 is Smoothed, 1 is Rate limited. input_filter (0x0CAC, default 0.1 s) is the response time as the throttle opens, input_filter_down (0x0CC7, default 0.05 s) as it is let go and for the brake. Set them in the Workbench under Setup Inputs > Vehicle, where graphs show what they do.
Top speed: speed_lim_max (0x0342, 0 = off), with the driving current fading out over speed_lim_delta (0x0343) below it. Overspeed braking, speed_lim_brake_band (0x034F, 0 = off), brakes above the top speed, fully this far above it, also with the throttle released.
Ride modes: ride_mode (0x0CCC) 1 is eco, 2 standard (default), 3 sport. Each mode takes its top speed, motor current and throttle response from the arrays ride_top_speed, ride_i_max, ride_filter_up and ride_filter_down (0x0CC8 to 0x0CCB, one value per mode); 0 uses the normal setting. A mode change applies at once and is not stored. speed_lim_now, ibat_max_now and ibat_regen_now (0x0CCD to 0x0CCF) show the limits in force.
Wheel lock: ride_mode 0 locks the vehicle. With lock_wheel (0x0CD0, default 1) the motor windings are shorted once the wheel has stood still for 1 s, so it is hard to push; never while driving. The current limit still trips the bridge. wheel_locked (0x0CD1) shows it.
current_req_min (0x0307, default 0.1 A) is the smallest current request that starts the motor.
Safety, faults and recovery
- A broken or implausible input (analog trip, PWM signal loss) raises error 27 Input. The bridge switches off and the motor coasts.
- What happens next follows
auto_clear_error(0x0C47): 0 never clears, 1 clears once every request is back at rest, 2 clears aftererror_restart_delay(0x0B18, default 500 ms), 3 either. A host can clear by writing 1 toclear_error(0x0C48). safe_start(0x0CB3, default 0) holds the motor after power-up until every throttle, RC and UART input has been at zero for 0.1 s with a valid signal (brakes do not count). With CAN as an input a zero CAN command is needed too; a host connecting stands in for it. With the Vehicle app, a throttle held at power-up is ignored until it is released.- While the controller runs motor detection, measurements, a test or a firmware update, every input is ignored.
stop(0x0C49) stops the motor.emergency_stop(0x0C4A) latches error 11 until it is released. Both clear every setpoint source.- Boards with a hardware break input (TIM1 BKIN) switch the bridge off in hardware and latch error 6. On boards where it is optional, enable it with
tim1_break_en(0x0C6A).
2. Analog inputs (ADC)
Hardware
- Every controller has ADC1. Most have ADC2. Some H7 boards (RFLX-SURGE, RFLX-ADVANCE) also have ADC3 and ADC4. Parameters for a channel only exist on boards that have it.
- Resolution: 12 bit on F405 boards, 14 bit on U5 boards, 16 bit on H7 boards.
- The firmware works in normalised units: 0.0 is 0 V and 1.0 is full scale at the connector.
adcN_rangeis that full scale in volts, set by the board's divider (usually 5 V). The Workbench uses it to show volts. - Each input is read at 1 kHz with very light filtering. The live reading is the signal
adc1toadc4. - Check your board's documentation for the connector pinout and the highest voltage the input tolerates.
Mapping a voltage to a request
Each channel goes through the same steps:
- Wire-break check. A reading below
adcN_trip_lowor aboveadcN_trip_highraises error 27. Both trips are off by default (0 and 1). Set them a little outside the real travel so a broken wire or a short is caught. - Normalise. For one-direction types,
adcN_mingives 0 andadcN_maxgives 1. Readings below min give 0, readings above max give 1. For the two-direction type,adcN_centergives 0, max gives +1 and min gives -1. A centre of 0 means halfway between min and max. - Deadband (two-direction only). Within ±
adcN_deadof the centre the result is 0. Outside it, the rest of the travel still reaches ±1. - Curve. A five-point smooth curve (
adcN_cx0..4,adcN_cy0..4) shapes the response. The default is a straight line. - Polarity. The result is multiplied by
adcN_poland clamped to ±1.
| adcN_type | Meaning | Default curve |
|---|---|---|
| 0 | One direction, positive (forward throttle) | 0 to +1 |
| 1 | One direction, negative (reverse or regen lever) | 0 to -1 |
| 2 | Two directions around a centre (joystick, wig-wag) | -1 to +1 |
| 3 | Brake (see Brake channels) | 0 to 1 brake |
Throttles whose voltage falls as they are pressed: keep adcN_min below adcN_max (min is the low voltage) and draw a falling curve, 100 % at point 0 and 0 % at point 4. A broken wire then reads as full throttle, so always set adcN_trip_low and adcN_trip_high for such a throttle.
The curve is not reset when you change adcN_type in the parameter list. The Workbench Setup Inputs window resets it for you. If you change the type elsewhere, set the curve points as well.
Parameters
Shown for ADC1. ADC2, ADC3 and ADC4 have the same set with their own ids (see the Parameter Reference).
| Name | Id | Unit | Meaning |
|---|---|---|---|
| adc1_type | 0x0C0E | 0-3 | Input type, see table above |
| adc1_min | 0x0C03 | 0-1 | Reading at zero throttle |
| adc1_max | 0x0C02 | 0-1 | Reading at full throttle |
| adc1_center | 0x0C0C | 0-1 | Rest position, two-direction type only (0 = midpoint) |
| adc1_dead | 0x0C10 | 0-0.5 | Deadband around the centre, two-direction type only |
| adc1_pol | 0x0C04 | -1 to 1 | Output multiplier |
| adc1_trip_low | 0x0C08 | 0-1 | Fault below this reading (0 = off) |
| adc1_trip_high | 0x0C09 | 0-1 | Fault above this reading (1 = off) |
| adc1_cx0..4, adc1_cy0..4 | 0x0C12-0x0C1B | -1 to 1 | Curve points |
| adc1_range | 0x0CA1 | V | Full-scale voltage at the connector, set by the board (expert) |
| adc1 | 0x0C72 | 0-1 | Signal: the reading now |
The defaults for min and max differ per controller family and are only a starting point. Calibrate every throttle.
Calibrating in the Workbench
- Open Setup Inputs and choose the channel's tab (ADC1 to ADC4, or PWM).
- Click Calibrate. The wizard switches the channel's input off (not stored) so the motor cannot move.
- Choose the type and follow the steps: rest, then full for one direction; centre, full forward, full reverse for two directions. Each Capture averages the reading for 0.8 s.
- The wizard pulls each end in a little (0.1 V, or 20 µs for PWM) so full throttle is reliably reached. It can also set the wire-break trips for you.
- Adjust the curve by dragging its points. The green dot shows the live input. The ±100 % fields set the matching current or speed limit.
- Click Save. Tick the store option to keep it after a reboot.
- Switch the input back on with Activate <channel>. The Workbench warns if the throttle is not at rest.
Brake channels
A channel with type 3 feeds the brake request instead of the throttle. Above 5 % travel it brakes against the direction of motion, up to |par_i_min|. Braking fades out at low speed: it is 0 below brake_fade_low (0x0CB1) and full above brake_fade_high (0x0CAB, default 2.0 in speed units).
- Braking only acts in current (torque) mode.
- With the Vehicle app, a brake above 5 % cuts the throttle. Without an app, the brake and the throttle are added.
- A side stand switch can be the Go to Neutral input. Reverse switches are not used yet; brake with an analog brake channel.
Analog position feedback
An analog channel can also be a position or speed sensor on the load (a potentiometer, a linear transducer, a tacho). Set fbk_pos_src (0x0529) and/or fbk_vel_src (0x0528) to 1. The reading is then sampled at the control frequency.
| Name | Id | Unit | Meaning |
|---|---|---|---|
| fbk_an_adc | 0x0532 | 1-4 | Which ADC channel |
| fbk_an_kind | 0x0533 | 0/1 | 0 = position sensor, 1 = speed sensor (tacho) |
| fbk_an_gain | 0x0534 | rad/V or m/V | Load movement per connector volt (per second for a tacho). Default 0: no feedback until set |
| fbk_an_offset | 0x0535 | rad or m | Load position at 0 V |
| fbk_an_fc | 0x0536 | Hz | Low-pass filter (0 = off) |
| fbk_an_value | 0x0537 | rad or m | Signal: mapped reading, use it to check gain and offset |
Do not also enable a feedback channel as a throttle in input_opt.
3. PWM input (RC servo)
The RC PWM input measures the high time of a servo pulse with 1 µs resolution. It is available on F405 and H7 boards that have a capture timer. U5 boards have no RC PWM input. Check your board's documentation for the pin.
Signal and validation
- By default it expects 1000 µs (zero) to 2000 µs (full) pulses with 1500 µs as centre, in two-direction mode with a ±5 % deadband (about ±25 µs).
- Only frames with a period between
ic_dur_minandic_dur_maxare accepted: 15 to 25 ms by default (40 to 67 Hz). For a 333 Hz or other fast receiver, widen these limits, or let the calibration wizard set them. - 4 bad frames in a row, or no edge for about 65 ms, raise error 27 and set the request to 0.
- Until the first good frame arrives after power-up, the input counts as faulted.
- A receiver in failsafe that keeps sending a fixed pulse width is not a lost signal. Set
ic_trip_loworic_trip_higharound the failsafe width to catch it.
The mapping is the same as for analog inputs (type, centre, deadband, curve, polarity, trips), but in microseconds. The Setup Inputs window and the calibration wizard work for PWM too; the wizard also measures the frame rate and sets ic_dur_min/ic_dur_max to ±25 % around it. The plot preset PWM input shows ic_pulse, ic_duration and ic_req.
Parameters
| Name | Id | Unit | Default | Meaning |
|---|---|---|---|---|
| ic_type | 0x0D06 | 0-3 | 2 | 0 one direction +, 1 one direction -, 2 two directions, 3 brake |
| ic_min | 0x0D01 | µs | 1000 | Zero throttle |
| ic_max | 0x0D00 | µs | 2000 | Full throttle |
| ic_center | 0x0D05 | µs | 1500 | Rest position (two directions) |
| ic_dead | 0x0D07 | 0-0.5 | 0.05 | Deadband (two directions) |
| ic_pol | 0x0D02 | -1 to 1 | 1 | Output multiplier |
| ic_trip_low | 0x0D03 | µs | 0 (off) | Fault below this pulse |
| ic_trip_high | 0x0D04 | µs | 65535 (off) | Fault above this pulse |
| ic_dur_min | 0x0506 | µs | 15000 | Shortest accepted frame period |
| ic_dur_max | 0x0505 | µs | 25000 | Longest accepted frame period |
| ic_cx0..4, ic_cy0..4 | 0x0D09-0x0D12 | -1 to 1 | straight | Curve points |
| ic_pulse | 0x053A | µs | Signal: pulse width now | |
| ic_duration | 0x053B | µs | Signal: frame period now | |
| ic_req | 0x053C | -1 to 1 | Signal: request after mapping | |
| ic_rejects | 0x054F | count | Signal: rejected frames since boot |
Enable the input with bit 4 in input_opt.
PWM output and PWM encoders
- Servo output: a Lua script can drive the same pin as a PWM output with
pwm_out(us, hz)(1-20000 Hz, default 50 Hz, 1 µs steps).pwm_out(0)hands the pin back to the input. It is refused while the RC PWM input is enabled. - PWM absolute encoders (about 1 kHz, duty cycle = angle) are supported on boards built for them, as the startup sensor (
par_SL_sensor= 2). Such a board has no RC PWM input. - Digital outputs
dout_1todout_8(0x0A01-0x0A08) switch the board's output pins (for example a 5 V or 12 V supply out). Each board names its own outputs.
4. CAN: overview
A Dynamesys controller has one classic CAN 2.0 port (no CAN FD, up to 8 data bytes per frame). On that one port it runs:
- one selected protocol for commands and telemetry (Dynamesys, CANopen, VESC, J1939, DroneCAN or a custom protocol);
- alongside it, unless you turn them off, the Dynamesys presence announce, the CAN tunnel (full Workbench access over the bus) and the Dynamesys status packets.
So you can drive a controller from a CANopen PLC and still configure it, plot it and update its firmware from the Workbench over the same two wires.
Wiring and bitrate
Wiring
- Use a twisted pair for CAN-H and CAN-L, and connect the ground of every node.
- Terminate the bus with 120 Ω at both physical ends and nowhere else (about 60 Ω measured between CAN-H and CAN-L with power off). Check your board's documentation for its connector pinout and whether a terminator is fitted.
- Keep stubs short (a few tens of cm at 1 Mbit/s). As a rule of thumb the total bus length can be about 40 m at 1 Mbit/s, 100 m at 500 kbit/s, 250 m at 250 kbit/s and 500 m at 125 kbit/s.
Bitrate
| can_baudrate (0x0405) | Bitrate |
|---|---|
| 0 (default) | 1 Mbit/s |
| 1 | 500 kbit/s |
| 2 | 250 kbit/s |
| 3 | 125 kbit/s |
| 4 | 100 kbit/s |
| 5 | 50 kbit/s |
- A new bitrate applies 0.5 s after the write: the reply still goes out at the old rate, and a host has time to tell every node before any of them switches. Then the controller drops off a bus running at the old rate. Store it to keep it.
- Move a whole bus at once, never one node at a time: two nodes at each rate acknowledge each other and jam the other pair for good. The Workbench does this for you: changing the bitrate of a device behind an RFLX-CONNECT moves every device on that bus and the CONNECT, and saves it on each.
- Every controller family samples at about 85.7 % of the bit (F405 85.7 %, H7 85.9 %, U5 85.6 %). Set other nodes on the bus close to this; a large difference causes bus errors at 1 Mbit/s.
- Automatic retransmission is on, and the controller recovers from bus-off by itself.
- A node that gets no acknowledgement (alone on the bus, or at another bitrate than the rest) goes quiet and listens until it hears another node, so it never floods the bus. An RFLX-CONNECT does the same and checks back every few seconds.
- PC CAN adapters in the Workbench detect the bitrate by listening (a silent bus starts at 1 Mbit/s). An RFLX-CONNECT does not detect it: set its
can_bitrateto match the bus. A new value applies at once. can_protocol,can_baudrateandcan_node_idcannot be written with a Dynamesys protocol parameter frame, because one wrong value takes the node off the bus. Change them over USB, the CAN tunnel (Workbench), CANopen SDO or the text terminal.
The four layers on the bus
| Layer | CAN IDs | What it does | Switched by |
|---|---|---|---|
| Selected protocol | Its own (see each section) | Commands and telemetry for your PLC or vehicle | can_protocol |
| Presence announce | 0x000065nn ext | One frame per second per node: who is on the bus, node ID clashes, who is the host | CAN_options ≥ 1 |
| CAN tunnel | 0x000005nn / 0x000006nn ext | The Workbench's full connection to node nn: parameters, plots, terminal, SD card, firmware update | CAN_options ≥ 1 |
| Dynamesys status packets | 0x0000C0nn-0x0000C8nn ext | Periodic telemetry: speed, position, voltages, currents, state, errors, temperatures | Always under the Dynamesys protocol; under other protocols when CAN_options = 3 |
All Dynamesys layers use 29-bit extended IDs with the node ID in the low byte. Section Running next to any protocol explains how they share the bus with each protocol.
Selecting a protocol
| can_protocol (0x0404) | Protocol | IDs | Section |
|---|---|---|---|
| 0 | Disabled: CAN off, no layers at all | ||
| 1 (default) | Dynamesys | 29-bit | 7 |
| 2 | CANopen CiA 301 + CiA 402 | 11-bit | 8 |
| 3 | Cyphal: reserved, not implemented | ||
| 4 | DroneCAN | 29-bit | 11 |
| 5 | Custom (build-specific) | 12 | |
| 9 | VESC | 29-bit | 9 |
| 10 | SAE J1939 | 29-bit | 10 |
Values 6 and 7 are reserved, and 8 is a customer-specific protocol. A new protocol applies immediately; store it to keep it.
CAN_options
CAN_options (0x0415) is a level. Each level includes everything below it.
| Value | Meaning |
|---|---|
| 0 | Dynamesys layers off. Only the selected protocol is on the bus. The node is invisible to the Workbench over CAN and does not check for node ID clashes. |
| 1 | Presence announce and CAN tunnel. The node keeps its node ID even if another node uses it (the clash is still reported). |
| 2 | As 1, and the node moves to a free ID when another node uses the same one. |
| 3 (default) | As 2, and the Dynamesys status packets are also sent under any other protocol. |
Node IDs
Every device on the bus needs its own node ID from 1 to 127. That includes controllers, an RFLX-CONNECT and a PC CAN adapter.
The parameter
can_node_id(0x0406), 0 to 127, default 0.- 0 means "pick one". A new controller listens for 2.5 s, then picks a free ID derived from its unique chip ID and stores it. The same board always prefers the same ID. Until it has one it sends nothing on the bus. Writing 0 later makes it pick again.
- 1 to 127 pins the ID.
- A change applies at once: the protocol and its filters restart on the new ID and the CAN setpoints are zeroed. Store it to keep it (the Workbench CAN view, Device Overview and device dialog store it for you).
- Node 0 in a Dynamesys protocol frame is the broadcast address (stop, setpoints, arm), never a real node.
What each protocol does with it
| Protocol | Node ID use |
|---|---|
| Dynamesys, status packets, presence, tunnel | Low byte of every frame ID |
| CANopen | CANopen node ID (SDO 0x600/0x580 + ID, PDOs, EMCY, heartbeat). Pin it: a moved ID moves every COB-ID. After changing it, reboot so the PDO COB-IDs follow. |
| VESC | VESC controller ID |
| J1939 | Source address. The controller sends Address Claimed but does not arbitrate addresses with other ECUs. |
| DroneCAN | DroneCAN node ID (runs as node 10 until an ID is set). The ESC slot is can_esc_index (0x0407). |
Clashes
- A node that hears its own ID in another node's presence announce knows the ID is taken. Both nodes show error 12 CAN bus collision for 1.5 s, which stops the drive briefly.
- With
CAN_options2 or 3 one of them moves to a free ID. Which one is decided by a hash of the chip IDs, not by who was there first: a node already on the bus can be the one that moves. A node set toCAN_options1 (fixed) never moves, and the other one does. - The Workbench follows a node that moves (it recognises the board by its chip ID).
- Two fixed nodes on one ID keep clashing. The
can_tunnelcommand's "id clashes seen" counter then keeps rising (see Diagnostics).
Setting the ID in the Workbench
- CAN view, field Node ID.
- Double-click a device in the device list: CAN address (1 to 127).
- Device Overview (F12), column Node (0 to 127, 0 = pick at boot).
The Workbench refuses an ID that is already in use on the bus. You can change the ID of a node you are connected to over CAN: the connection, open plots and settings follow it to the new ID. When several parameters are written at once, the node ID is always written last.
Commissioning a fixed installation: connect one board at a time, give each a pinned ID from 1 to 127 and store it. Set CAN_options to 1 if IDs must never move on their own. Loading a saved configuration from another board also copies its node ID, so check the ID after an import.
Driving the motor over CAN
- Allow it: add 256 to
input_opt(in the Workbench: Enable CAN setpoints in the CAN view). Without it every protocol's setpoints are ignored. - Mode: Dynamesys, VESC, J1939 and Custom setpoints set the control mode themselves (a current setpoint selects current mode and so on). DroneCAN RawCommand uses
can_control_mode(0x0409: 0 torque, 1 speed, 2 duty, 3 position). CANopen uses its mode of operation (0x6060). - Timeout:
can_timeout(0x0408, default 1000 ms, 0 = off). Every CAN setpoint restarts it. When it runs out the CAN current, speed and duty setpoints go to 0. No error is raised, and an armed position hold keeps holding. Send setpoints faster than this interval. CANopen uses its own master-loss detection instead (see EMCY and master loss). - Summing: CAN setpoints are added to any other enabled input (see How inputs become a request). Usually you enable CAN alone.
- Changing any CAN parameter zeroes the CAN setpoints.
Trying frames from a PC
Every protocol section ends with examples: a list of frames, how to read them, and a short Python script that sends them.
Reading the example tables
- ID is the CAN identifier in hex. 8 digits is a 29-bit (extended) ID, 3 digits an 11-bit (standard) one.
- DLC is the number of data bytes, 0 to 8.
- Data is the bytes in the order they appear on the bus, byte 0 first.
- Unless said otherwise, the controller is node 10 (0x0A).
Byte order
A value wider than one byte can go out lowest byte first or highest byte first. Take 10000, which is 0x00002710 in hex:
| Byte order | On the bus | Used by |
|---|---|---|
| Little-endian: lowest byte first | 10 27 00 00 | Dynamesys, status packets, CANopen, J1939, DroneCAN |
| Big-endian: highest byte first | 00 00 27 10 | VESC |
The name says which end comes first. Byte 0 of a little-endian value holds its lowest part.
Sending from Python
The scripts use python-can (pip install python-can) with any adapter it supports. Close the Workbench's connection to the adapter first: only one program can use it at a time.
import can, struct, time
bus = can.Bus(interface="pcan", channel="PCAN_USBBUS1", bitrate=1000000)
# CANable (slcan): can.Bus(interface="slcan", channel="COM5", bitrate=1000000)
Use the controller's bitrate (can_baudrate, 1 Mbit/s by default). The other scripts assume this bus.
Running next to any protocol
Every received frame is first offered to the tunnel and presence layer and then to the selected protocol. All Dynamesys layers use 29-bit IDs whose bits 28-16 are 0, with only a few command values in bits 15-8. Each protocol installs hardware filters for its own frames, and the tunnel adds three of its own: downstream to this node (exact 0x05nn), presence (0x65xx, any sender), and upstream 0x06xx only while this node relays for a host.
| Protocol | Presence + tunnel | Status packets (CAN_options 3) | Advice |
|---|---|---|---|
| Dynamesys | Yes | Always (native) | Command values 0x05, 0x06 and 0x65 belong to the tunnel. |
| CANopen | Yes | Yes | No overlap: CANopen uses 11-bit IDs and our layers 29-bit. Fine to keep the default. |
| VESC | Yes | Yes | Tunnel IDs 0x05nn/0x06nn are VESC buffer packets addressed to node nn, so they never reach a VESC as long as every node ID on the bus is unique. Pin the IDs on a mixed bus. |
| J1939 | Yes | Yes | Our 29-bit IDs carry J1939 priority 0 and parse as PGN 0 (TSC1). Set CAN_options 0 on a bus with other J1939 ECUs. |
| DroneCAN | Yes | Yes | Our frames decode as highest-priority DroneCAN messages. Use CAN_options 0 on a bus with other DroneCAN nodes. |
| Custom | Yes | Yes | See the documentation of your custom protocol. |
| Disabled, Cyphal | No | No |
With CAN_options 2 the tunnel stays but the status packets stop; with 0 the bus carries only the selected protocol, and the Workbench can no longer reach the node over CAN (USB still works).
The CAN view in the Workbench
Open it from ≡ > Select Views > CAN. It shows only the fields the connected device has. Each change is written and stored at once. The CAN tab of Setup Inputs sets the same settings, saved with Save, and offers the CAN exports.
| Field | Parameter |
|---|---|
| Protocol | can_protocol |
| Baud Rate | can_baudrate |
| Status Rate | can_status_hz (empty = off) |
| Node ID | can_node_id |
| ESC Index | can_esc_index (DroneCAN) |
| Timeout | can_timeout (empty = no timeout) |
| CAN Mode | can_control_mode |
| Enable CAN setpoints | input_opt bit 256 |
To describe the bus to another tool, use the CAN exports: a DBC for the Dynamesys protocol and status packets, a DBC for J1939, an EDS for CANopen.
5. The CAN tunnel
The CAN tunnel carries a controller's complete USB connection over the CAN bus. A node reached through it behaves in the Workbench like a board on a USB cable:
- identity, parameters (read, write, store);
- live status and plots, at a lower rate (see Bandwidth and limits);
- the text terminal;
- Lua scripts, SD card files and the trip log;
- firmware updates.
Audio is the only feature that needs USB. The tunnel works under every protocol (can_protocol 1, 2, 4, 5, 9, 10) as long as CAN_options is 1 or higher.
Presence announce
Every node with a node ID sends this frame once a second. nn in the ID is the sender's node ID, so every node announces on its own ID. Firmware before 2.5.0 sent 0x000065FF instead; current devices still accept that, so match 0x000065xx to see both.
| ID | DLC | Byte | Content |
|---|---|---|---|
| 0x000065nn ext | 7 | 0 | 1 = this sender relays for a host (it is the bridge), 0 = not |
| 1 | Sender's node ID | ||
| 2..5 | 32-bit hash of the sender's chip ID, big-endian | ||
| 6 | Bit 0: the sender will not move its ID (CAN_options 1). Bit 1: the device sits behind an adapter, not on the bus |
A node missing for 2 s is considered gone. The announce is the lowest-priority frame Dynamesys sends, and 10 nodes use about 0.02 % of a 500 kbit/s bus.
Example
ID DLC Data (hex) Meaning
0x0000650A 7 00 0A 1A 2B 3C 4D 00 Node 10, not a bridge, chip-ID hash 0x1A2B3C4D, ID may move
Tunnel frames
| ID | Direction | Content |
|---|---|---|
| 0x000005nn ext | Host to node nn | 1-8 bytes of the byte stream (DLC = number of bytes) |
| 0x000006nn ext | Node nn to host | 1-8 bytes of the byte stream |
- The CAN frames carry no sequence numbers or acknowledgements. The stream inside is the Dynamesys binary protocol, whose packets carry their own length and CRC; the host asks again when a reply is lost or damaged.
- The tunnel passes the bytes through unchanged. The Dynamesys binary protocol inside is little-endian.
- The tunnel IDs rank above every CANopen frame except NMT, above every status frame, and below Dynamesys and VESC setpoints.
- No handshake opens a session: the first command to a node opens it. A host plugging in by USB takes the node over from a tunnel session. When the host's bridge disappears, the node closes the session and stops its streams after about 2 s.
- One host per bus. If two bridges announce, the last one wins and the other one's transfers time out.
Connecting through it
The host side needs a bridge between the PC and the bus. The bridge announces "host present", relays tunnel frames and is never itself the node you talk to.
| Bridge | How | Bitrate |
|---|---|---|
| A controller on USB | Connect the Workbench to any controller on the bus. It scans the bus and lists the other nodes. | That controller's can_baudrate |
| RFLX-CONNECT | USB, WiFi (TCP port 3333) or Bluetooth. One client at a time; a new client replaces the old one. | Set can_bitrate on the CONNECT to match |
| PC USB-CAN adapter | PCAN, candleLight / gs_usb, CANable (slcan) or Ebyte ECAN-U01S. It appears as an adapter card in Connect to Device. The PC itself becomes the bus master. | Bitrate row on the card: Auto listens first, a fixed rate connects at once |
To add more nodes later use ≡ > Connect to Another Device. Device Overview (F12) shows every connected device, and Next Device (F2) switches between them.
From a controller's own text terminal, can_nodes lists the nodes on the bus and can_attach <id> opens another node's terminal over the tunnel (can_detach to return).
Bandwidth and limits
- A CAN frame at 1 Mbit/s takes about 130-150 µs. A full parameter dump (about 1.4 kB) takes about 25 ms.
- Plots are capped to what the bus carries, whatever its bitrate: one signal up to 8 kHz, six signals up to 1 kHz, more signals proportionally less. The Workbench lowers the rate and says so when you ask for more. The default CAN plot rate is 1 kHz.
- A busy bus loses plot samples (they show as gaps), never status or replies, which are sent first. A plot that stops completely is restarted by the Workbench after a few seconds.
- Only the device you are looking at sends live status; the others are kept quiet.
- Over Bluetooth a plot is limited to about 20 kB/s.
6. Dynamesys status packets
The status packets are periodic telemetry frames in a fixed format. A Dynamesys protocol node always sends them. With CAN_options 3 (the default) a node running any other protocol sends them too, so a logger, display or RFLX-CONNECT trip log can read every controller the same way. They are send-only: under another protocol the node does not answer Dynamesys commands.
At a glance
| Sent by | Every Dynamesys protocol node, and with CAN_options 3 (default) a node running any other protocol |
| IDs | 29-bit 0x0000Cxnn: x is the frame (0 to 8), nn the sender's node ID |
| Byte order | Little-endian. f32 is an IEEE-754 float. |
| Scaling | i16 0.1: current in 0.1 A, voltage in 0.1 V, temperature in 0.1 °C. i16 1e-4: normalised values (duty, ADC, demand). Both saturate at ±32767. |
| Rates | Fast frames at can_status_hz (50 Hz), slow frames at can_status_slow_hz (10 Hz), STATE also on change. Both are held to each node's share of the bus: the nodes heard share about 40 % of it, e.g. 37 Hz for a drive alone at 50 kbit/s and about 9 Hz for each of three drives with an RFLX-CONNECT. |
| Direction | Send-only, nothing to answer |
| File | ≡ > CAN Exports > Dynamesys DBC, This Device; on a node with another protocol choose Status only (see CAN exports) |
Frames
| ID | Name | DLC | Bytes | Rate | Mask |
|---|---|---|---|---|---|
| 0xC0nn | MOTION | 8 | [0..3] f32 speed [speed_unit][4..7] f32 position [ pos_unit] | fast | 0x001 |
| 0xC1nn | BUS | 8 | [0..1] i16 battery current, 0.1 A [2..3] i16 bus voltage, 0.1 V [4..5] i16 duty, 1e-4 (-1..1) [6..7] u16 electrical angle, 65536 = 360° | fast | 0x002 |
| 0xC2nn | STATE | 7 or 8 | [0] u8 motor state (table) [1] u8 control mode: 0 torque, 1 speed, 2 duty, 3 position, 6 voltage [2] u8 flags: bit 0 position armed, bit 1 E-STOP latched, bit 2 position reached, bit 3 moving [3..6] u32 latched errors, bit N-1 = error N (table) [7] u8 vehicle (only with the Vehicle app, DLC 8): bits 1:0 state (0 neutral, 1 drive, 2 locked), bits 3:2 ride mode, bit 4 reverse | slow + on change | 0x004 |
| 0xC3nn | DQ | 8 | [0..1] i16 Id, 0.1 A [2..3] i16 Iq, 0.1 A (both filtered) [4..5] i16 Vd, 0.1 V [6..7] i16 Vq, 0.1 V | fast | 0x008 |
| 0xC4nn | HEALTH | 8 | [0..1] i16 MOSFET temperature, 0.1 °C [2..3] i16 motor temperature, 0.1 °C [4..5] u16 active limits (table) [6..7] u16 key bits: 1 not initialised, 2 killswitch, 4 safe start, 8 app | slow | 0x010 |
| 0xC5nn | CUST_A | 8 | [0..3] value of the parameter named by can_status_a1[4..7] value of can_status_a2 | fast | 0x020 |
| 0xC6nn | CUST_B | 8 | [0..3] can_status_b1[4..7] can_status_b2 | fast | 0x040 |
| 0xC7nn | INPUT | 8 | [0..1] i16 ADC1 reading, 1e-4 [2..3] i16 ADC2 reading, 1e-4 [4..5] i16 CAN duty setpoint, 1e-4 [6..7] i16 total input demand, 1e-4 | fast | 0x080 |
| 0xC8nn | ODO | 8 | [0..3] u32 lifetime distance (m, or shaft revolutions for a rotary load) [4..5] u16 trip energy, Wh [6..7] u16 trip distance, per 100 m or 100 rev | slow | 0x100 |
| Parameter | Id | Default | Meaning |
|---|---|---|---|
| can_status_hz | 0x040A | 50 Hz | Rate of the fast frames (0 = off) |
| can_status_slow_hz | 0x041B | 10 Hz | Rate of STATE, HEALTH and ODO (0 = off) |
| can_status_mask | 0x041C | 0x1FF (all) | Bit N enables frame 0xC0+N |
| can_status_a1, a2, b1, b2 | 0x0417-0x041A | 0 (empty) | Parameter id shown in each custom slot |
- STATE is also sent within 10 ms of any change of state, mode, flags or errors, even with both rates at 0. Clearing mask bit 0x004 stops it completely.
- Custom slots carry any number parameter or signal as 4 bytes: integers sign- or zero-extended, floats as f32, a bool in the first byte. A frame whose two slots are empty is not sent.
- The controller sends at most one frame per millisecond, taking turns, so all enabled fast frames together are limited to about 1000 frames/s.
Examples
Node 10 with speed_unit 1 (RPM) and pos_unit 1 (rev):
ID DLC Data (hex) Meaning
0x0000C00A 8 00 80 BB 44 00 00 44 41 MOTION: 1500 rpm, position 12.25 rev
0x0000C10A 8 7D 00 E0 01 88 13 00 40 BUS: 12.5 A, 48.0 V, duty 0.5, angle 90°
0x0000C20A 7 07 00 00 00 00 00 00 STATE: Run, torque mode, no flags, no errors
Reading the BUS frame
0x0000C10A frame 0xC1 (BUS) from node 0x0A
7D 00 0x007D = 125 x 0.1 A = 12.5 A
E0 01 0x01E0 = 480 x 0.1 V = 48.0 V
88 13 0x1388 = 5000 x 1e-4 = 0.5 duty
00 40 0x4000 = 16384 x 360° / 65536 = 90°
In MOTION, 00 80 BB 44 is the f32 0x44BB8000, which is 1500.0.
Reading them in Python
NODE = 10
for msg in bus: # runs until stopped
if msg.arbitration_id == 0xC100 | NODE: # BUS
ibus, vbus, duty, angle = struct.unpack("<hhhH", msg.data)
print(f"{ibus / 10} A {vbus / 10} V duty {duty / 1e4} {angle * 360 / 65536:.0f} deg")
elif msg.arbitration_id == 0xC000 | NODE: # MOTION
speed, pos = struct.unpack("<ff", msg.data)
print(f"speed {speed} position {pos}")
7. Dynamesys protocol
The Dynamesys protocol (can_protocol = 1, the default) is the house protocol: setpoints, position moves, parameter read/write and the status packets, all on 29-bit IDs.
At a glance
| Select | can_protocol = 1 (the default) |
| IDs | 29-bit: parameter id, command and node ID in one identifier (Frame IDs) |
| Node ID | Low byte of the ID; 0 = broadcast |
| Byte order | Little-endian; f32 values that are NaN or infinite are refused |
| Setpoints | Need input_opt bit 256; each one selects its own control mode |
| Command loss | can_timeout (default 1000 ms) zeroes the CAN setpoints |
| Replies | Parameter commands always answer (PARAM_VALUE or ERR); setpoints answer only when refused |
| Telemetry | The status packets |
| File | ≡ > CAN Exports > Dynamesys DBC |
Setting it up
- In the CAN view, keep Protocol on Dynamesys and set the Baud Rate of your bus.
- Give each controller its own Node ID (1 to 127), or leave it at 0 to let nodes pick free IDs.
- Tick Enable CAN setpoints (adds 256 to
input_opt). - Choose a Timeout longer than your setpoint interval.
- Send a parameter read (PARAM_GET) to check that the node answers, then send setpoints.
Frame IDs
ID = (param_id & 0xFFF) << 16 | command << 8 | node
bits 27-16 parameter id (0 for commands that are not about a parameter)
bits 15-8 command
bits 7-0 node ID (0 = broadcast)
Examples for node 10: SET_CURRENT 0x0000030A, STATUS_STATE 0x0000C20A, read can_timeout (0x0408) 0x0408210A.
- Only 29-bit data frames are used. Standard and remote frames are ignored.
- A node accepts frames to its own ID and to node 0. Broadcast (node 0) works only for commands 0x00 to 0x08 (stops, setpoints, position arm), never for configuration.
- Lower IDs win arbitration: stops, then setpoints and position commands, then ERR and the status packets. Parameter frames carry the parameter id in the top bits, so they come last.
- Streamed setpoints are not acknowledged. A refused unicast frame is answered with ERR (0x24).
Commands
"Needs CAN" means the frame is only accepted when input_opt has bit 256 set and no detection or update is running. Otherwise the node answers ERR reason 6. Setpoints restart can_timeout; position commands do not.
| Cmd | Name | DLC | Payload | Effect | Needs CAN |
|---|---|---|---|---|---|
| 0x00 | ESTOP | 0-1 | u8: 0 = release, anything else or empty = assert | Assert latches the emergency stop (error 11) and drops the CAN setpoints. Release clears it. | Release only |
| 0x01 | STOP | any | Stops the motor, zeroes every request, disarms position control | No | |
| 0x02 | SET_DUTY | 4 | f32 duty, -1..1 | Duty mode | Yes |
| 0x03 | SET_CURRENT | 4 | f32 q-axis current, A | Current (torque) mode | Yes |
| 0x04 | SET_VELOCITY | 4 | f32 speed [speed_unit] | Speed mode | Yes |
| 0x07 | SET_POSITION | 4 or 8 | f32 target [pos_unit]; optional f32 speed limit [pos_unit/s] | Sets the target only; arm with POS_ENABLE. With 4 bytes the speed limit is cleared. | Yes |
| 0x08 | POS_ENABLE | 1 | u8: 1 = arm, 0 = disarm | Arming selects position mode. Stage targets per node, then arm all axes together with one broadcast. | Yes |
| 0x11 | POS_ABS_CNT | 8 | i64 target, encoder counts (±2147483647) | Absolute target in counts | Yes |
| 0x12 | POS_REL | 4 or 8 | f32 distance [pos_unit]; optional f32 speed limit | Moves relative to the current target | Yes |
| 0x13 | POS_REL_CNT | 8 | i64 distance, counts | Relative move in counts | Yes |
| 0x14 | POS_ZERO_HERE | 0 | The current position becomes 0 | Yes | |
| 0x15 | POS_HOLD_HERE | 0 | The target becomes the current position | Yes | |
| 0x16 | POS_LIMITS | 8 | f32 min, f32 max [pos_unit]; 0, 0 = no limits | Software travel limits | Yes |
| 0x17 | POS_ACCEL | 4 or 8 | f32 acceleration; optional f32 deceleration [pos_unit/s²]; 0 = configured value | Can only lower the configured limit; not stored | Yes |
Units: speed_unit (0x030F) is 0 rad/s, 1 RPM, 2 rev/s for a rotary load, or 0 m/s, 1 mm/s, 2 km/h for a linear one. pos_unit (0x0344) is 0 rad, 1 rev (rotary) or 0 m, 1 mm (linear).
To clear an error, write 1 to the parameter clear_error (0x0C48) with PARAM_SET. Like every command parameter (stop, emergency_stop, ride_mode) it needs CAN setpoints enabled in input_opt, or the node answers ERR reason 6.
Parameter access
The parameter id goes in ID bits 27-16. Parameter frames are never broadcast.
| Cmd | Name | Direction | DLC | Payload | Reply |
|---|---|---|---|---|---|
| 0x20 | PARAM_SET | to node | 4 (1 for bool) | value | PARAM_VALUE with the new value. RAM only. |
| 0x21 | PARAM_GET | to node | 0 | PARAM_VALUE | |
| 0x22 | PARAM_VALUE | from node | 4 (1 for bool) | value | |
| 0x23 | PARAM_STORE | to node | 4 (1 for bool) | value | As PARAM_SET, then stores that parameter to flash shortly after |
| 0x24 | ERR | from node | 2 | [0] refused command, [1] reason |
Values are 4 bytes: integers as int32 or uint32, floats as f32. Booleans are 1 byte. Text and array parameters can only be reached through the tunnel. Out-of-range values are refused, not clamped.
| Reason | Meaning | Reason | Meaning |
|---|---|---|---|
| 1 | Unknown parameter | 6 | Not allowed now (enable CAN in input_opt, or the motor is busy) |
| 2 | Read-only | 7 | Bad value (NaN or infinite) |
| 3 | Wrong length | 8 | Out of range |
| 4 | Not carried (text, array) | 9 | Not supported by this hardware |
| 5 | Protected (can_protocol, can_baudrate, can_node_id) | 10 | Busy, store not queued; try again |
A DBC with every command and status frame comes from ≡ > CAN Exports > Dynamesys DBC, This Device or Dynamesys DBC, Full Network. Parameter frames are not in the DBC, because their ID depends on the parameter.
Examples
A master driving node 10, starting from the default input_opt (UART only):
ID DLC Data (hex) Meaning
0x0000030A 4 00 00 A0 40 SET_CURRENT 5.0 A
0x0000240A 2 03 06 ERR from node 10: command 0x03 refused, reason 6 (CAN not enabled)
0x0309230A 4 08 01 00 00 PARAM_STORE input_opt (0x0309) = 264: UART 8 + CAN 256
0x0309220A 4 08 01 00 00 PARAM_VALUE from node 10: the new value
0x0000030A 4 00 00 A0 40 SET_CURRENT 5.0 A, now accepted (no reply)
0x0408210A 0 PARAM_GET can_timeout (0x0408)
0x0408220A 4 E8 03 00 00 PARAM_VALUE: 1000 ms
0x0000070A 8 00 00 20 40 00 00 80 3F SET_POSITION 2.5, speed limit 1.0 per s [pos_unit]
0x00000800 1 01 POS_ENABLE to node 0: every node arms at once
0x00000000 0 ESTOP to node 0: every node latches the emergency stop
Reading the frames
0x0309230A = 0x0309 << 16 parameter input_opt
| 0x23 << 8 command PARAM_STORE
| 0x0A node 10
08 01 00 00 = 0x00000108 = 264, lowest byte first
00 00 A0 40 = 0x40A00000 = 5.0 as an f32
03 06 = command 0x03 (SET_CURRENT) refused, reason 6 (not allowed now)
A PARAM_VALUE reply carries the parameter id and node ID of the request. An ERR reply has parameter id 0.
In Python
NODE = 10
def dnes_id(cmd, param=0, node=NODE):
return (param & 0xFFF) << 16 | cmd << 8 | node
# Allow CAN setpoints: input_opt (0x0309) = 8 (UART) + 256 (CAN), and store it
bus.send(can.Message(arbitration_id=dnes_id(0x23, 0x0309), data=struct.pack("<I", 264),
is_extended_id=True))
# Read can_timeout (0x0408): listen for the PARAM_VALUE reply only
reply = dnes_id(0x22, 0x0408)
bus.set_filters([{"can_id": reply, "can_mask": 0x1FFFFFFF, "extended": True}])
bus.send(can.Message(arbitration_id=dnes_id(0x21, 0x0408), data=b"", is_extended_id=True))
msg = bus.recv(0.5)
print(struct.unpack("<I", msg.data)[0] if msg else "no reply")
bus.set_filters(None)
# 5 A for 2 s, sent every 20 ms so can_timeout never runs out
task = bus.send_periodic(can.Message(arbitration_id=dnes_id(0x03),
data=struct.pack("<f", 5.0), is_extended_id=True), 0.02)
time.sleep(2)
task.stop()
bus.send(can.Message(arbitration_id=dnes_id(0x01), data=b"", is_extended_id=True)) # STOP
8. CANopen (CiA 301/402)
can_protocol = 2. The controller is a CiA 402 servo drive (device type 0x00020192) with an SDO server, 4 RPDOs and 4 TPDOs, EMCY, heartbeat and CiA 302-3 firmware download. Get the EDS from ≡ > CAN Exports > CANopen EDS File while the controller is connected.
Pin can_node_id (1 to 127) for CANopen. A node that picks or moves its ID moves every COB-ID. Set CAN_options to 1 so it never moves.
At a glance
| Select | can_protocol = 2 |
| IDs | 11-bit COB-IDs: function code + node ID (table) |
| Node ID | 1 to 127, pinned |
| Byte order | Little-endian, as CiA 301 specifies, in SDO data, PDOs and EMCY |
| Setpoints | Through the CiA 402 objects, usually by RPDO; need input_opt bit 256 (statusword bit 9 shows it) |
| Mode | 0x6060; velocity mode (2) after boot |
| Command loss | Heartbeat consumer or RPDO deadline, both off by default (master loss); can_timeout does not apply |
| Telemetry | TPDO1 every 100 ms, EMCY on errors, heartbeat every 1000 ms; status packets too with CAN_options 3 |
| File | ≡ > CAN Exports > CANopen EDS File |
Setting it up
- In the CAN view, set Protocol to CANopen, the Baud Rate of your bus and a fixed Node ID. Set
CAN_optionsto 1 so the ID never moves. - Tick Enable CAN setpoints (adds 256 to
input_opt). - Export the EDS and load it into your master.
- Configure master-loss detection: a heartbeat consumer (0x1016:1) or an RPDO deadline (0x1400:5).
- From the master, map the PDOs you need and store them (0x1010:1 = "save").
- Walk the drive through the CiA 402 state machine with the controlword: 0x06, 0x07, 0x0F.
COB-IDs, NMT, SDO
| Object | COB-ID |
|---|---|
| NMT | 0x000 |
| SYNC (consumer only) | 0x080 (0x1005) |
| EMCY | 0x080 + node |
| TPDO1..4 | 0x180 / 0x280 / 0x380 / 0x480 + node |
| RPDO1..4 | 0x200 / 0x300 / 0x400 / 0x500 + node |
| SDO request / response | 0x600 / 0x580 + node |
| Heartbeat | 0x700 + node |
NMT
- After boot-up the node goes straight to Operational when
canopen_autostart(0x0CB9) is 1 (the default; CiA 301 would wait for a Start). Set it to 0 to stay Pre-operational until NMT Start. - NMT commands: 0x01 start, 0x02 stop, 0x80 pre-operational, 0x81 reset node (reboot), 0x82 reset communication.
- Reset communication reloads the communication settings and PDOs from flash and sends boot-up again.
- PDOs run only in Operational. Stopped answers NMT only.
- Not supported: node guarding, LSS, TIME, SYNC producer.
SDO
- One server.
- Expedited and segmented upload and download.
- Block download only for firmware (0x1F50:1).
- No block upload.
Object dictionary
| Index | Content |
|---|---|
| 0x1000 | Device type 0x00020192 |
| 0x1001 | Error register |
| 0x1003 | Error history, 8 entries (write 0 to sub 0 to clear) |
| 0x1005 | SYNC COB-ID |
| 0x1008 / 0x1009 | Device name / hardware version (the firmware version is in 0x1018:3) |
| 0x1010:1 | Write "save" (0x65766173) to store all parameters |
| 0x1011:1 | Write "load" (0x64616F6C) to restore defaults, keeping the CAN settings; applies after a reset |
| 0x1014 / 0x1015 | EMCY COB-ID / inhibit time (100 µs) |
| 0x1016:1 | Heartbeat consumer, one entry: node << 16 | time in ms |
| 0x1017 | Heartbeat producer time, default 1000 ms |
| 0x1018 | Identity: vendor 0x00444E53, product 1, revision = firmware version, serial = chip ID |
| 0x1029:1 | On bus-off or heartbeat loss: 0 pre-operational (default), 1 no change, 2 stopped |
| 0x1200 | SDO server COB-IDs |
| 0x1400-03, 0x1600-03 | RPDO communication / mapping |
| 0x1800-03, 0x1A00-03 | TPDO communication / mapping |
| 0x1F50:1, 0x1F51:1, 0x1F57:1 | Firmware download: data, control (0 stop, 1 start, 3 clear), status |
| 0x2000 + id | Every Dynamesys parameter by its id (for example can_timeout 0x0408 at 0x2408), little-endian at its own width. Arrays as CiA ARRAY, text as strings. |
| 0x3800 + id | Read-only description of each parameter |
| 0x5E00:1 | MOSFET temperature, INT16 °C |
| 0x5F00 | Dynamesys identity: magic, schema hash, chip ID, build time, git hash, parameter list |
CiA 402 drive profile
Supported modes (0x6502 = 0x0000038F): profile position (1), velocity (2, the default after boot), profile velocity (3), profile torque (4), cyclic synchronous position (8), velocity (9) and torque (10). No homing or interpolated position.
State machine
Standard controlword transitions. Statusword values:
- 0x0040 switch on disabled;
- 0x0021 ready to switch on;
- 0x0033 switched on;
- 0x0037 operation enabled;
- 0x0017 quick stop;
- 0x0008 fault.
Any latched controller error gives FAULT; a rising edge on controlword bit 7 resets it.
Statusword bits
- Bit 9 (remote) is set while CAN setpoints are allowed (
input_optbit 256). - Bit 7 (warning) is set when the drive is enabled without bit 256.
- Bit 10 target reached.
- Bit 12 is mode specific.
- Bit 13 following error.
Halt (controlword bit 8) stops at speed 0, current 0 or the current position.
| Index | Name | Unit | Maps to |
|---|---|---|---|
| 0x6040 / 0x6041 | Controlword / statusword | ||
| 0x6060 / 0x6061 | Mode of operation / display | Changing the mode zeroes the targets | |
| 0x6042 / 0x6043 / 0x6044 | vl target / demand / actual | rpm | |
| 0x6046:1/2 | vl min / max | rpm | speed_req_min, speed_req_max_pos |
| 0x6048 / 0x6049 | vl acceleration / deceleration | rpm per s | speed_ramp_up, speed_ramp_down |
| 0x60FF | Target velocity (pv, csv) | rpm | |
| 0x606C | Velocity actual | rpm | |
| 0x606D / 0x606E | Velocity window / time | rpm / ms | Default 20 rpm / 0 ms |
| 0x6071 / 0x6074 / 0x6077 | Target / demand / actual torque | ‰ of 0x6076 | |
| 0x6075 / 0x6076 | Rated current / rated torque | mA / mNm | par_i_max / ds402_rated_tq (0 = par_i_max × Kt) |
| 0x6078 | Current actual | ‰ of rated current | |
| 0x607A | Target position | counts | pp: taken on controlword bit 4 (bit 5 immediate, bit 6 relative); csp: followed directly |
| 0x6064 / 0x60F4 | Position actual / following error | counts | |
| 0x6065 / 0x6067 | Following error window / position window | counts | pos_err_max / pos_reached_win |
| 0x607D:1/2 | Software position limits | counts | pos_min / pos_max |
| 0x6081 / 0x6083 / 0x6084 | Profile velocity / acceleration / deceleration | counts/s, counts/s² | pos_vel_max, pos_acc_max, pos_dec_max |
| 0x6007 | Abort connection option | 0-3 | See master loss |
| 0x605A | Quick stop option | 0-8 | Default 2 |
| 0x603F | Error code |
Torque in ‰ of rated torque equals ‰ of rated current, because rated torque is rated current × Kt. Position objects return an SDO abort until the position sensor is scaled.
PDOs
- 4 RPDOs and 4 TPDOs, up to 8 bytes each.
- Mapping is dynamic: invalidate, set the count to 0, write the entries, set the count, validate.
- Transmission types: 0-240 synchronous, 254/255 event driven. RTR types are not supported.
- A TPDO with an inhibit time is also sent on change.
- Mapping changes are stored with the parameters (0x1010 or a Workbench store).
| PDO | COB-ID | Type | Default mapping |
|---|---|---|---|
| RPDO1 | 0x200 + node | 255 | 0x6040 controlword (u16), 0x6042 vl target (i16 rpm) |
| TPDO1 | 0x180 + node | 255, every 100 ms | 0x6041 statusword (u16), 0x6044 vl actual (i16 rpm), 0x5E00:1 MOSFET temperature (i16 °C) |
| PDO2-4 | Disabled | ||
RPDO mappable:
- 0x6040, 0x6042, 0x6060, 0x6071, 0x607A, 0x60FF;
- dummy entries 0x0002-0x0007.
TPDO mappable:
- the 402 objects above;
- 0x5E00:1;
- any number parameter at 0x2000 + id.
The CANopen settings are also parameters, so the Workbench can set and store them:
| Parameter | Id | Object | Default |
|---|---|---|---|
| co_hb_ms | 0x0E90 | 0x1017 | 1000 ms |
| co_emcy_cob | 0x0E91 | 0x1014 | 0 (= 0x80 + node) |
| co_emcy_inh | 0x0E92 | 0x1015 | 0 |
| co_hb_cons | 0x0E93 | 0x1016:1 | 0 (off) |
| co_sync_cob | 0x0E94 | 0x1005 | 0x080 |
| ds402_rated_tq | 0x0E95 | 0x6076 | 0 |
| ds402_abort_opt | 0x0E96 | 0x6007 | 1 |
| ds402_qs_opt | 0x0E97 | 0x605A | 2 |
| ds402_vel_win / _ms | 0x0E98 / 0x0E99 | 0x606D / 0x606E | 20 rpm / 0 ms |
| co_err_behav | 0x0E9A | 0x1029:1 | 0 |
| canopen_autostart | 0x0CB9 | NMT | 1 |
PDO settings are parameters 0x0E10 to 0x0E8C (one block per PDO).
EMCY and master loss
EMCY frame: [0..1] error code (little-endian), [2] error register, [3..6] latched controller errors (u32), [7] 0. One is sent per new error, and code 0x0000 when all errors have cleared.
| Code | Cause | Code | Cause |
|---|---|---|---|
| 0x2310 | Overcurrent | 0x8100 | CAN node ID clash |
| 0x2300 | Unbalanced current | 0x8110 | Control loop stall |
| 0x3210 / 0x3220 | Over / undervoltage | 0x8120 | Input out of range |
| 0x4210 | MOSFET overtemperature | 0x8130 | Heartbeat lost |
| 0x4200 | Capacitor overtemperature | 0x8140 | Bus-off |
| 0x4310 | Motor overtemperature | 0x8210 | RPDO too short |
| 0x4000 | Temperature sensor | 0x8240 | SYNC with data |
| 0x5000 | Memory or ADC fault | 0x8250 | RPDO deadline missed |
| 0x6100 | Software, watchdog or app | 0x8611 | Following error |
| 0x7100 | Hardware break input | 0xFF01 | Emergency stop |
| 0x7300 | Encoder | 0xFF02 / 03 / 04 | Measurement / detection / startup failed |
| 0x1000 | Other |
Master loss
Master loss is detected by:
- bus-off;
- a heartbeat consumer timeout (0x1016);
- an RPDO missing its deadline (0x140x:5, armed by the first RPDO);
- NMT leaving Operational.
While the drive is in Operation Enabled, 0x6007 decides what happens: 0 nothing, 1 fault (default), 2 switch on disabled, 3 quick stop.
Configure a heartbeat consumer or an RPDO deadline. Under CANopen the generic can_timeout does not apply, and both of these are off by default. A master that simply goes silent then leaves the drive running on its last setpoint. For example, set 0x1016:1 to the master's node ID and 3 × its heartbeat period, or set 0x1400:5 to a few cycles of your RPDO rate.
Examples
A master (node 1) bringing up node 10 in velocity mode with the default PDOs:
ID DLC Data (hex) Meaning
0x000 2 01 0A NMT start node 10 (not needed with canopen_autostart 1)
0x70A 1 05 Heartbeat from node 10: Operational
0x60A 8 23 09 23 00 08 01 00 00 SDO write 0x2309:00 (input_opt) = 264, 4 bytes
0x58A 8 60 09 23 00 00 00 00 00 Write confirmed
0x60A 8 23 16 10 01 2C 01 01 00 SDO write 0x1016:01 = watch node 1, 300 ms
0x58A 8 60 16 10 01 00 00 00 00 Write confirmed
0x60A 8 23 10 10 01 73 61 76 65 SDO write 0x1010:01 = "save": store everything
0x58A 8 60 10 10 01 00 00 00 00 Write confirmed
0x20A 4 06 00 00 00 RPDO1: controlword 0x0006 (shutdown), vl target 0
0x20A 4 07 00 00 00 RPDO1: controlword 0x0007 (switch on)
0x20A 4 0F 00 E8 03 RPDO1: controlword 0x000F (enable operation), 1000 rpm
0x18A 6 37 02 E8 03 23 00 TPDO1: statusword 0x0237, 1000 rpm, MOSFET 35 °C
0x60A 8 40 41 60 00 00 00 00 00 SDO read 0x6041:00 (statusword)
0x58A 8 4B 41 60 00 37 02 00 00 Reply, 2 bytes: 0x0237 operation enabled, remote
With 0x1016:1 set, the master must send its own heartbeat (0x701) at least every 300 ms.
Reading the frames
0x60A = 0x600 (SDO request) + node 10; the reply comes on 0x580 + node
23 09 23 00 08 01 00 00
23 expedited download of 4 bytes (2B = 2 bytes, 2F = 1 byte)
09 23 index 0x2309, lowest byte first
00 subindex 0
08 01 00 00 value 264
60 reply: download done (80 = abort, abort code in bytes 4..7)
4B 41 60 00 37 02 00 00
4B upload reply with 2 bytes (43 = 4 bytes, 4F = 1 byte)
41 60 00 index 0x6041, subindex 0
37 02 statusword 0x0237
0x20A 0F 00 E8 03 RPDO1: controlword 0x000F | vl target 0x03E8 = 1000 rpm
0x18A 37 02 E8 03 23 00
TPDO1: statusword 0x0237 | 1000 rpm | 0x0023 = 35 °C
Statusword 0x0237 is operation enabled (0x0037) plus bit 9, remote: CAN setpoints are allowed.
In Python
The canopen package (pip install canopen) handles the SDO protocol. It opens the adapter itself, so use it instead of the plain bus.
import canopen, struct, time
net = canopen.Network()
net.connect(interface="pcan", channel="PCAN_USBBUS1", bitrate=1000000)
node = net.add_node(10) # add_node(10, "exported.eds") also gives names
node.sdo.download(0x2309, 0, struct.pack("<I", 264)) # input_opt: UART + CAN
print(hex(struct.unpack("<H", node.sdo.upload(0x6041, 0))[0])) # statusword
for cw in (0x06, 0x07, 0x0F): # shutdown, switch on, enable operation
net.send_message(0x20A, struct.pack("<Hh", cw, 0))
time.sleep(0.05)
net.send_message(0x20A, struct.pack("<Hh", 0x0F, 1000)) # 1000 rpm
time.sleep(2)
net.send_message(0x20A, struct.pack("<Hh", 0x06, 0)) # back to ready to switch on
net.disconnect()
9. VESC
can_protocol = 9. A subset of the VESC CAN protocol, so VESC-compatible displays, dashboards and ECUs can command and monitor the controller.
At a glance
| Select | can_protocol = 9 |
| IDs | 29-bit: packet << 8 | controller ID |
| Node ID | The VESC controller ID is can_node_id; the node also accepts the broadcast ID 0xFF |
| Byte order | Big-endian, as in VESC (the only big-endian protocol here) |
| Speed | Mechanical rpm, not electrical rpm (ERPM) as on a real VESC: divide ERPM by the pole-pair count on the master side |
| Setpoints | Need input_opt bit 256; each one selects its own control mode |
| Command loss | can_timeout (default 1000 ms) zeroes the CAN setpoints |
| Telemetry | STATUS, STATUS_4, STATUS_5 and STATUS_ERROR at can_status_hz (50 Hz) |
Setting it up
- In the CAN view, set Protocol to VESC, the Baud Rate of your bus and the Node ID your display or ECU expects.
- Tick Enable CAN setpoints and choose a Timeout.
- If the master works in ERPM, convert to mechanical rpm, or scale it on the master.
Messages
| Packet | ID | Direction | Payload |
|---|---|---|---|
| SET_DUTY (0) | 0x000nn | to node | int32, duty × 100000 |
| SET_CURRENT (1) | 0x001nn | to node | int32, mA |
| SET_RPM (3) | 0x003nn | to node | int32, mechanical rpm |
| STATUS (9) | 0x009nn | from node | [0..3] int32 mechanical rpm [4..5] int16 current × 10 (A, + motoring, - regen) [6..7] int16 duty × 1000 |
| STATUS_4 (16) | 0x010nn | from node | [0..1] MOSFET temperature × 10 °C [2..3] motor temperature × 10 °C [4..5] battery current × 10 A [6..7] 0 |
| STATUS_5 (27) | 0x01Bnn | from node | DLC 6: [0..3] 0 (no tachometer) [4..5] bus voltage × 10 V |
| STATUS_ERROR (80, Dynamesys) | 0x050nn | from node | [0..3] u32 latched errors [4..7] u32 every error since power-up, also cleared ones Bit N-1 = error N (table) |
Status frames are sent at can_status_hz (default 50 Hz). Other VESC packets (brake current, position, relative current, ping, buffer commands) are ignored. Loss of commands is handled by can_timeout.
On a bus with VESC devices, give every node a unique, pinned can_node_id. A node that picks its own ID only avoids other Dynamesys nodes, because VESCs send no presence announce.
Examples
Controller ID 10:
ID DLC Data (hex) Meaning
0x0000010A 4 00 00 27 10 SET_CURRENT 10 A (10000 mA)
0x0000030A 4 00 00 05 DC SET_RPM 1500 mechanical rpm
0x0000000A 4 00 00 61 A8 SET_DUTY 0.25 (25000)
0x0000090A 8 00 00 05 DC 00 64 00 FA STATUS from node 10: 1500 rpm, 10.0 A, duty 0.250
Reading the frames
0x0000010A = packet 0x01 (SET_CURRENT) << 8 | controller 0x0A
00 00 27 10 = 0x00002710 = 10000 mA = 10 A, highest byte first
STATUS 00 00 05 DC | 00 64 | 00 FA
0x05DC = 1500 rpm | 0x0064 = 100 / 10 = 10.0 A | 0x00FA = 250 / 1000 = 0.250 duty
In Python
NODE = 10
SET_CURRENT, SET_RPM, STATUS = 1, 3, 9
# 10 A for 2 s, every 20 ms; note ">" (big-endian) in the format
task = bus.send_periodic(can.Message(arbitration_id=SET_CURRENT << 8 | NODE,
data=struct.pack(">i", 10000), is_extended_id=True), 0.02)
time.sleep(2)
task.stop()
bus.send(can.Message(arbitration_id=SET_CURRENT << 8 | NODE, data=struct.pack(">i", 0),
is_extended_id=True)) # back to 0 A
msg = bus.recv(1.0)
while msg is not None and msg.arbitration_id != (STATUS << 8 | NODE):
msg = bus.recv(1.0)
if msg:
rpm, amps, duty = struct.unpack(">ihh", msg.data)
print(rpm, amps / 10, duty / 1000)
10. SAE J1939
can_protocol = 10. The controller behaves like a simple engine ECU: it takes speed or torque requests in TSC1 and reports EEC1, VEP1 and ET1.
At a glance
| Select | can_protocol = 10 |
| IDs | 29-bit J1939: priority, PGN, (destination) and source address |
| Address | The source address is can_node_id (1 to 127) |
| Byte order | Little-endian; 0xFF means "not available" |
| Setpoints | TSC1, 8 bytes, to our address or 0xFF; need input_opt bit 256 |
| Command loss | can_timeout (default 1000 ms) zeroes the CAN setpoints |
| Telemetry | EEC1, VEP1 and ET1 at can_status_hz (50 Hz), priority 6 |
| File | ≡ > CAN Exports > J1939 DBC File |
Setting it up
- In the CAN view, set Protocol to J1939, the Baud Rate (J1939 buses usually run at 250 or 500 kbit/s) and the Node ID as the source address.
- Tick Enable CAN setpoints and choose a Timeout.
- On a network with other J1939 ECUs, set
CAN_optionsto 0 (see Running next to any protocol). - Send TSC1 periodically, faster than the timeout.
Messages
Received
| PGN | Content | Effect |
|---|---|---|
| TSC1, 0 (to our address or 0xFF, any priority) |
|
|
| Request, 59904 (0xEA00) | [0..2] requested PGN | Answers Address Claimed, EEC1, VEP1, ET1 |
Sent
Each frame is sent at can_status_hz with priority 6.
| PGN | ID | Content |
|---|---|---|
| EEC1, 61444 (0xF004) | 0x18F004SA |
|
| VEP1, 65271 (0xFEF7) | 0x18FEF7SA |
|
| ET1, 65262 (0xFEEE) | 0x18FEEESA |
|
| Address Claimed, 60928 | 0x18EEFFSA | Sent at start and on request; arbitrary address capable |
The controller does not defend its address against other ECUs, and has no transport protocol or DM1 diagnostics. Use a unique address and CAN_options 0 on a shared J1939 network. Get a DBC from ≡ > CAN Exports > J1939 DBC File.
Examples
A service tool (address 0xFE) and the controller at address 0x0A. TSC1 must be 8 bytes; shorter frames are ignored.
ID DLC Data (hex) Meaning
0x0C000AFE 8 01 E0 2E 7D FF FF FF FF TSC1 to 0x0A: speed control, 1500 rpm
0x0C000AFE 8 02 00 00 9B FF FF FF FF TSC1: torque control, 30 % of par_i_max
0x0C000AFE 8 00 00 00 7D FF FF FF FF TSC1: override off, zero command
0x18EA0AFE 3 04 F0 00 Request PGN 61444 (EEC1) from 0x0A
0x18F0040A 8 00 A5 A5 C0 5D 0A FF FF EEC1 from 0x0A: torque 40 %, 3000 rpm
Reading the frames
0x0C000AFE
bits 28-26 3 priority
bits 25-24 0 reserved, data page
bits 23-16 0x00 PDU format: TSC1 (below 240, so the next byte is a destination)
bits 15-8 0x0A destination address
bits 7-0 0xFE source address
0x18F0040A priority 6, PGN 0xF004 (EEC1, a broadcast), source 0x0A
TSC1 01 | E0 2E | 7D | FF FF FF FF
01 override mode 1: speed control
E0 2E 0x2EE0 = 12000 x 0.125 rpm = 1500 rpm
7D 125 - 125 = 0 % torque (not used in speed mode)
FF not available
EEC1 00 | A5 | A5 | C0 5D | 0A
A5 0xA5 = 165 - 125 = 40 % of par_i_max (demand, then actual)
C0 5D 0x5DC0 = 24000 x 0.125 rpm = 3000 rpm
0A controlling device: the node itself
In Python
SA, TOOL = 0x0A, 0xFE
def tsc1(mode, rpm=0, torque_pct=0):
data = struct.pack("<BHB", mode, int(rpm / 0.125), torque_pct + 125) + b"\xff" * 4
return can.Message(arbitration_id=3 << 26 | SA << 8 | TOOL, data=data, is_extended_id=True)
task = bus.send_periodic(tsc1(1, rpm=1500), 0.02) # speed control, every 20 ms
time.sleep(3)
task.stop()
bus.send(tsc1(0)) # override off: zero command
11. DroneCAN
can_protocol = 4. DroneCAN (UAVCAN v0) ESC, for flight controllers such as ArduPilot and PX4.
At a glance
| Select | can_protocol = 4 |
| IDs | 29-bit DroneCAN: priority, message type and source node |
| Node ID | can_node_id; no dynamic node ID allocation (runs as node 10 until an ID is set) |
| ESC number | can_esc_index (0 to 19): which element of RawCommand and RPMCommand is ours |
| Byte order | Little-endian, with fields bit-packed as the DSDL definitions specify |
| Setpoints | Accepted from any node; need input_opt bit 256; RawCommand uses can_control_mode (0 torque by default) |
| Command loss | can_timeout (default 1000 ms) zeroes the CAN setpoints |
| Telemetry | esc.Status at can_status_hz (50 Hz), NodeStatus at 1 Hz |
Setting it up
- In the CAN view, set Protocol to DroneCAN, the Baud Rate of the flight controller's CAN port (usually 1 Mbit/s) and a Node ID no other node uses.
- Set ESC Index to the ESC number the flight controller uses for this motor.
- Set CAN Mode: torque, speed or duty.
- Tick Enable CAN setpoints and choose a Timeout.
- On a bus with other DroneCAN nodes, set
CAN_optionsto 0 (see Running next to any protocol).
Messages
| Message | Direction | Content |
|---|---|---|
| esc.RawCommand (1030) | to node | Element can_esc_index, -8192..8191, gives -1..1 in the mode set by can_control_mode |
| esc.RPMCommand (1031) | to node | Element can_esc_index, mechanical rpm, speed mode |
| GetNodeInfo (service 1) | request / response | Name, firmware and hardware version |
| NodeStatus (341) | from node, 1 Hz | Uptime, health OK, mode operational |
| esc.Status (1034) | from node, can_status_hz |
|
Examples
A flight controller (node 127, priority 16) and the controller at node 10, can_esc_index 0:
ID DLC Data (hex) Meaning
0x1004067F 3 00 40 C0 RawCommand: ESC 0 at 4096 (+50 %)
0x1004067F 3 00 80 C1 RawCommand: ESC 0 at -8192 (-100 %)
0x1004067F 8 00 40 01 00 04 00 10 C2 RawCommand: ESCs 0 to 3 all at 4096
0x1F01550A 8 64 00 00 00 00 00 00 C0 NodeStatus from node 10: uptime 100 s, healthy, operational
Reading the frames
0x1004067F
bits 28-24 16 priority
bits 23-8 0x0406 message type 1030 (esc.RawCommand)
bit 7 0 a message, not a service
bits 6-0 0x7F source node 127
00 40 C0
00 40 4096 as a 14-bit value: the low 8 bits in byte 0,
the top 6 bits in bits 7..2 of byte 1 (0x10 << 2 = 0x40)
C0 tail byte: start of transfer, end of transfer, transfer ID 0
64 00 00 00 | 00 | 00 00 | C0 NodeStatus
uptime 0x00000064 = 100 s | health 0 (OK), mode 0 (operational) | vendor code 0 | tail
- The tail byte is the last byte of every frame. Bit 7 marks the start of a transfer, bit 6 the end, bit 5 toggles between frames of one transfer, and the low 5 bits are a transfer ID that counts up with each message.
- A message longer than 7 bytes is split over several frames, with a CRC in the first two bytes. RawCommand for up to 4 ESCs fits in one frame.
- The 14-bit values run on across byte boundaries, so in practice use a DroneCAN library (pydronecan, libcanard).
In Python
A single-frame RawCommand for ESC 0, packed by hand:
def raw_command(value, tid): # value -8192..8191, ESC 0 only
v = value & 0x3FFF
return can.Message(arbitration_id=16 << 24 | 1030 << 8 | 127,
data=bytes([v & 0xFF, (v >> 8) << 2, 0xC0 | tid & 0x1F]),
is_extended_id=True)
for tid in range(100): # +25 % for 2 s at 50 Hz
bus.send(raw_command(2048, tid))
time.sleep(0.02)
bus.send(raw_command(0, 100))
12. Custom
can_protocol = 5 selects a customer-specific protocol that is built into some firmware builds only. Its frames and byte order are described in the documentation supplied with that build. On a build without one, Custom switches CAN off. The presence announce, the tunnel and the status packets run next to a custom protocol as next to any other.
13. Workbench CAN exports
The Workbench writes description files for other CAN tools. Open ≡ > CAN Exports and pick a file type.
| Menu item | File | Describes | Use with |
|---|---|---|---|
| CANopen EDS File | .eds (CiA 306) | The connected controller's full object dictionary: communication objects, PDOs, CiA 402 objects and every parameter at 0x2000 + id with its limits | CANopen masters and configuration tools |
| Dynamesys DBC, This Device | .dbc | Dynamesys protocol commands and status packets of the selected controller, with its node ID, name and custom status slots | CAN analysers and loggers (BUSMASTER, SavvyCAN, PCAN-Explorer, CANalyzer, cantools) |
| Dynamesys DBC, Full Network | .dbc | The same for every connected Dynamesys node, frames prefixed N<node>_ | As above, for a whole vehicle or machine |
| J1939 DBC File | .dbc | The J1939 frames (EEC1, VEP1, ET1, TSC1) at the controller's source address | J1939 tools and displays |
- Connected device: the EDS needs a connected controller. The DBCs take the node ID, name and custom slots from the selected device, so select it first.
- Other protocols: if the controller runs another protocol, the Dynamesys DBC asks whether to export anyway. Status only exports just the status packets that node sends with
CAN_options3. The Full Network export leaves out nodes that run another protocol. - Contents: the DBC lists every status frame with nominal cycle times. Your node sends only the frames enabled in
can_status_mask, atcan_status_hzandcan_status_slow_hz. Parameter frames are not in the DBC. - Node IDs: the EDS leaves the node ID to the master (
$NODEID). The DBCs contain the node ID, so export again after you change a node ID or a custom status slot.
14. Diagnostics
Text terminal commands
Run these on a controller's terminal (in the Workbench, or through can_attach):
can_nodeslists the nodes heard on the bus and marks this board, the bridge and the attached node. It also tells you if this board has no node ID yet.can_tunnelshows frames seen and sent, dropped frames, the bridge, "id clashes seen" and the recent node ID history, with a verdict line. A clash count that keeps rising means two fixed nodes share an ID.- On an RFLX-CONNECT,
can_nodesalso shows the running bitrate, the error counters and whether it is only listening because it hears nobody.
Common problems
| Symptom | Check |
|---|---|
| No devices found on the bus | Power, wiring, termination at both ends, the same bitrate on every device. A wrong bitrate looks like an empty bus. |
| Setpoints are ignored or answered with ERR 6 | input_opt bit 256; a running detection or update; an active error or E-STOP |
| Motor stops after one second | Setpoints are sent slower than can_timeout |
| Error 12 CAN bus collision | Two devices share a node ID. See Node IDs. |
| A device moved to another node ID | A clash was resolved (CAN_options 2 or 3). Pin IDs and use CAN_options 1 to prevent it. |
| Replies time out with two PCs connected, "another host took this CAN bus" | Only one host per bus, and the last one to connect has it; disconnect the other Workbench or bridge |
| A lone controller on a PC adapter is not found | The adapter must be active (not listen-only) so the controller's frames are acknowledged |
| Plots have gaps over CAN | Fewer signals, a lower plot rate, or a higher bitrate. Some candleLight clones with old firmware drop frames; update their firmware. |
| Foreign devices misbehave next to Dynamesys controllers | Set CAN_options 0 (see Running next to any protocol) |
15. Reference tables
Error codes
In bit masks (STATE bytes 3..6, VESC STATUS_ERROR, CANopen EMCY bytes 3..6) error N is bit N-1.
| N | Error | N | Error |
|---|---|---|---|
| 1-3 | Overcurrent phase U / V / W | 17-18 | ADC out of range, phase V / W |
| 4 | Overvoltage | 19 | ADC out of range, bus voltage |
| 5 | Undervoltage | 20 | Watchdog |
| 6 | Hardware break input | 21 | Unbalanced currents |
| 7-9 | MOSFET overtemperature U / V / W | 22 | Measurement failed |
| 10 | Motor overtemperature | 23 | Detection failed |
| 11 | Emergency stop | 24, 25 | Hall state 0 / 7 |
| 12 | CAN bus collision (node ID clash) | 26 | Encoder lost |
| 13 | Temperature sensor open or shorted | 27 | Input out of range |
| 14 | Memory fault | 28 | Startup failed |
| 15 | Usage fault | 29 | App (for example Vehicle app in a mode other than current) |
| 16 | ADC out of range, phase U | 30 | Capacitor overtemperature |
| 31 | Control loop stall | ||
| 32 | Position following error |
Motor states
| Value | State | Value | State |
|---|---|---|---|
| 0 | Initialising | 7 | Run |
| 1 | Detecting | 8 | Measuring KV |
| 2 | Align | 9 | Test |
| 3 | Measuring | 10 | Error |
| 4 | Open-loop start | 13 | Idle |
| 5 | Open-loop transition | 15 | Motor detection |
| 6 | Tracking (coasting, bridge off) | 16 | Firmware update |
Active limits (HEALTH bytes 4..5)
| Bit | Limit | Bit | Limit |
|---|---|---|---|
| 0x0001-0x0004 | MOSFET U / V / W temperature | 0x0200 | Speed ramp |
| 0x0008 | Capacitor temperature | 0x0400 | Voltage limit |
| 0x0010 | Motor temperature | 0x0800 | Iq maximum |
| 0x0020 | Field weakening | 0x1000 | Battery regen limit |
| 0x0040 | Battery power | 0x2000 | Id maximum |
| 0x0080 | Battery current | 0x4000 | Overspeed |
| 0x0100 | Speed limit | 0x8000 | Battery low |
CAN parameters
| Name | Id | Default | Meaning |
|---|---|---|---|
| can_protocol | 0x0404 | 1 | Protocol, see Selecting a protocol |
| can_baudrate | 0x0405 | 0 (1 Mbit/s) | Bitrate |
| can_node_id | 0x0406 | 0 (pick) | Node ID |
| can_esc_index | 0x0407 | 0 | ESC number (DroneCAN) |
| can_timeout | 0x0408 | 1000 ms | Setpoint timeout (0 = off) |
| can_control_mode | 0x0409 | 0 | Mode for DroneCAN RawCommand |
| can_status_hz | 0x040A | 50 Hz | Status rate (every protocol's telemetry) |
| can_status_slow_hz | 0x041B | 10 Hz | Slow status rate |
| can_status_mask | 0x041C | 0x1FF | Status frames on |
| CAN_options | 0x0415 | 3 | Dynamesys layers |
| can_tcount | 0x040E | Signal: time left before the setpoint timeout, ms |
Dynamesys Interfacing Guide for firmware 2.5.0. Parameter ids and limits for your exact firmware are in the Parameter Reference.