Wiki source code of 4. CANopen protocol

Last modified by Admin on 2025/01/29 11:04

Show last authors
1 (% data-numbered-headings-start="4" style="--numbered-headings-start: 3;font-size: 0px;color: rgba(0, 0, 0, 0.0);margin-bottom: 0px; margin-top: 0px;" %)
2 = CANopen protocol =
3
4 == General information ==
5
6 The BMS IMD device supports CiA 301 CANopen protocol for configuring and monitoring its state.
7
8 The communication parameters of the device are:
9
10 * CAN speed – 125, 250 (by default), 500 or 1000 kbps.
11 * Device COBID by default – 22 (0x16).
12
13 The BMS IMD supports the following features:
14
15 * SDO protocol (for configuring the device).
16 * PDO protocol (for interacting with external devices).
17 * Heartbeat producer.
18
19 There is the description of the parameters in the PDO and SDO packets below. Column "Parameter type" contains an integer type of the parameter:
20
21 * U8 – unsigned 8–bit integer;
22 * U16 – unsigned 16–bit integer;
23 * S16 – signed 16–bit integer;
24 * U32 – unsigned 32–bit integer.
25
26 Words are in the **little endian**.
27
28 == TPDO packets ==
29
30 === CANID ~= 0x180+COBID (0x196 by default) ===
31
32 The packet length is 8 bytes. The transmission period is 100 ms.
33
34 Packet content:
35
36 (% style="width:742px" %)
37 |(% style="width:67px" %)**Byte number**|(% style="width:456px" %)**Parameter name**|(% style="width:117px" %)**Parameter type**|(% style="width:99px" %)**Converting**
38 |(% style="width:67px" %)**0**|(% style="width:456px" %)(((
39 **INSULATION_STATUS**:
40
41 0 – NO_DATA (there is no data about the insulation resistance);
42
43 1 – OK (the insulation resistance has normal values);
44
45 2 – WARNING (low insulation resistance warning; insulation resistance is less than the WARNING_RESISTANCE level, but greater than the ALARM_RESISTANCE level);
46
47 3 – ALARM (message about emergency low insulation resistance; insulation resistance is less than ALARM_RESISTANCE level).
48
49 Note – When WORK_PERMISSION is reset and before the first measurement, the status is set to NO_DATA.
50 )))|(% style="width:117px" %)U8|(% style="width:99px" %)-
51 |(% style="width:67px" %)**1**|(% style="width:456px" %)(((
52 **INTERNAL_ERROR (bitfield)**:
53
54 bit 0 – LOW_BUS_VOLTAGE_ERROR;
55
56 bit 1 – TIMEOUT_ERROR (transient measurement timeout);
57
58 bit 2 – ANOMALY_ERROR (an abnormal condition between the positive and negative bus bars of the battery and the chassis, may indicate intermittent contact of the battery bus bars with the chassis);
59
60 bit 3 – SELF_TEST_ERROR;
61
62 bits 4-7 – reserved.
63 )))|(% style="width:117px" %)U8|(% style="width:99px" %)-
64 |(% style="width:67px" %)**2**|(% style="width:456px" %)(((
65 **STATE**:
66
67 0 – IDLE (device is not working);
68
69 1 – WORK (device is working);
70
71 2 – CRITICAL_FAULT.
72 )))|(% style="width:117px" %)U8|(% style="width:99px" %)-
73 |(% style="width:67px" %)**3-7**|(% style="width:456px" %)Reserved (set to 0)|(% style="width:117px" %)-|(% style="width:99px" %)-
74
75 === CANID ~= 0x280+COBID (0x296 by default) ===
76
77 The packet length is 8 bytes. The transmission period is 100 ms.
78
79 Packet content:
80
81 (% style="width:744px" %)
82 |(% style="width:66px" %)**Byte number**|(% style="width:461px" %)**Parameter name**|(% style="width:116px" %)**Parameter type**|(% style="width:98px" %)**Converting**
83 |(% style="width:66px" %)**0**|(% style="width:461px" %)(((
84 **RESISTANCE_CALCULATED**:
85
86 0 – insulation resistance values are not calculated;
87
88 1 – insulation resistance values are calculated.
89 )))|(% style="width:116px" %)U8|(% style="width:98px" %)-
90 |(% style="width:66px" %)**1-2**|(% style="width:461px" %)(((
91 **RESISTANCE_PLUS** – insulation resistance between the positive power bus and the chassis:
92
93 0 – minimum resistance
94
95 10000 – maximum resistance
96 )))|(% style="width:116px" %)U16|(% style="width:98px" %)1kOhm/bit
97 |(% style="width:66px" %)**3-4**|(% style="width:461px" %)(((
98 **RESISTANCE_MINUS** – insulation resistance between the negative power bus and the chassis:
99
100 0 – minimum resistance
101
102 10000 – maximum resistance
103 )))|(% style="width:116px" %)U16|(% style="width:98px" %)1kOhm/bit
104 |(% style="width:66px" %)**5**|(% style="width:461px" %)(((
105 **BUS_VOLATGE_CALCULATED**:
106
107 0 – voltage value is not calculated;
108
109 1 – voltage value is calculated.
110 )))|(% style="width:116px" %)U8|(% style="width:98px" %)-
111 |(% style="width:66px" %)**6-7**|(% style="width:461px" %)**BUS_VOLTAGE** – power bus voltage|(% style="width:116px" %)U16|(% style="width:98px" %)0.1V/bit
112
113 == RPDO packets ==
114
115 === CANID ~= 0x200+COBID (0x216 by default) ===
116
117 The packet length is 8 bytes. The transmission period is 100 ms.
118
119 Packet content:
120
121 (% style="width:745px" %)
122 |(% style="width:69px" %)**Byte number**|(% style="width:460px" %)**Parameter name**|(% style="width:121px" %)**Parameter type**|(% style="width:92px" %)**Converting**
123 |(% style="width:69px" %)**0**|(% style="width:460px" %)(((
124 **ALLOW_WORK**:
125
126 0 – work is not allowed;
127
128 1 – work is allowed.
129 )))|(% style="width:121px" %)U8|(% style="width:92px" %)-
130 |(% style="width:69px" %)**1**|(% style="width:460px" %)(((
131 **FORCE_SELFTEST** – command to force device self-diagnosis:
132
133 0 – using an internal algorithm for self-diagnosis;
134
135 1 – forced start of self-diagnosis (if active, only self-diagnosis is performed).
136 )))|(% style="width:121px" %)U8|(% style="width:92px" %)-
137 |(% style="width:69px" %)**2-7**|(% style="width:460px" %)Reserved (set to 0)|(% style="width:121px" %)-|(% style="width:92px" %)-
138
139 == SDO dictionary ==
140
141 To set the WARNING and ALARM signal generation levels, the following settings are available, which can be changed via the CANopen SDO protocol:
142
143 (% style="width:687px" %)
144 |(% style="width:291px" %)**Parameter name**|(% style="width:80px" %)**Index**|(% style="width:95px" %)**Subindex**|(% style="width:127px" %)**Parameter type**|(% style="width:91px" %)**Converting**
145 |(% style="width:291px" %)**ALARM_RESISTANCE** – ALARM signal generation level (default 50kOhm)|(% style="width:80px" %)0x4010|(% style="width:95px" %)0x01|(% style="width:127px" %)U16|(% style="width:91px" %)1kOhm/bit
146 |(% style="width:291px" %)**WARNING_RESISTANCE** – WARNING signal generation level (default 100kOhm)|(% style="width:80px" %)0x4010|(% style="width:95px" %)0x02|(% style="width:127px" %)U16|(% style="width:91px" %)1kOhm/bit
147
148 An example of setting ALARM_RESISTANCE to 50 kOhm (0x0032):
149
150 | |**Byte 0**|**Byte 1**|**Byte 2**|**Byte 3**|**Byte 4**|**Byte 5**|**Byte 6**|**Byte 7**
151 |**Command**|0x2B|0x10|0x40|0x01|**0x32**|**0x00**|0x00|0x00
152 |**Answer**|0x60|0x10|0x40|0x01|0x00|0x00|0x00|0x00
153
154 An example of setting WARNING_RESISTANCE to 100 kOhm (0x0064):
155
156 | |**Byte 0**|**Byte 1**|**Byte 2**|**Byte 3**|**Byte 4**|**Byte 5**|**Byte 6**|**Byte 7**
157 |**Command**|0x2B|0x10|0x40|0x02|**0x64**|**0x00**|0x00|0x00
158 |**Answer**|0x60|0x10|0x40|0x02|0x00|0x00|0x00|0x00
159
160