Communication Settings

V6 USB serial and SPI protocols use CAN, CAN FD, and RS485 settings stored by the firmware. Linux SocketCAN uses settings configured by Linux. These are separate configuration paths.

Host method

Where to configure

After a power cycle

USB serial / SPI

Send AT+ commands through USB serial

Saved settings remain active

SocketCAN

Linux ip link

Configure each canX interface again

Send AT+ commands as text with a CRLF line ending. Do not send the characters \r\n as ordinary text.

Factory Defaults

Item

Default

Classic CAN

1 Mbps

CAN FD arbitration phase

1 Mbps

CAN FD data phase

5 Mbps

RS485

4 Mbps, one stop bit, no parity, eight data bits

SPI

SHORT, 23 bytes

RS485 RAW replies

Disabled

RS485 RAW target

0, both RS485 channels on the current MCU

Configure CAN and CAN FD

AT+SETFDCAN=<arbitration-bitrate>,<data-bitrate>

The first parameter is used for classic CAN and the CAN FD arbitration phase. The second parameter is used only for the CAN FD data phase.

Parameter

Supported values

Arbitration phase

1000000, 500000, 250000, 125000, 100000

Data phase

2000000, 3000000, 4000000, 5000000

All four CAN FD data rates use exact bit timing with 0% frequency error. Prefer the device’s factory default, normally 5 Mbps, and change it only when every device on the bus uses the same setting.

Set classic CAN/CAN FD arbitration to 1 Mbps and CAN FD data to 5 Mbps:

AT+SETFDCAN=1000000,5000000

Success returns:

OK

Query the current values:

AT+SETFDCAN?

Example response:

FDCAN:1000000,5000000

The setting is applied to both CAN/CAN FD interfaces on the current MCU and saved to Flash.

Configure RS485

AT+SETRS485=<bitrate>,<stop-bits>,<parity>,<data-bits>

Parameter

Supported values

Bitrate

1200 to 4000000

Stop bits

1 or 2

Parity

0: none; 1: odd; 2: even

Data bits

8 or 9

Example for Unitree’s common 4 Mbps, 8-N-1 setting:

AT+SETRS485=4000000,1,0,8

Query the current value:

AT+SETRS485?

Example response:

RS485:4000000,1,0,8

The setting is applied to both RS485 interfaces on the current MCU and saved to Flash.

Configure SPI Length

AT+SPIMODE?
AT+SPIMODE=SHORT
AT+SPIMODE=LONG

Mode

SPI transfer

Purpose

SHORT

23 bytes

Classic CAN; up to 18 bytes of RS485 data

LONG

73 bytes

Classic CAN, CAN FD; up to 68 bytes of RS485 data

Success returns OK, and the setting is saved. The SPI host must stop current transfers, wait at least 10 ms, and then use the new fixed length.

SocketCAN Settings

Linux configures SocketCAN. Classic CAN example:

sudo ip link set can0 down
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up

CAN FD example:

sudo ip link set can0 down
sudo ip link set can0 type can bitrate 1000000 dbitrate 5000000 fd on
sudo ip link set can0 up

Check the result:

ip -details link show can0

SocketCAN, USB serial, and SPI ultimately use the same physical CAN controller. If several host paths reconfigure the same interface, the last setting becomes active. In production, use one host entry point to control a given CAN bus.

Restore Communication Defaults

AT+CFGERASE

Success returns OK and restores the defaults on this page. The command clears saved CAN/CAN FD, RS485, SPI mode, RAW target, and power-on batch settings. It does not delete offline batch contents or factory identification.

If repeated configuration changes return ERR,5, use this command to clear the communication configuration area and then set the required values again.

Troubleshooting

Symptom

Action

Changing the USB terminal bitrate does not change the bus speed

This is normal for a virtual USB serial port; use the AT+ commands on this page

A configuration command returns nothing

Send it as text with a CRLF line ending

Command returns ERR,1 or ERR,3

Check the parameter count and allowed values

Command returns ERR,5

The configuration area is full; run AT+CFGERASE and configure it again

SocketCAN stops working after reconnecting

Reapply the Linux ip link configuration