Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

2206/3510/4305 Communication Spec

1. Can Communication Protocol Overview ........................................................................................................ 2


1.1 The CAN baud rate ................................................................................................................................2
1.2 CAN communication module ................................................................................................................2
1.3 Configure the CAN ID of the motor module .........................................................................................2
1.4 Configure the master ID ....................................................................................................................... 3
1.5 Standard frames and Extended frames ................................................................................................ 3
2.Overview of motor modes ...............................................................................................................................4
2.1 Motor mode includes ........................................................................................................................... 4
3.Explanation and response of the protocol ...................................................................................................... 4
3.1 Byte definition ...................................................................................................................................... 4
3.2 Standard Frame .................................................................................................................................... 5
3.2.1 Special Instruction ..................................................................................................................... 5
3.2.2 General instructions .................................................................................................................. 6
3.3 Response data of the motor module ....................................................................................................7
3.3.1 Normal Mode .............................................................................................................................7
3.3.2 Expansion Mode (Exclusive to 3510) .........................................................................................7
3.3.3 Encoder Mode (Exclusive to 2206) ............................................................................................ 8
4.Program example ............................................................................................................................................ 8

Skyline Innovation Co.,Limited. 1


1. Can Communication Protocol Overview

1.1 The CAN baud rate

The CAN baud rate can be adjusted from 100K to 1M bit/s, with hardware including CAN_H, CAN_L
and GND three signal pins. Generally, a 120-ohm terminal resistor needs to be paralleled at the
transmitting end and the receiving end. The CAN communication rate of the motor module can be set by a
serial port.

1.2 CAN communication module

Motor modules are slaves, using a one-on-one communication mode, i.e. the master sends commands
and the slave responds to commands. If the master does not send commands with the corresponding ID,
the slave will not actively send data on the bus. It takes 500us to respond to the master after receiving the
command. Therefore, the maximum communication interval supported by the system is 500us.

1.3 Configure the CAN ID of the motor module

The motor module's own ID can be configured via the serial port, and any number between 0 and 100
can be selected. Note that the same bus cannot have duplicate IDs.

Skyline Innovation Co.,Limited. 2


1.4 Configure the master ID

The master ID is also written into the motor module through the serial port. In this way, when the
motor module receives a CAN data frame that meets the specification, it will send a response data frame to
the master ID set in advance. The default master ID is 100, i.e. the controller sets its own ID to 100 to
receive the response from the motor module.

1.5 Standard frames and Extended frames


Skyline Innovation Co.,Limited. 3
Can uses standard frames and extended frames for communication, and does not currently support
FDCan mode. Standard frames are used for general communication and extended frames are used for some
special settings. Standard frames and extended frames use the same ID.

2.Overview of motor modes

2.1 Motor mode includes

P - Position Mode Position and torque double closed-loop mode (3510,4305 exclusive);
S - Speed Mode Speed and torque double closed-loop mode;
C - Current Mode Torque closed-loop mode;
F - Pos-Speed Mode Speed and position control mode (3510 exclusive);
V - Pos-3loop Mode Position, speed and torque three closed-loop mode;
D - Encoder Mode Encoder output mode (2206 exclusive);
T - Custom Mode Custom mode (not open).
*Refer to the corresponding product manual for the specific operating modes supported by each
motor.

3.Explanation and response of the protocol

All CAN frames receivable by the motor module are 8 bytes


Extended frame: used to set the motor (valid for 3510)

3.1 Byte definition

Skyline Innovation Co.,Limited. 4


ID: 2 bytes Data: 8 bytes
Byte 1

Bit8 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1

Not Use Not Use Not Use Not Use Not Use Expand Extended Multi-circle
PWM Position Disable
should be 0 should be 0 should be 0 should be 0 should be 0 output Mode 1 = +-1Cycle
1 = PWM 1 = 16bit 0 = +-2Cycle
Output 0 = 32bit
0 = PWM
Input

Byte 2-8
Not used

3.2 Standard Frame

The motor module can receive instructions, 8 bytes in total, divided into two categories:

3.2.1 Special Instruction

0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFE


Set the motor zero position, the motor receives and takes the current position as the mechanical zero
position of the motor, that is, the motor position value is 0 at the current position, this data is not stored in
the flash and is invalid after power failure. Note that this instruction is invalid when the motor has dual
encoders and the motor module takes the zero position of the end encoder as the absolute zero position.

0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFC


Start the motor, the motor starts running according to the preset mode and position, speed, torque
instructions, refer to the general instruction description for setting mode.

0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFD


Stop the motor, the motor has no external output force.

0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xF8


Switch to position speed torque three closed-loop mode.

0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xF9


Switch to torque control mode.

0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFA


Switch to speed torque control mode.

Skyline Innovation Co.,Limited. 5


0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFB
Switch to position torque control mode.

3.2.2 General instructions

a. Set the motor position, speed, torque, position loop Kp, Kd, where Kp affects the response time of
the position loop, Kd affects the damping of the position loop, and there is no integral control item in the
position loop. Speed loop Kp, Ki Kd are not currently open, torque loop Kp can be set directly through the
serial port, torque loop Ki Kd is not currently open.

Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7 Byte8

Position Position Speed Speed Position Kp Position Kd Position Kp Torque


Command Command Command Command Low 4bits High 8bits Low 4bits + Command
High 8bits Low 8bits High 8bits Low 4bits+ Torque Low 8bits
Position Kp Command
High 8bits High 4bits

Position command
The position command is 16 bits long, from 0x0000 to 0xFFFF, 0X8000 is the position command 0, so
when the host computer sends the command, it needs to offset 0X8000. The full range of position
command is set to Pmax in the serial port. When Pmax = 1, the range of position command is +-1 circle,
that is, 0XFFFF represents positive rotation of one circle, 0x0000 represents negative rotation of one circle,
When Pmax >1, the range of position command changes to +-Pmax circle.

Speed command
The speed command has 12 bits in length, from 0x000 to 0xFFF, and 0x800 is also the speed command
0. Therefore, when the upper computer sends the command, it needs to offset 0X800. The full-scale speed
command is different for different models of motors.

Torque command
The torque command is 12 bits long, ranging from 0x000 to 0xFFF, with 0x800 being torque command
0. Therefore, when the upper computer sends commands, it needs to offset 0X800. The full range of torque
commands varies from different types of motors.
*Location loop gains and location loop damping constants should be positive and no offset processing
is required. The numerical values should be adjusted according to different motor models and load
conditions.
*The definitions of different motor modes, speed, and torque commands will change.In the position-
velocity-torque closed-loop mode, the velocity command represents the maximum velocity that can be

Skyline Innovation Co.,Limited. 6


achieved by the motor under position control, and the torque command represents the maximum torque
that can be achieved by the motor.
b.Encoder instruction (Special for 2206)

Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7 Byte8

Knob Damp Knob Velocity Velocity Position Kp Position Kd Position Kp Torque


Scale Command Command Low 4bits High 8bits Low 4bits + Command
High 8bits Low 4bits+ Torque Low 8bits
Position Kp Command
High 8bits High 4bits

In encoder mode, the host sends damping commands and scale commands to the motor module,
adjusting the damping and scale value of the motor module in encoder mode. The damping ranges from 0-
255, and n represents the motor scale interval is 32*n. The total number of motor scales per rotation is
1024*n.

3.3 Response data of the motor module

The motor module responds to the host in two modes, normal mode is 6 bytes and extended mode is
8 bytes.

3.3.1 Normal Mode

Byte1 Byte2 Byte3 Byte4 Byte5 Byte6

Motor module ID Current Position Current Position Current Velocity Current Velocity Current Torque
used for host High 8 Bits Low 8 Bits High 8 Bits Low 4 Bits+ Low 8 Bits
identification Current Torque
High 4 Bits

Calculate the position, speed and torque in the same way as sending commands, and each needs to
offset the offset.

3.3.2 Expansion Mode (Exclusive to 3510)

Byte1 Byte2 Byte3 Byte4 Byte5 Byte6 Byte7 Byte8

Skyline Innovation Co.,Limited. 7


Motor Current Current Current Current Current Current Current
module ID Position Position Velocity Velocity Torque Position Position
used for host 15-8 bit 7-0 bit High 8 Bits Low 4 Bits+ Low 8 Bits 31-24 bit 23-16 bit
identification Current
Torque
High 4 Bits

In extended address mode, the location data uploaded by the motor module changes from 16 bits to
32 bits, and the position code value changes by 1024 each time the motor rotates one circle.

3.3.3 Encoder Mode (Exclusive to 2206)

Byte1 Byte2 Byte3 Byte4 Byte5 Byte6

Motor module ID Current Position Current Position Current Position Current Position Current motor
used for host 31-24 bit 23-16 bit 15-8 bit 7-0 bit rotation direction
identification 1 CW
-1 CCW
0 Keep still

In encoder mode, the position calculation uses 32-bit data, and the position data value changes 1024
when the motor rotates one round.

4.Program example

Host using the following code to communicate with the motor module (position mode):
CanSendProcess()
{
s_p_int = 0x8000;
s_v_int = 0x900;
s_Kp_int = 0x800;
s_Kd_int = 0x800;
s_c_int = 0x900;
g_transmit_message.tx_data[0] = s_p_int>>8;
g_transmit_message.tx_data[1] = s_p_int&0xFF;
g_transmit_message.tx_data[2] = s_v_int>>4;;
g_transmit_message.tx_data[3] = ((s_v_int&0xF)<<4) + (s_Kp_int >>8);
g_transmit_message.tx_data[4] = s_Kp_int &0xFF;
g_transmit_message.tx_data[5] = s_Kd_int>>4;
g_transmit_message.tx_data[6] = ((s_Kd_int &0xF)<<4) + (s_c_int >>8);

Skyline Innovation Co.,Limited. 8


g_transmit_message.tx_data[7] = s_c_int&0xFF;;
CanSend();
}

Skyline Innovation Co.,Limited. 9

You might also like