VESC Canbus Communication

  • A CAN Bus frame can contain a maximum of 8 bytes of data.
  • Each CAN node has a unique ID, the ID determines the priority (ID 0 is most dominant).
  • CAN messages from VESC use an extended ID (EID), containing the COMMAND and CONTROLLER_ID.

CANBus Control

These commands can be sent to a VESC node to control the motor and request status.

Command ID Data Data Length Data Type Units
CAN_PACKET_SET_DUTY 0 Motor Duty Cycle 32-bit/4-by te Signed Integer Thous andth s of perce nt (5000 0 –> 50%)
CAN_PACKET_SET_CURREN T 1 Motor Current 32-bit/4-by te Signed Integer mA
CAN_PACKET_SET_CURREN T_BRAKE 2 Motor Brake Current 32-bit/4-by te Signed Integer mA
CAN_PACKET_SET_RPM 3 Motor RPM 32-bit/4-by te Signed Integer ERPM
CAN_PACKET_SET_POS 4 Motor Position      
CAN_PACKET_FILL_RX_B UFFER 5        
CAN_PACKET_FILL_RX_B UFFER_LONG 6        
CAN_PACKET_PROCESS_RX _BUFFER 7        
CAN_PACKET_PROCESS_SH ORT_BUFFER 8        
CAN_PACKET_STATUS 9 Request status N/A    
CAN_PACKET_SET_CURREN T_REL 10        
CAN_PACKET_SET_CURREN T_BRAKE_REL 11        
  • Motor position requires an encoder to be present.

CanBus Status

The VESC can be configured to send status updates at a set frequency.

Triforce Network Topology

```

+—————-+ +—————-+ +—————-+ | Weapon Motor 1 | | Weapon Motor 1 | | Weapon Motor 1 | | CAN ID 3 | | CAN ID 4 | | CAN ID 5 | +—–+—-+—–+ +—–+—-+—–+ +—–+—-+—–+

| | | | | +——————-+
| | | | | | Fight Controller |
| | | | | | |

+——-+————+———+—————–+—-+———————+ |

+-+ | | | | | | +-+ |

120R | | | | | | | | | | 120R |
+-+ | | | | | | +-+ |
+————+————+———+——-+————–+—————-+ |
| | | | |
| | | | CAN ID 0 |

+—–+—-+—-+ +—–+—-+—-+ +——————-+ | Drive Motor 1 | | Drive Motor 1 | | CAN ID 1 | | CAN ID 2 | +—————+ +—————+

```