Skip to main content

Yunxi Gloria-M Series Motor Communication Protocol

Feedback Frame

The feedback frame ID is set by the debugging assistant (Master ID), with a default of 0. It mainly feeds back the motor's position, speed, and torque information. Its frame format is defined as:

Feedback MessageD[0]D[1]D[2]D[3]D[4]D[5]D[6]D[7]
MST_IDID|ERR<<4POS[15:8]POS[7:0]VEL[11:4]VEL[3:0]|T[11:8]T[7:0]T_MOST_Rotor

Where:

  • ID indicates the controller's ID, taken from the lower 8 bits of CAN_ID
  • ERR indicates the status, corresponding to the following status types:
    • 0 — Disabled
    • 1 — Enabled
    • 8 — Overvoltage
    • 9 — Undervoltage
    • A — Overcurrent
    • B — MOS overtemperature
    • C — Motor coil overtemperature
    • D — Communication loss
    • E — Overload
  • POS indicates the motor's position information
  • VEL indicates the motor's speed information
  • T indicates the motor's torque information
  • T_MOS indicates the average temperature of the MOS on the driver, in °C
  • T_Rotor indicates the average temperature of the motor's internal coil, in °C

Position, speed, and torque use a linear mapping relationship to convert floating-point data types into signed fixed-point data, where position uses 16-bit data and both speed and torque use 12-bit. Speed is used as an example to illustrate the mapping relationship.

For example, if the current motor speed is 25.0 rad/s and the set speed range VMAX = 45 rad/s, the data message sent is:

VEL=25.0/(45(45))×212+211=3185=0xC71VEL = 25.0 / (45 - (-45)) \times 2^{12} + 2^{11} = 3185 = \text{0xC71}

Maximum Speed

The maximum speed is limited by various factors, including the supply voltage (V_BUS), the KV value, and the gear ratio (GR). An upper limit can usually be calculated using the following formula:

VMAX(rad/s)=0.57735×VBUSNpp×GR×ψf(rad/s)V_{MAX}(rad/s) = 0.57735 \times \frac{V_{BUS}}{N_{pp} \times GR \times \psi_f} \quad (rad/s)

where NppN_{pp} is the number of pole pairs and ψf\psi_f represents the rotor flux linkage.

MIT Mode

MIT mode is compatible with the original MIT control protocol, achieving flexible impedance control through a weighted combination of three dimensions: position, speed, and torque. Users can freely set the control range (P_MAX maximum position, V_MAX maximum speed, T_MAX maximum torque), and the driver converts the CAN data into control variables and, after computation, outputs the torque current set value. Its control block diagram is shown below:

MIT Mode Control Block Diagram

Figure caption: p_des — position command; v_des — speed command; t_ff — feedforward torque command; θ_m — actual motor position (feedback); dθ_m — actual motor speed (feedback); kp — position proportional coefficient; kd — position derivative coefficient; T_ref — torque reference value; 1/KT_OUT — reciprocal of the torque coefficient (converts torque to current); iqref — q-axis current command; idref — d-axis current command (always 0).

Various control modes can be derived from MIT mode. For example, when kp=0 and kd is non-zero, setting v_des achieves constant-speed rotation; when kp=0 and kd=0, setting t_ff achieves a given torque output.

Note

When controlling position, kd must not be set to 0, otherwise it will cause the motor to oscillate or even lose control.

Control Frame in MIT Mode

Control MessageD[0]D[1]D[2]D[3]D[4]D[5]D[6]D[7]
IDp_des[15:8]p_des[7:0]v_des[11:4]v_des[3:0]|Kp[11:8]Kp[7:0]Kd[11:4]Kd[3:0]|t_ff[11:8]t_ff[7:0]
  • The frame ID equals the set CAN ID value
  • P_des: position command
  • V_des: speed command
  • Kp: position proportional coefficient
  • Kd: position derivative coefficient
  • T_ff: torque command value

Each parameter conforms to the mapping relationship in the previous section, where the ranges of p_des, v_des, and t_ff can be set by the debugging assistant, the range of Kp is [0, 500], and the range of Kd is [0, 5].

A standard CAN data frame has only 8 bytes. The MIT control command format combines the five parameters Position, Velocity, Kp, Kd, and Torque bitwise into the 8 bytes, where Position occupies 16 bits, and Velocity, Kp, Kd, and Torque each occupy 12 bits, for a total of 64 bits (8 bytes).

Position-Velocity Mode

Position-velocity mode uses a three-loop cascade control of position loop → speed loop → current loop, achieving smooth and precise positional motion by specifying a target position and maximum speed. It is suitable for scenarios that require trajectory precision and compliance. Its control block diagram is shown below:

Position-Velocity Mode Control Block Diagram

Figure caption: p_des — target position command; v_des — speed command (limits the maximum absolute speed); θ_m — actual motor position (feedback); dθ_m — actual motor speed (feedback); PI — PI controller; iqref — q-axis current command; idref — d-axis current command (always 0).

  • p_des is the target position for control, and v_des is used to limit the maximum absolute speed during motion
  • Using the control parameters recommended by the debugging assistant yields good control precision; the process is relatively compliant but the response time is longer. In addition to v_des, the configurable parameters also include acceleration and deceleration; if additional oscillation occurs during control, the acceleration/deceleration values can be appropriately increased
Note

The units of p_des and v_des are rad and rad/s respectively, and their data type is float. The damping factor must be set to a non-zero positive number; refer to the notes for speed mode.

Control Frame in Position-Velocity Mode

Control MessageD[0] ~ D[3]D[4] ~ D[7]
0x100+IDp_des (float, little-endian)v_des (float, little-endian)
  • The frame ID is the set CAN ID value plus an offset of 0x100
  • P_des: position command, floating-point, low byte first, high byte last
  • V_des: speed command, floating-point, low byte first, high byte last

Here the CAN ID for sending the command is 0x100+ID, and the speed command is the speed of the constant-velocity segment during trapezoidal acceleration/deceleration.

Enable

After power-on self-check is complete, an "Enable" command must be sent before control is possible. The "Enable" frame is a control frame, with the frame ID as described above. The difference is the data segment; regardless of the mode, the data segment definition for "Enable" is the same, as follows:

D[0]D[1]D[2]D[3]D[4]D[5]D[6]D[7]
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFC

Disable

Disable is the default state of the motor at power-on. In this state, the motor's three-phase terminal voltage waveforms are identical, all being a 50% modulation wave of the supply voltage. The "Disable" frame is a control frame, with the frame ID as described above, and the data segment defined as follows:

D[0]D[1]D[2]D[3]D[4]D[5]D[6]D[7]
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFD

Save Position Zero Point

The "Save Position Zero Point" frame is a control frame, with the frame ID as described above, and the data segment defined as follows:

D[0]D[1]D[2]D[3]D[4]D[5]D[6]D[7]
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFE

Clear Error

When the motor experiences an error such as overheating, sending a "Clear" command can clear the error. The "Clear" frame is a control frame, with the frame ID as described above, and the data segment defined as follows:

D[0]D[1]D[2]D[3]D[4]D[5]D[6]D[7]
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFB

Motor Register Operations

Read Command Format

Message IDAttributedata[0]data[1]data[2]data[3]
0x7FFSTDCAND_LCAND_H0x33RID

After a successful read, the data of that register is returned. The frame format is as follows:

Message IDAttributedata[0]data[1]data[2]data[3]data[4]data[5]data[6]data[7]
MST_IDSTDCAND_LCAND_H0x33RIDData 0Data 1Data 2Data 3

The returned data is low byte first, high byte last.

Write Command Format

Message IDAttributedata[0]data[1]data[2]data[3]data[4]data[5]data[6]data[7]
0x7FFSTDCAND_LCAND_H0x55RIDData 0Data 1Data 2Data 3

After a successful write, the written data is returned, with the same frame format as sent:

Message IDAttributedata[0]data[1]data[2]data[3]data[4]data[5]data[6]data[7]
MST_IDSTDCAND_LCAND_H0x55RIDData 0Data 1Data 2Data 3

The data is low byte first, high byte last.

Store Command Format

Message IDAttributedata[0]data[1]data[2]data[3]
0x7FFSTDCAND_LCAND_H0xAARID

After a successful store, the return format is:

Message IDAttributedata[0]data[1]data[2]data[3]
MST_IDSTDCAND_LCAND_H0xAA0x01

Register Table

RID is the register. For detailed register entries, refer to the control protocol document. Only one register variable is listed here as an example:

Register AddressVariableDescriptionR/WRangeData Type
10 (0x0A)CTRL_MODEControl modeRW[1, 4]uint32_t

Parameter Description

Motor Parameters

ParameterDescription
Phase Resistance (R)The resistance value between phases, in mΩ
Phase Inductance (L)The inductance value between phases, in μH
Flux Linkage (λ)The flux linkage value of the permanent magnet field, in Wb
Viscous CoefficientThe motor's viscous coefficient, for reference only, not used, in N·m·s/rad
Moment of InertiaThe motor's moment of inertia; keep it as no-load as possible during identification, in kg·m²

Driver Parameters

ParameterDescription
Pole PairsThe number of pole pairs of the motor rotor; can be written manually or automatically calculated through calibration
Gear RatioThe reduction ratio of the external gear, indicating how much reduction the motor undergoes for output
CAN IDThe motor identification ID used for CAN communication; the final transmission uses the message format mode plus an offset value
Master IDThe CAN StdID used by the motor for CAN communication
UndervoltageUndervoltage protection threshold, in V
OvervoltageOvervoltage protection threshold, in V
OvertemperatureMotor overtemperature protection threshold, in °C
CAN TimeoutCAN communication timeout period setting, measured in units of 50 μs
AccelerationThe motor acceleration set value, in Krad/s²
DecelerationThe motor deceleration setting, in Krad/s²; keep it as consistent as possible with the acceleration value
Speed LimitThe theoretical maximum speed of the motor, a system-calculated value; if there is a gearbox, this value is the value before reduction, in rad/s
OvercurrentThe overcurrent threshold percentage of the motor phase current peak

Control Amplitudes

ParameterDescription
PMAXThe maximum position value for sending commands in MIT mode, and the maximum value used for position feedback in all modes, in rad
VMAXThe maximum speed value for sending commands in MIT mode, and the maximum value used for speed feedback in all modes, in rad/s
TMAXThe maximum torque value for sending commands in MIT mode, and the maximum value used for torque feedback in all modes, in Nm
KT_OUTThe output torque coefficient value used by the driver board; if 0.0 is used, the system's theoretical calculated value is used by default, in Nm/A
Gear CoefficientThe gear torque transmission efficiency value, default is 1
Damping FactorThe speed-loop damping factor set value, default 4.0, recommended range 2.5~20. Too small causes overshoot; too large affects rise time

Control Settings

ParameterDescription
Control ModeIncludes 3 modes: MIT mode, position-velocity mode (PV), and pure speed mode
Current BandwidthThe control bandwidth of the current loop, adjusted according to actual needs
Speed KPThe proportional parameter of the speed loop; can be set manually, and after setting, click write parameter to save permanently
Speed KIThe integral coefficient of the speed loop; can be set manually, and after setting, click write parameter to save permanently
Position KPThe proportional parameter of the position loop, effective in position-velocity mode; click "Calculate KP" to compute automatically
Position KIThe integral coefficient of the position loop, recommended to be set to 0.0