CANopen protocol reference
This page describes the CANopen implementation of the BAC6 controllers. It gives the CAN settings, the message formats and the configuration of the Process Data Objects (PDOs). Use it with the CANopen setup and the Modbus parameter dictionary.
Firmware
This page applies to firmware 6.020 and later.
Controllers and firmware with CAN
You can use CANopen only when the controller hardware and the firmware variant both have CAN.
- Hardware: BAC355/555/855 controllers with the JST connector have CAN only on the TTL-CAN and CAN-BT variants (pins 19 and 20). All waterproof Higo variants have CAN. BAC2000/4000/8000 controllers have CAN on the 16-pin Molex connector (pins 10 and 11). For the CAN-H and CAN-L pins of your controller, refer to Connector pinouts.
- Firmware: in firmware 6.026 and later, variant 002 does not support CANopen. Variants 001, 003 and 004 support it. Refer to Firmware release notes.
How it works
The controller uses the standard CANopen protocol, with some ASI extensions.
The controller parameters are in the Modbus parameter dictionary. The controller maps each Modbus address to a CANopen index (0x2000 to 0x2024) and sub-index. Thus you can read and write all parameters over CAN, serial or Bluetooth. For the conversion formula, refer to Read and write parameters with SDOs.
You configure the PDOs through parameters in the dictionary, not through the standard CANopen PDO objects. This is different from the CANopen specification. But you can then change the PDOs with BACDoor®3 on all connections.
The controller supports these CANopen services:
| Service | Description |
|---|---|
| NMT | Network management |
| SDO | Service Data Objects |
| PDO | Process Data Objects |
| SYNC | Synchronization object |
| EMCY | Emergency objects |
Supported CANopen services
CAN settings
| Parameter | Address | Units | Range | Description |
|---|---|---|---|---|
CAN baud rate |
56 | kbps | 1000, 500, 250 or 125 | Bus speed. |
CAN ID |
57 | 1 to 127 (0x01 to 0x7F) | Node ID. The default is 42 (0x2A). | |
Communications Configuration Vector |
58 | Bit vector | Turns CAN features on or off. Refer to Communications Configuration Vector. | |
CAN sync loss timeout |
255 | ms | 0x0001 to 0x7FFF. 0 disables it. | Maximum time between two SYNC messages before the controller sets a fault. |
CAN quiet after sleep command |
1864 | ms | 0x0001 to 0x7FFF. 0 disables it. | Time that the controller stays quiet after a sleep command. Refer to Sleep command. |
CAN quiet after sync loss |
1865 | ms | 0x0001 to 0x7FFF. 0 disables it. | Time that the controller stays quiet after a sync loss, before it resets. Used only when Communications Configuration Vector bit 3 is enabled. |
CAN heartbeat period |
1866 | ms | 0x0010 to 0x7FFF. 0 disables it. | Period of the heartbeat message. |
can auto ID |
1676 | Read only | Node ID in use after start-up. Refer to bit 13 below. |
CAN settings
Communications Configuration Vector
| Bit | Name | Description |
|---|---|---|
| 0 | Extended 29bit ID | Changes all CANopen IDs to 29-bit extended IDs for transmit and receive. For example, ID 0x034 becomes 0x00000034. |
| 1 | CAN Faults Enable | Lets CAN bus errors set a fault and a warning. When the CAN controller goes to the Error Passive state, the controller sets the CAN Bus fault. When it goes to the Error Warning state, it sets the CAN Bus warning. The warning clears automatically. The fault stays until you clear it. |
| 2 | Obsolete | Not used. |
| 3 | Sleep on sync loss | After a sync loss fault, the controller stays quiet for CAN quiet after sync loss, then resets. When this bit is disabled, the controller stays in the fault state until you clear the fault or restart the controller. |
| 4 | auto operational | The controller goes to the Operational state without NMT messages. If CAN heartbeat period is set, it moves one state at each heartbeat (Boot, Pre-Operational, Operational). If not, it moves immediately. |
| 5 | Autoset CANopen COBID for TPDOs | Sets the COB-IDs of TPDO1 to TPDO4 from the node ID. |
| 6 | Autoset CANopen COBID for RPDOs | Sets the COB-IDs of RPDO1 to RPDO4 from the node ID. |
| 7 | CAN Enable | Turns on CAN communication. CAN does not operate without this bit. |
| 8, 9 | Reserved | |
| 10, 11 | Used by other communication protocols. They do not change the CAN settings. | |
| 12 | Disable CAN termination resistor | Disconnects the internal termination resistor from the bus. Refer to Terminate the bus. |
| 13 | Enable automatic CAN ID adjustment | At start-up, the controller changes CAN ID from the Cruise and PFS inputs. It adds 1 if Cruise is high, 2 if PFS is high, and 3 if both are high. Thus two controllers with the same parameter file can operate on the same bus. Read the node ID in use from can auto ID (1676). |
| 14 | Enable RTR | Lets a TPDO transmit when it receives a remote transmission request (RTR) frame. Refer to Configure a TPDO. |
| 15 | Reserved |
Communications Configuration Vector (address 58) bits
Message format
All CANopen messages have this format:
| Bits 0 to 10 | Bit 11 | Bits 12 to 15 | 0 to 8 bytes |
|---|---|---|---|
| COB-ID | RTR bit (usually not used) | Data length | Data |
CANopen message format
When two or more messages go on the bus at the same time, the message with the lowest COB-ID has priority.
CANopen data is little-endian. In a value of two or more bytes, the least significant byte is first. For example, the controller sends index 0x1122 as 0x22, then 0x11.
Service Data Objects (SDO)
Use an SDO to read or write one parameter. All parameters are four bytes or less, so the controller uses only expedited SDOs. You can send SDOs in the Pre-Operational and Operational states.
Read a parameter
Send this message:
| COB-ID | Length | Byte 0 | Bytes 1, 2 | Byte 3 | Bytes 4 to 7 |
|---|---|---|---|---|---|
| 0x600 + node ID | 8 | 0x40 | Index | Sub-index | 0 |
SDO read request
The controller replies:
| COB-ID | Length | Byte 0 | Bytes 1, 2 | Byte 3 | Bytes 4 to 7 |
|---|---|---|---|---|---|
| 0x580 + node ID | 8 | Response code | Index | Sub-index | Data |
SDO read response
| Response code | Data returned |
|---|---|
| 0x43 | 4 bytes |
| 0x47 | 3 bytes |
| 0x4B | 2 bytes |
| 0x4F | 1 byte |
SDO read response codes
Write a parameter
Send this message:
| COB-ID | Length | Byte 0 | Bytes 1, 2 | Byte 3 | Bytes 4 to 7 |
|---|---|---|---|---|---|
| 0x600 + node ID | 8 | Command | Index | Sub-index | Data |
SDO write request
| Command | Data to write |
|---|---|
| 0x23 | 4 bytes |
| 0x27 | 3 bytes |
| 0x2B | 2 bytes |
| 0x2F | 1 byte |
SDO write commands
When the write is complete, the controller replies on 0x580 + node ID with 0x60 in byte 0.
Error responses
If the controller cannot do a read or a write, it replies:
| COB-ID | Length | Byte 0 | Bytes 1, 2 | Byte 3 | Bytes 4 to 7 |
|---|---|---|---|---|---|
| 0x580 + node ID | 8 | 0x80 | Index | Sub-index | Error code |
SDO error response
| Error code | Meaning |
|---|---|
| 0x05040001 | The command is not valid or not known. |
| 0x06010000 | The access to the object is not supported. |
| 0x06020000 | The object is not in the object dictionary. |
| 0x06070010 | The data type does not agree with the length. |
| 0x06090011 | The sub-index does not exist. |
SDO error codes
Network management (NMT)
Send this message to change the network state of the controller. The heartbeat message shows the state.
| COB-ID | Length | Byte 0 | Byte 1 |
|---|---|---|---|
| 0x000 | 2 | Command | Node ID |
NMT command
| Command | Result |
|---|---|
| 0x01 | Go to the Operational state |
| 0x02 | Go to the Stopped state |
| 0x80 | Go to the Pre-Operational state |
| 0x81 | Reset the node |
| 0x82 | Reset communication |
NMT commands
SYNC
The SYNC message keeps the nodes in the Operational state. It also tells the nodes when to process or transmit their synchronous PDOs.
| COB-ID | Length | Data |
|---|---|---|
| 0x080 | 0 | None |
SYNC message
If CAN sync loss timeout is set, the controller monitors the time between SYNC messages. If no SYNC message comes in that time, the controller goes to the Pre-Operational state. It also sets the CAN bus fault (Faults2 bit 5). For what occurs next, refer to Communications Configuration Vector bit 3.
Sleep command
To put the controller to sleep, write 0x7D or 0x7E to index 0x6001, sub-index 0, with an SDO. When the controller is no longer in the Run state, CAN goes to the Pre-Operational state and waits for an NMT command.
Heartbeat
When CAN heartbeat period is set, the controller sends this message at that period:
| COB-ID | Length | Byte 0 |
|---|---|---|
| 0x700 + node ID | 1 | State |
Heartbeat message
| State | Meaning |
|---|---|
| 0x00 | Boot-up |
| 0x04 | Stopped |
| 0x05 | Operational |
| 0x7F | Pre-Operational |
Heartbeat states
Emergency (EMCY)
When faults, faults2, faults3, warnings or warnings2 changes, the controller sends an EMCY message one time. There are two message types.
| COB-ID | Length | Bytes 0, 1 | Byte 2 | Byte 3 | Bytes 4, 5 | Bytes 6, 7 |
|---|---|---|---|---|---|---|
| 0x080 + node ID | 8 | 0x1000 | Error register | faults2 low byte |
faults |
warnings |
EMCY message, type 1
| COB-ID | Length | Bytes 0, 1 | Bytes 2, 3 | Bytes 4, 5 | Bytes 6, 7 |
|---|---|---|---|---|---|
| 0x080 + node ID | 8 | 0x2000 | faults2 |
warnings2 |
faults3 |
EMCY message, type 2
For the meaning of each fault and warning bit, refer to Faults and warnings.
The error register (type 1 only) has these bits:
| Error register bit | Meaning |
|---|---|
| 0 | Generic error |
| 1 | Current |
| 2 | Voltage |
| 3 | Temperature |
| 4 | Communication error |
| 5 | Device profile specific |
| 6 | Peripheral error |
| 7 | Manufacturer specific |
EMCY error register bits
Process Data Objects (PDO)
A PDO sends or receives one to four parameters in one message, without a request. The controller has 12 transmit PDOs (TPDOs) and 12 receive PDOs (RPDOs). PDOs operate only in the Operational state.
CANopen defines COB-IDs only for PDOs 1 to 4. PDOs 5 to 12 must have a custom COB-ID. Refer to Custom COB-IDs.
TPDO and RPDO messages
| COB-ID | Length | Bytes 0, 1 | Bytes 2, 3 | Bytes 4, 5 | Bytes 6, 7 |
|---|---|---|---|---|---|
| PDO COB-ID | 2 to 8 | Map 1 | Map 2 (if set) | Map 3 (if set) | Map 4 (if set) |
PDO message
The standard COB-IDs are:
- TPDO n: 0xn80 + node ID. For example, TPDO2 for node ID 0x2A is 0x2AA.
- RPDO n: 0x(n+1)00 + node ID. For example, RPDO2 for node ID 0x2A is 0x32A.
The controller uses these COB-IDs when Communications Configuration Vector bit 5 (TPDOs) or bit 6 (RPDOs) is enabled.
In firmware 6.021 and later, an RPDO can have an odd number of data bytes. PDOs also support the full 29-bit extended ID range.
When the controller receives a message with the COB-ID of one of its RPDOs, it writes the data to the mapped parameters.
Configure a TPDO
Each TPDO has these parameters. All are 16-bit. The addresses below are for TPDO1. For the other TPDOs, refer to the Modbus parameter dictionary.
| Parameter | Address (TPDO1) | Description |
|---|---|---|
TPDO1 COBID (low word) |
1872 | Transmit COB-ID, from 0x0001 to 0x07FF. Used when bit 5 is disabled. The node ID is not added. |
TPDO1 COBID (high word) |
1873 | Control bits. Refer to the table below. Set to 0x0000 if you do not use them. |
TPDO1 size (words) |
1824 | Number of mapped parameters, 1 to 4. |
TPDO1 transmission type |
1825 | 0: transmit only at the event time. 1 to 240: transmit on every Nth SYNC message. For example, 4 transmits on every fourth SYNC. |
TPDO1 event time |
1826 | Time between transmissions when the transmission type is 0, from 10 ms to 32767 ms. 0 disables it. |
TPDO1 map1 index to TPDO1 map4 index |
1817, 1819, 1821, 1823 | CANopen index of each mapped parameter. |
TPDO1 map1 sub index and size to TPDO1 map4 sub index and size |
1816, 1818, 1820, 1822 | High byte: sub-index. Low byte: size in bits (0x10 for a 16-bit parameter). |
TPDO parameters
| Bit | Name | Description |
|---|---|---|
| 15 | PDO disable | 1 disables the TPDO. |
| 14 | RTR enable | The TPDO transmits when it receives an RTR frame, not at the event time or on SYNC. The event time or SYNC count sets how often the data is updated. Communications Configuration Vector bit 14 must also be enabled. |
| 13 | Extended ID | The TPDO uses a 29-bit extended ID. The low word holds the last 11 bits of the extended ID. |
| 0 to 12 | Not used. |
TPDO COBID (high word) control bits
Note
In firmware 6.026 and earlier, TPDOs do not send the parameter values when the parameter read lock is on. Firmware 6.027 corrects this. Refer to Parameter read/write lock.
Fixed values: In firmware 6.027 and later, a TPDO can send a fixed value. Set the low byte of the map sub index and size parameter to 0xCC. The TPDO then sends the value of the map index parameter.
Example: TPDO1 map 1 to map 4 have index 0x201A, sub-indices 0x1B, 0x1C, 0x1D and 0x1E, and size 0x10. These are Modbus addresses (0x201A − 0x2000) × 64 + (sub-index − 1): 1690, 1691, 1692 and 1693.
Configure an RPDO
Each RPDO has these parameters. All are 16-bit. The addresses below are for RPDO1.
| Parameter | Address (RPDO1) | Description |
|---|---|---|
RPDO1 COBID (low word) |
1868 | Receive COB-ID, from 0x0001 to 0x07FF. Used when bit 6 is disabled. The node ID is not added. |
RPDO1 COBID (high word) |
1869 | Control bits. Refer to the table below. Set to 0x0000 if you do not use them. |
RPDO1 size (words) |
1800 | Number of mapped parameters, 1 to 4. |
RPDO1 transmission type |
1801 | 0 disables the RPDO. A value that is not zero enables it. The controller processes the message when it receives it. |
RPDO1 timeout |
1802 | Not used. |
RPDO1 map1 index to RPDO1 map4 index |
1793, 1795, 1797, 1799 | CANopen index of each mapped parameter. |
RPDO1 map1 sub index and size to RPDO1 map4 sub index and size |
1792, 1794, 1796, 1798 | High byte: sub-index. Low byte: size in bits. |
RPDO parameters
| Bit | Name | Description |
|---|---|---|
| 15 | PDO disable | 1 disables the RPDO. |
| 14 | Reserved | |
| 13 | Extended ID | The RPDO uses a 29-bit extended ID. The low word holds the last 11 bits of the extended ID. |
| 0 to 12 | Not used. |
RPDO COBID (high word) control bits
Example: RPDO1 map 1 to map 4 have index 0x2007 and sub-indices 0x2B to 0x2E. These are Modbus addresses 490 to 493: Remote speed command, Remote maximum motoring current, Remote maximum braking current and Remote state command. For a full remote control setup, refer to Example: remote speed control.
Custom COB-IDs
To transmit or receive a PDO on a COB-ID that you select:
- Disable
Communications Configuration Vectorbit 5 (TPDOs) and bit 6 (RPDOs). - Set the PDO COBID (low word) to the COB-ID, from 0x001 to 0x7FF.
- Save to flash, then restart the controller.
A custom COB-ID does not follow the CANopen specification. Make sure that no other node on the bus uses the same COB-ID.
For example, set RPDO1 COBID (low word) to 0x0123. The controller then receives RPDO1 on COB-ID 0x123.
Diagnostics
- If
Communications Configuration Vectorbit 1 CAN Faults Enable is enabled, bus errors set the CAN Bus fault or warning. Refer to Communications Configuration Vector. - When a received message has no free mailbox, it overwrites an earlier message. The controller then increases
can message overflow count(address 1714) and sets the Missed CAN Message warning (Warnings2bit 7).
For the fault and warning settings, refer to CANopen.
Examples
Battery RPDO
This example receives the state of charge and temperature from a CAN battery on COB-ID 0x1B0.
If your battery uses a protocol that the controller supports (for example Vanguard or Phyllion), set Battery management interface type instead. Refer to Battery management system.
- Disable
Communications Configuration Vectorbit 6 Autoset CANopen COBID for RPDOs. -
Set these parameters:
Parameter Value RPDO1 COBID (high word)0x0000 RPDO1 COBID (low word)0x01B0 RPDO1 size (words)4 RPDO1 transmission type1 RPDO1 map3 index0x2007 RPDO1 map3 sub index and size0x3810 RPDO1 map4 index0x2007 RPDO1 map4 sub index and size0x3910 Battery RPDO settings
Map 1 and map 2 are not used. Map 3 and map 4 are words 3 and 4 of the message (bytes 4 to 7).
-
Save to flash, then restart the controller.
- To test, send
0x1B0 00 00 00 00 64 00 64 00. Make sure thatRemote battery SOC(address 503) changes to 100 andRemote battery temperature(address 504) changes to 100 °C.
Display TPDO
Displays use different formats. This example sends the controller status, vehicle speed, motor power and trip distance every 100 ms.
-
Set these parameters:
Parameter Value Mapped parameter TPDO1 size (words)4 TPDO1 event time100 TPDO1 map1 index0x2004 controller status(257)TPDO1 map1 sub index and size0x0210 TPDO1 map2 index0x2004 vehicle speed(260)TPDO1 map2 sub index and size0x0510 TPDO1 map3 index0x2005 motor input power(334)TPDO1 map3 sub index and size0x0F10 TPDO1 map4 index0x2006 trip meter(408)TPDO1 map4 sub index and size0x1910 TPDO1 COBID (high word)0x2000 for an extended ID, 0x0000 for a standard ID TPDO1 COBID (low word)The COB-ID that the display uses Display TPDO settings
If the display uses the standard TPDO1 COB-ID (0x180 + node ID), enable
Communications Configuration Vectorbit 5. Then you do not set the COB-ID. -
Save to flash, then restart the controller.
-
Read the message as follows:
Bytes Value Conversion Example 0, 1 Controller status 0 = Pre-Operational, 1 = Idle, 2 = Post Operational, 3 = Run, 4 = Fault 03 00: Run2, 3 Vehicle speed Divide by 256. The result is in km/h. 00 19(0x1900 = 6400): 25 km/h4, 5 Motor power W FA 00(0x00FA = 250): 250 W6, 7 Trip distance Divide by 100. The result is in km. 90 1A(0x1A90 = 6800): 68 kmDisplay TPDO data
CANopen object dictionary
Use the ASI-specific entries (0x2000 to 0x2024) to configure the controller. The standard entries below are a quick reference. Not all controllers support all of them.
| Index | Entry |
|---|---|
| 0x1000 | Device type |
| 0x1001 | Error register |
| 0x1005 | COB-ID SYNC |
| 0x1007 | Synchronous window length |
| 0x1009 | Manufacturer hardware version |
| 0x100A | Manufacturer software version |
| 0x1011 | Restore default parameters |
| 0x1017 | Producer heartbeat time |
| 0x1018 | Identity object |
| 0x1029 | Error behaviour |
| 0x1200 | Server SDO parameter 1 |
| 0x1201 | SDO server parameter 1 |
| 0x14XX | RPDO communication parameter |
| 0x16XX | RPDO mapping parameter |
| 0x18XX | TPDO communication parameter |
| 0x1AXX | TPDO mapping parameter |
| 0x1F51 | Program control |
| 0x1F57 | Flash status identification |
| 0x2000 to 0x2024 | ASI-specific entries (Modbus parameter dictionary) |
CANopen object dictionary blocks