Servosila-SC-25-Programming-Guide

Encoding and Decoding
General message structure
All types of messages consist of just two components, a CAN ID and a binary Payload.
CAN ID is an addressing mechanism in a CAN bus network. CAN ID is defined as a sum
of Node ID and a COB ID. To create a CAN ID, just take your Servosila device’s unique
Node ID and add a COB ID listed in Servosila Device Reference document for the given
type of message.
Node ID is a unique identifier assigned to every Servosila SC-25 Brushless Motor
Controller, or to any other device in a CANopen network. The identifier assigned to a
Servosila controller can be changed using the “Servoscope” software tool.
COB ID is an integer number that defines what kind of message this is (a command,
telemetry, or a configuration management message). The COB IDs are given in Servosila
Device Reference document for each command or telemetry message, and are
standardized by CANopen. There are just 8 possible COB IDs predefined in CANopen
standard for commands and telemetry messages, and a few more COB IDs are defined for
configuration management or network management.
Payload is always an 8 byte array (binary). The contents of the payload depend on the
kind of message being sent or received.
Supported APIs accept those two components (CAN ID and Payload) one way or another when
sending or receiving messages (see sample C++ projects). Linux cansend command uses a ‘#’
symbol to separate CAN ID and Payload components in a command line API call. The payload is
encoded as a string of hexadecimal symbols, two hex symbols per each byte of Payload:
14 www.servosila.com
Node ID + COB ID
Payload (8 bytes, binary)CAN ID (11 bits)
0 1 2 3 4 5 6 7
Example CAN ID computation:
if Node ID is 5, and COB ID is 0x200,
then CAN ID is 0x205