Skip to main content
The VESC uses a consistent framed serial protocol over both UART and USB. Understanding the packet format lets you communicate with a VESC from any microcontroller or host with a serial port. The protocol is implemented in comm/packet.c and comm/packet.h.

Packet structure

Every packet is wrapped in a frame that provides length and integrity information.
  • The maximum payload length is 512 bytes (PACKET_MAX_PL_LEN in packet.h).
  • The first byte of the payload is always the COMM_PACKET_ID command byte.
  • The CRC is computed over the payload bytes only (not the start byte, length, or stop byte).
  • The stop byte is 0x03 for both short and long frames.
The start byte distinguishes frame types: 0x02 means a one-byte length field follows; 0x03 means a two-byte length field follows.

Packet layer API

The packet.h API manages framing state for each communication channel:

Communicating from an external microcontroller

1

Connect UART

Connect your microcontroller’s TX to the VESC RX pin and RX to the VESC TX pin. Use the baud rate configured in VESC Tool under App Settings -> UART -> Baud Rate (default: 115200). Ensure common ground.
2

Build a packet

Construct a payload starting with the COMM_PACKET_ID byte followed by any required data bytes for that command. Encode it into a frame (start byte, length, payload, CRC16, stop byte).
3

Send and receive

Transmit the frame over UART. For commands that return data (e.g., COMM_GET_VALUES), wait for the VESC to send a response frame and decode it the same way.

Minimal C example: set duty cycle

COMM_PACKET_ID command reference

The first byte of every payload is a COMM_PACKET_ID value, defined in datatypes.h.

Motor control commands

Telemetry commands

Configuration commands

System commands

Firmware update commands

CAN forwarding

For the complete list of all 159+ commands, see datatypes.h and the handler in comm/commands.c.

UART configuration in VESC Tool

To enable the UART app, go to App Settings -> App to Use and select UART (or a combination that includes UART). Configure the baud rate under App Settings -> UART -> Baud Rate. The default is 115200 bps.
The VESC UART and USB interfaces share the same packet processing path (commands_process_packet). Do not connect both simultaneously from separate hosts, as they will interfere with each other.