CAN Communication
Last updated
Last updated
The CAN frame is designed to mimic CANOpen communication protocol.
The CAN ID field is divided into two fields, a 4-bit function code and a 7-bit node ID.
The NMT frame is used to configure the operational mode of the motor controller.
To configure the operational mode, the master sends an NMT frame to the slave device. In the NMT frame, byte 0 is set to be the requested mode, and byte 1 is set to be the target device ID.
The SDO frames are used to configure the device parameters.
To read the current value from a parameter, the master sends out a RECEIVE_SDO frame. The 5-7 bit in byte 0 should be set to 2 (upload). Byte 1-2 should be set to the address of the target parameter.
After sending, the master should listen for a TRANSMIT_SDO frame from the slave device. Byte 0-3 should contain the resulting data.
To write a new value to a parameter, the master sends out a RECEIVE_SDO frame. The 5-7 bit in byte 0 should be set to 1 (download). Byte 1-2 should be set to the address of the target parameter. Byte 4-7 should contain the new value of the parameter. The slave does not transmit a response for write requests.
The PDO1 frame is used to detect if the target device is present on the bus. The frame can also be used for debugging purpose.
The master sends out a RECEIVE_PDO_1 frame.
The slave will respond with a TRANSMIT_PDO_1 frame. The data will echo the received frame.
The PDO2 frame is used for normal control.
The master sends out a RECEIVE_PDO_2 frame. The data field contains the target position and velocity in fp32 format.
The slave will respond with a TRANSMIT_PDO_2 frame. The data field contains the measured position and measured velocity in fp32 format.
The PDO3 frame is used for torque compensation control.
The master sends out a RECEIVE_PDO_3 frame. The data field contains the target position and target feed-forward torque in fp32 format.
The slave will respond with a TRANSMIT_PDO_3 frame. The data field contains the measured position and measured torque in fp32 format.
The PDO4 frame is used for event-driven update frame.
When fast-frame update is enabled, the slave will periodically send out TRANSMIT_PDO_4 frames containing the current measured position and velocity.
The FLASH frame is used to save and load the configuration parameters.
When storing the current parameters to flash, the master sends out a FLASH frame. Byte 0 should set to 1 (store).
When loading the current parameters to flash, the master sends out a FLASH frame. Byte 0 should set to 2 (load).
In both cases, the slave will not respond frame.
The HEARTBEAT frame is used to update the safety watchdog timer.
The master sends out a HEARTBEAT frame. Upon receiving the frame, the slave will reset its safety watchdog timer.
Log all data and error frames
Example: