CANopen setup
Use this page to set up CAN communication on the controller. Use it when your system controls or monitors the controller over a CAN bus. For example, a vehicle control unit, a display or a battery management system (BMS) can use the CAN bus.
This page gives:
- The minimum settings to put the controller on a CAN bus.
- The bus termination.
- How to read and write parameters with Service Data Objects (SDOs).
- How to set up Process Data Objects (PDOs).
- An example setup for remote speed control.
- How to use more than one controller on a bus.
For the message formats and all the CAN settings, refer to the CANopen protocol reference.
Quick start
This section gives the minimum settings to put the controller on a CAN bus. It also gives an example setup for remote speed control. For full details of each message type, refer to the CANopen protocol reference.
ASI CANopen data is little-endian: the controller sends the least significant byte first.
Enable CAN
- Set
CAN baud rate(address 56) to the bus speed: 1000, 500, 250 or 125 kbps. The default is 250 kbps. - Set
CAN ID(address 57) to a node ID from 1 to 127 that is unique on the bus. The default is 42 (0x2A). - Check that
Communications Configuration Vector(address 58) bit 7 CAN Enable is enabled. CAN does not work without this bit. This bit is enabled in the default parameters. -
Check
Communications Configuration Vectorbit 4 auto operational. When this bit is enabled, the controller moves to the Operational state without network management (NMT) messages. IfCAN heartbeat period(address 1866) is set, it moves one state per heartbeat. Otherwise, it moves immediately. This bit is enabled in the default parameters.CAN heartbeat period(address 1866) sets how often the controller sends its own heartbeat message, in ms. 0 turns it off. The default value is 0. -
Optional: enable
Communications Configuration Vectorbit 0 Extended 29bit ID to use 29-bit extended CAN IDs. - Save to flash, then power cycle the controller.
Terminate the bus
A CAN bus must have exactly two 120 Ω termination resistors, one at each end of the bus. With the bus power off, measure the resistance between CAN-H and CAN-L. The correct value is approximately 60 Ω.
We recommend that you put the termination resistors in the harness. You cannot measure the configurable termination inside the controller. This makes troubleshooting more difficult.
The controller has an internal termination resistor. In the default parameters it is disconnected (Communications Configuration Vector bit 12 Disable CAN termination resistor is enabled). If you use it instead of a harness resistor, disable bit 12 to connect the resistor. Use it only when the controller is at one end of the bus.
Read and write parameters with SDOs
You can read or write every parameter in the Modbus parameter dictionary over CAN with Service Data Objects (SDOs). Convert the Modbus address to a CANopen index and sub-index:
| Value | Formula |
|---|---|
| Index | FLOOR(Modbus address / 64) + 8192 |
| Sub-index | REMAINDER(Modbus address / 64) + 1 |
Modbus address to CANopen index and sub-index
| Parameter | Modbus address | Index | Sub-index |
|---|---|---|---|
Communications Configuration Vector |
58 | 8192 (0x2000) | 59 (0x3B) |
Remote state command |
493 | 8199 (0x2007) | 46 (0x2E) |
TPDO1 size (words) |
1824 | 8220 (0x201C) | 33 (0x21) |
Conversion examples
CAN message IDs
The controller uses the standard CANopen message IDs (COB-IDs), based on its node ID.
| Message | COB-ID | Example for node ID 42 |
|---|---|---|
| NMT command | 0x000 | 0x000 |
| Emergency (EMCY) | 0x080 + node ID | 0x0AA |
| TPDO1 to TPDO4 | 0x180, 0x280, 0x380, 0x480 + node ID | 0x1AA, 0x2AA, 0x3AA, 0x4AA |
| RPDO1 to RPDO4 | 0x200, 0x300, 0x400, 0x500 + node ID | 0x22A, 0x32A, 0x42A, 0x52A |
| SDO response | 0x580 + node ID | 0x5AA |
| SDO request | 0x600 + node ID | 0x62A |
| Heartbeat | 0x700 + node ID | 0x72A |
Standard COB-IDs
Set up PDOs
Process Data Objects (PDOs) send or receive up to four parameters in one message. The controller sends transmit PDOs (TPDOs) and receives receive PDOs (RPDOs).
In the default parameters, only TPDO1 is set up. It sends controller status, battery voltage, motor rpm and motor current every 100 ms on COB-ID 0x1AA (0x180 + node ID 42). For the data layout, refer to the TPDO1 tab in Example: remote speed control. All other PDOs are off. To set up more PDOs:
-
Enable
Communications Configuration Vectorbit 5 Autoset CANopen COBID for TPDOs and bit 6 Autoset CANopen COBID for RPDOs. The controller then sets the COB-IDs of PDOs 1 to 4 from its node ID, as shown in CAN message IDs. These bits are off in the default parameters, so if you changeCAN IDwithout them, TPDO1 still sends on 0x1AA.If you do not use these bits, set each PDO COB-ID yourself. The COBID (low word) parameter is the COB-ID. The COBID (high word) parameter holds control bits. Set it to 0x0000 unless you use one of these features:
Bit TPDO RPDO 15 PDO disable PDO disable 14 RTR enable: transmit when an RTR frame is received Reserved 13 Extended ID Extended ID PDO COBID (high word) control bits
-
For each parameter in the PDO, set a map index and a map sub-index and size:
- Map index: the CANopen index of the parameter.
- Map sub index and size: the sub-index in the high byte and the size in bits in the low byte. For a 16-bit parameter, the low byte is 0x10.
For example, to map
Remote state command(address 493), set the map index to 0x2007 and the map sub index and size to 0x2E10. -
Set the PDO size (words) to the number of mapped parameters.
- Set the transmission type:
- TPDO: set the transmission type to 0 and the event time to the send period in ms. To send on SYNC instead, set the transmission type to N to send on every Nth SYNC.
- RPDO: set the transmission type to a non-zero value to enable the RPDO. 0 disables it.
- Save to flash, then power cycle the controller.
Command timeouts
For remote control, you must send Remote state command with a rolling watchdog counter in its high byte, within the command timeout thresholds. For the message format and the recommended thresholds, refer to Command timeouts.
Example: remote speed control
This example sets up the controller to receive speed and current-limit commands from a vehicle control unit. The controller also sends status, temperatures and faults back. It uses the PDO COB-IDs that are set automatically from the node ID.
Prerequisites
- CAN is enabled and the bus is terminated, as described above.
Communications Configuration Vectorbits 5 and 6 are enabled.Control command source(address 208) is set to 0 / Remote.Speed regulator mode(address 11) is set to 0 / Speed.- The command timeouts are set. Refer to Command timeouts.
For how the controller uses each remote command, refer to Remote motor control.
In the tables below, a scale of 40.96 means that a raw value of 4096 is 100%. A scale of 32 means that a raw value of 32 is 1 unit.
Sent by your control unit to 0x200 + node ID, on every heartbeat.
| Bytes | Parameter | Address | Scale | Unit |
|---|---|---|---|---|
| 0 | Remote state command (low byte) |
493 | 1 | 0 = Off, 1 = Idle, 2 = Run |
| 1 | Watchdog counter (high byte of Remote state command) |
493 | 1 | Rolling counter, 0 to 255 |
| 2, 3 | Remote maximum motoring current |
491 | 40.96 | % of Rated motor current |
| 4, 5 | Remote maximum braking current |
492 | 40.96 | % of Rated motor current |
| 6, 7 | Remote speed command |
490 | 40.96 | % of Rated motor speed, signed. Negative values command reverse |
RPDO1 data
| Parameter | Address | Value |
|---|---|---|
RPDO1 map1 index |
1793 | 0x2007 |
RPDO1 map1 sub index and size |
1792 | 0x2E10 |
RPDO1 map2 index |
1795 | 0x2007 |
RPDO1 map2 sub index and size |
1794 | 0x2C10 |
RPDO1 map3 index |
1797 | 0x2007 |
RPDO1 map3 sub index and size |
1796 | 0x2D10 |
RPDO1 map4 index |
1799 | 0x2007 |
RPDO1 map4 sub index and size |
1798 | 0x2B10 |
RPDO1 size (words) |
1800 | 4 |
RPDO1 transmission type |
1801 | 1 |
RPDO1 settings
Example
For node ID 42, the frame 0x22A 01 0A 00 08 66 0E 33 0F decodes as:
01: Idle.0A: watchdog counter 10.00 08(0x0800 = 2048): 2048 / 40.96 = 50% maximum motoring current.66 0E(0x0E66 = 3686): 90% maximum braking current.33 0F(0x0F33 = 3891): 95% of rated motor speed, forward.
Sent by your control unit to 0x300 + node ID.
| Bytes | Parameter | Address | Scale | Unit |
|---|---|---|---|---|
| 0, 1 | remote maximum battery current limit |
360 | 8 | A. If non-zero, used when lower than the battery current limit |
| 2, 3 | remote maximum regen battery current limit |
361 | 8 | A. If non-zero, used when lower than the regeneration battery current limit |
RPDO2 data
| Parameter | Address | Value |
|---|---|---|
RPDO2 map1 index |
1805 | 0x2005 |
RPDO2 map1 sub index and size |
1804 | 0x2910 |
RPDO2 map2 index |
1807 | 0x2005 |
RPDO2 map2 sub index and size |
1806 | 0x2A10 |
RPDO2 size (words) |
1812 | 2 |
RPDO2 transmission type |
1813 | 1 |
RPDO2 settings
Sent by the controller from 0x180 + node ID, every 100 ms. This is the same as the default TPDO1.
| Bytes | Parameter | Address | Scale | Unit |
|---|---|---|---|---|
| 0, 1 | controller status |
257 | 1 | 0 = Pre-Operational, 1 = Idle, 2 = Post Operational, 3 = Run, 4 = Fault |
| 2, 3 | battery voltage |
265 | 32 | V |
| 4, 5 | motor rpm |
263 | 1 | RPM |
| 6, 7 | motor current |
262 | 32 | A |
TPDO1 data
| Parameter | Address | Value |
|---|---|---|
TPDO1 map1 index |
1817 | 0x2004 |
TPDO1 map1 sub index and size |
1816 | 0x0210 |
TPDO1 map2 index |
1819 | 0x2004 |
TPDO1 map2 sub index and size |
1818 | 0x0A10 |
TPDO1 map3 index |
1821 | 0x2004 |
TPDO1 map3 sub index and size |
1820 | 0x0810 |
TPDO1 map4 index |
1823 | 0x2004 |
TPDO1 map4 sub index and size |
1822 | 0x0710 |
TPDO1 size (words) |
1824 | 4 |
TPDO1 transmission type |
1825 | 0 |
TPDO1 event time |
1826 | 100 |
TPDO1 settings
Example
For node ID 42, the frame 0x1AA 04 00 03 06 00 00 02 00 decodes as:
04 00: Fault.03 06(0x0603 = 1539): 1539 / 32 = 48.09 V.00 00: 0 RPM.02 00(0x0002 = 2): 2 / 32 = 0.0625 A.
Sent by the controller from 0x280 + node ID, every 100 ms.
| Bytes | Parameter | Address | Scale | Unit |
|---|---|---|---|---|
| 0, 1 | controller temperature |
259 | 1 | °C, signed |
| 2, 3 | motor temperature |
261 | 1 | °C, signed |
| 4, 5 | battery current |
266 | 32 | A, signed. Positive is current from the battery into the controller |
| 6, 7 | motor input power |
334 | 1 | W, signed. Positive is power into the motor |
TPDO2 data
| Parameter | Address | Value |
|---|---|---|
TPDO2 map1 index |
1829 | 0x2004 |
TPDO2 map1 sub index and size |
1828 | 0x0410 |
TPDO2 map2 index |
1831 | 0x2004 |
TPDO2 map2 sub index and size |
1830 | 0x0610 |
TPDO2 map3 index |
1833 | 0x2004 |
TPDO2 map3 sub index and size |
1832 | 0x0B10 |
TPDO2 map4 index |
1835 | 0x2005 |
TPDO2 map4 sub index and size |
1834 | 0x0F10 |
TPDO2 size (words) |
1836 | 4 |
TPDO2 transmission type |
1837 | 0 |
TPDO2 event time |
1838 | 100 |
TPDO2 settings
Sent by the controller from 0x380 + node ID, every 500 ms. Each value is a bit vector. For the bit definitions, refer to Faults and warnings.
| Bytes | Parameter | Address |
|---|---|---|
| 0, 1 | faults |
258 |
| 2, 3 | faults2 |
299 |
| 4, 5 | warnings |
277 |
TPDO3 data
| Parameter | Address | Value |
|---|---|---|
TPDO3 map1 index |
1841 | 0x2004 |
TPDO3 map1 sub index and size |
1840 | 0x0310 |
TPDO3 map2 index |
1843 | 0x2004 |
TPDO3 map2 sub index and size |
1842 | 0x2C10 |
TPDO3 map3 index |
1845 | 0x2004 |
TPDO3 map3 sub index and size |
1844 | 0x1610 |
TPDO3 size (words) |
1848 | 3 |
TPDO3 transmission type |
1849 | 0 |
TPDO3 event time |
1850 | 500 |
TPDO3 settings
Several controllers on one bus
Each controller on the bus must have a unique node ID. To use the same parameter file on two controllers, enable Communications Configuration Vector bit 13 Enable automatic CAN ID adjustment. At start-up, the controller adds to its CAN ID:
- 1 if the Cruise input is high.
- 2 if the PFS input is high.
- 3 if both inputs are high.
To check the node ID in use, read can auto ID (address 1676).
J1939
The BAC6 controllers use CANopen. J1939 is available on our BAC8 product family. For more information, contact your ASI sales representative.
Protocol reference
For the message formats (SDO, NMT, SYNC, heartbeat, EMCY), all CAN settings and more PDO examples, refer to the CANopen protocol reference.
Fault and warning settings
- CAN bus fault and CAN Bus warning (
Faults2bit 5 andWarningsbit 4): to disable both, disableCommunications Configuration Vectorbit 1 CAN faults (address 58). - Remote CAN fault (
Faults2bit 12): you cannot disable it whileCommunications Configuration Vectorbit 7 CAN enable is enabled. - Missed CAN Message (
Warnings2bit 7): you cannot disable it.