CANOpen¶
Module Support¶
CANOpen is supported by only the Fortiq-42 modules.
CANOpen Implementation¶
Vertiq’s CANOpen implementation is based on the CAN in Automation (CiA) 301 standard. All Vertiq modules connect to the CAN bus as a slave node with a bitrate of 500kbps. The bitrate is fixed.
Vertiq modules support standard message objects Emergency (EMCY), Process Data Object (PDO), Service Data Object (SDO), Network Management (NMT), as well as Layer Setting Services (LSS).
CANOpen Frame¶
CANOpen uses only the standard 11-bit CAN-ID CAN frame for communication. CANOpen splits the CAN-ID into a 4 bit function code, and a 7 bit node id:
Function Codes (Command IDs)¶
The possible function codes are summarized below:
The Resulting CAN-IDs column represents the possible values for the resulting 11 bit CAN-ID from the combination of the function code and the node id.
Emergency Data Object Type (EMCY)¶
The emergency object is responsible for reporting internal CANOpen node errors. There are several predefined error codes in the CANOpen standard. A summary of these errors can be found here.
Process Data Objects (PDO)¶
The PDO service provides a method to request and receive real time data. PDO data transfers are unidirectional, meaning that a full data transfer is only completed in one direction. Vertiq’s implementation of PDO objects requries a master node that can create, and periodically transmit, SYNC messages. On reception of the SYNC message, the Vertiq node will send back both the current observed angle and velocity as a concatenated 8 Byte value. The first 4 Bytes represent the observed angle, and the last 4 represent the observed velocity. Both observed angle and velocity are float values. Syncronous PDO communication is described by the following image:
Shown above is the standard synchronous PDO process. The master node is responsible for sending the Sync object shown by the diamond topped lines. Within the time alloted by the Synchronous window length, slave nodes send back the data stored in the mapped object directory entries. Using Vertiq modules as an example, on reception of the Sync object, the module will send back OD entries 0x2007 and 0x2008, observed angle and velocity. The objects returned by the slave node are illustrated as Objects mapped into synchronous RPDO in the image.
Service Data Objects (SDO)¶
The SDO service provides read/write access to a CANOpen node’s Object Dictionary (OD) entries (see Object Dictionary). This is the simplest way to send information between nodes. One node starts a request to either upload or download (read or write) information from another node’s OD, and the receiving node responds with either the requested data, or a confirmation that the write data was received and stored properly. SDO communication is used for motor control on Vertiq modules.
The following is a high level description of an information request from OD entry 0x2000. For more information on the SDO specification, see the 301 standard.
Network Management (NMT)¶
The NMT service is responsible for running the overall CANOpen state machine. Its state is reported in each producer heartbeat sent by the node. For more information about CANOpen’s heartbeat service visit this site.
More information on the NMT service can be found on the CiA website.
Object Dictionary¶
The Object Dictionary (OD) is the core data storage method in CANOpen. The CANOpen standard defines the following index structure for the locations of various forms of data:
OD entries can be single variables, arrays of a single data type, or records with any number of different data types. All OD entries have an index in the dictionary, and arrays and records have additional sub-indices to access specific entries within the structure. The index and sub-index are the main methods of accessing an OD entry through SDO and PDO communication.
Vertiq Manufacturer Specific Object Dictionary¶
In order to interact with Vertiq specific parameters for motor control, you must interact with the entries beginning at 0x2000 (manufacturer-specific profile area). Vertiq’s manufacturer specific Object Dictionary objects are described in the following table:
OD Index |
Name / Subindex |
Data Name |
Units |
Data Type |
Access |
Description |
---|---|---|---|---|---|---|
0x2000 |
Go to Position |
|||||
0x00 |
Position |
\(\text{rad}\) |
float |
SDO RW |
Move to a desired location, specified in radians, away from 0 rad |
|
0x2001 |
Control PWM |
|||||
0x00 |
PWM |
\(\text{N/A}\) |
float |
SDO RW |
Spin the motor at a specified PWM [-1, 1] |
|
0x2002 |
Control Volts |
|||||
0x00 |
Voltage |
\(V\) |
float |
SDO RW |
Spin the motor at a specified Voltage [-Vbat, Vbat] |
|
0x2003 |
Control Velocity |
|||||
0x00 |
Velocity |
\(\frac{rad}{s}\) |
float |
SDO RW |
Spin the motor at a specified Velocity |
|
0x2004 |
Trajectory |
|||||
0x00 |
No. Entries |
\(\text{N/A}\) |
uint8 |
The number of entries in the Trajectory Object Directory Entry |
||
0x01 |
Displacement |
\(\text{rad}\) |
float |
SDO RW |
The desired ending position of the trajectory |
|
0x02 |
Angular Velocity |
\(\frac{rad}{s}\) |
float |
SDO RW |
The maximum velocity with which to perform the trajectory |
|
0x03 |
Acceleration |
\(s\) |
float |
SDO RW |
The acceleration with which to reach the average trajectory velocity |
|
0x04 |
Trajectory Duration |
\(\frac{rad}{s}\) |
float |
SDO RW |
The length of time it should take to complete the trajectory |
|
0x05 |
Average Velocity |
\(\frac{rad}{s^2}\) |
float |
SDO RW |
The average velocity with which to complete the trajectory |
|
0x2005 |
Stop Command |
|||||
0x00 |
No. Entries |
\(\text{N/A}\) |
uint8 |
SDO RW |
The number of entries in the Stop Command Object Directory Entry |
|
0x01 |
Coast |
\(\text{N/A}\) |
uint8 |
SDO RW |
A command to coast the motor |
|
0x02 |
Brake |
\(\text{N/A}\) |
uint8 |
SDO RW |
A command to brake the motor |
|
0x2006 |
Max Velocity |
|||||
0x00 |
Velocity |
\(\frac{rad}{s}\) |
float |
SDO RW |
The maximum velocity the motor may reach |
|
0x2007 |
Observed Angle |
|||||
0x00 |
Observed Angle |
\(\text{rad}\) |
float |
SDO/PDO RO |
The current observed angle |
|
0x2008 |
Observed Velocity |
|||||
0x00 |
Observed Velocity |
\(\frac{rad}{s}\) |
float |
SDO/PDO RO |
The current observed velocity |
The Access Column specifies how each object dictionary entry may be accessed. All spin control parameters are read/write accessible via the Service Data Object (SDO) protocol. The real time variables Observed Angle and Observed Velocity are read only accessible through either SDO or the Process Data Object (PDO) Protocol. To interact via PDO, you must have a secondary CANOpen node capable of creating SYNC messages. Only after reception of a SYNC message will the observed angle and velocity be read via PDO.
Node ID and Layer Setting Services (LSS)¶
All Fortiq modules default to a CANOpen Node-ID of 1. This value is user settable via the Layer Setting Services (LSS) protocol. Node ID changes via LSS will be saved to persistent memory, meaning you only need to change the value once in your initial system setup. Your Node ID may be changed at any time.
Please refer to this document for further details on Layer Setting Services.
Please note, in order to change your Node-ID, the motor must be in LSS configuration mode, all LSS commands must contain 8 bytes of data, and Node ID must not be part of the COB-ID.
Sample CANOpen Project with Fullmo Kickdrive¶
The following are images and descriptions of a project in Fullmo Kickdrive. Fullmo Kickdrive is used to connect with a PCAN-USB interface to a CAN bus with 1 or more connected Vertiq modules.
Spinning your Module¶
Open Fullmo Kickdrive
Create a new project using CANopen Nodes Easy Setup
Connect with the PCAN-USB interface using the CAN Interface tab. Make sure Communication Port is set to “peak” and Baud Rate to 500K
Select “Start Interface,” and the bar should turn green and read “Running”
On the top bar, select the down arrow on User Level, and select Expert. The password to move forward is expert
If connecting more than one motor, right click on CANopen Node 01, select Copy Module
Right click again and select Paste Module to create another CANopen Node
Connect your motor(s) to the CAN bus as in the diagram below, and power it/them on
Open the Object Editor tab from the Module list, and select Open Dict.
Select the supplied fortiq.xdd file from Vertiq’s website
Set Node ID to 1 (or your current Node ID)
From the Object Dictionary, double click controlVelocity, it will open in the Object Editor
Double click the Value/Editor box and enter 10 (set up to set the velocity to 10 rad/sec)
Deselect the box, and reselect the whole entry so that it turns blue
Select Write, and your motor should begin to spin
To stop your motor, click the drop-down on stopCommand, and double click Coast
Set Coast to 1, and click Write
Changing your Node-ID¶
In order to change your module’s Node-ID please first follow steps 1-8 from Spinning your Module to connect to the CAN bus
Note
If you are connecting more than one module to the CANOpen bus, and desire independent control of each, you must set unique Node-IDs. To set unique Node-IDs, you must complete the following steps for one module at a time. Connecting multiple modules to the bus and performing these steps will change both nodes’ Node-ID to the same value.
Open CAN Sender
Replace the default program with the following (a script to set a Node ID to 5), and enter your desired nodeId
nodeId = 5 send canid(0x7E5),8,04 canunsigned8(1) 00 00 00 00 00 send canid(0x7E5),8,11 canunsigned8(nodeId) 00 00 00 00 00
Click Play
In CAN Monitor, you should see 2 TX messages followed by a received message
Reboot your motor, and you should see its Node ID has changed
You will now be able to control multiple modules independently when all are properly connected to the CANOpen bus