foxBMS  1.6.0
The foxBMS Battery Management System API Documentation
can_cfg_tx-message-definitions.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2023, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file can_cfg_tx-message-definitions.h
44  * @author foxBMS Team
45  * @date 2022-07-01 (date of creation)
46  * @updated 2023-10-12 (date of last update)
47  * @version v1.6.0
48  * @ingroup DRIVERS
49  * @prefix CANTX
50  *
51  * @brief Header for the driver for the CAN module
52  *
53  */
54 
55 #ifndef FOXBMS__CAN_CFG_TX_MESSAGE_DEFINITIONS_H_
56 #define FOXBMS__CAN_CFG_TX_MESSAGE_DEFINITIONS_H_
57 
58 /*========== Includes =======================================================*/
59 #include "can_cfg.h"
60 
61 #include <stdint.h>
62 
63 /*========== Macros and Definitions =========================================*/
64 
65 /* Message IDs */
66 
67 /** CAN message ID for debug response message */
68 #define CANTX_DEBUG_RESPONSE_ID (0x227u) /* check_ids:not-periodic */
69 #define CANTX_DEBUG_IDENTIFIER (CAN_STANDARD_IDENTIFIER_11_BIT)
70 
71 /** CAN message ID for unsupported multiplexer values in messages */
72 #define CANTX_UNSUPPORTED_MULTIPLEXER_VAL_ID (0x201u) /* check_ids:not-periodic */
73 #define CANTX_UNSUPPORTED_MULTIPLEXER_IDENTIFIER (CAN_STANDARD_IDENTIFIER_11_BIT)
74 
75 /** CAN message ID for fatal errors */
76 #define CANTX_FATAL_ERRORS_ID (0x0FFu) /* check_ids:not-periodic */
77 #define CANTX_FATAL_ERRORS_IDENTIFIER (CAN_STANDARD_IDENTIFIER_11_BIT)
78 
79 /** CAN message properties for BMS state message. Required properties are:
80  * - Message ID
81  * - Identifier type (standard or extended)
82  * - Message period and phase in ms
83  * - Endianness of message data @{*/
84 #define CANTX_BMS_STATE_ID (0x220u)
85 #define CANTX_BMS_STATE_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
86 #define CANTX_BMS_STATE_PERIOD_ms (100u)
87 #define CANTX_BMS_STATE_PHASE_ms (0u)
88 #define CANTX_BMS_STATE_ENDIANNESS (CAN_BIG_ENDIAN)
89 /**@}*/
90 
91 /** CAN message properties for BMS detail state. Required properties are:
92  * - Message ID
93  * - Identifier type (standard or extended)
94  * - Message period and phase in ms
95  * - Endianness of message data @{*/
96 #define CANTX_BMS_STATE_DETAILS_ID (0x226u)
97 #define CANTX_BMS_STATE_DETAILS_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
98 #define CANTX_BMS_STATE_DETAILS_PERIOD_ms (1000u)
99 #define CANTX_BMS_STATE_DETAILS_PHASE_ms (100u)
100 #define CANTX_BMS_STATE_DETAILS_ENDIANNESS (CAN_BIG_ENDIAN)
101 /**@}*/
102 
103 /** CAN message properties for BMS cell voltages. Required properties are:
104  * - Message ID
105  * - Identifier type (standard or extended)
106  * - Message period and phase in ms
107  * - Endianness of message data @{*/
108 #define CANTX_CELL_VOLTAGES_ID (0x240u)
109 #define CANTX_CELL_VOLTAGES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
110 #define CANTX_CELL_VOLTAGES_PERIOD_ms (100u)
111 #define CANTX_CELL_VOLTAGES_PHASE_ms (10u)
112 #define CANTX_CELL_VOLTAGES_ENDIANNESS (CAN_BIG_ENDIAN)
113 /**@}*/
114 
115 /** CAN message properties for BMS cell temperatures. Required properties are:
116  * - Message ID
117  * - Identifier type (standard or extended)
118  * - Message period and phase in ms
119  * - Endianness of message data @{*/
120 #define CANTX_CELL_TEMPERATURES_ID (0x250u)
121 #define CANTX_CELL_TEMPERATURES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
122 #define CANTX_CELL_TEMPERATURES_PERIOD_ms (200u)
123 #define CANTX_CELL_TEMPERATURES_PHASE_ms (20u)
124 #define CANTX_CELL_TEMPERATURES_ENDIANNESS (CAN_BIG_ENDIAN)
125 /**@}*/
126 
127 /** CAN message properties for BMS limit values. Required properties are:
128  * - Message ID
129  * - Identifier type (standard or extended)
130  * - Message period and phase in ms
131  * - Endianness of message data @{*/
132 #define CANTX_LIMIT_VALUES_ID (0x224u)
133 #define CANTX_LIMIT_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
134 #define CANTX_LIMIT_VALUES_PERIOD_ms (100u)
135 #define CANTX_LIMIT_VALUES_PHASE_ms (30u)
136 #define CANTX_LIMIT_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
137 /**@}*/
138 
139 /** CAN message properties for minimum and maximum values. Required properties are:
140  * - Message ID
141  * - Identifier type (standard or extended)
142  * - Message period and phase in ms
143  * - Endianness of message data @{*/
144 #define CANTX_MINIMUM_MAXIMUM_VALUES_ID (0x223u)
145 #define CANTX_MINIMUM_MAXIMUM_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
146 #define CANTX_MINIMUM_MAXIMUM_VALUES_PERIOD_ms (100u)
147 #define CANTX_MINIMUM_MAXIMUM_VALUES_PHASE_ms (40u)
148 #define CANTX_MINIMUM_MAXIMUM_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
149 /**@}*/
150 
151 /** CAN message properties for pack state estimation values. Required properties are:
152  * - Message ID
153  * - Identifier type (standard or extended)
154  * - Message period and phase in ms
155  * - Endianness of message data @{*/
156 #define CANTX_PACK_STATE_ESTIMATION_ID (0x225u)
157 #define CANTX_PACK_STATE_ESTIMATION_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
158 #define CANTX_PACK_STATE_ESTIMATION_PERIOD_ms (1000u)
159 #define CANTX_PACK_STATE_ESTIMATION_PHASE_ms (50u)
160 #define CANTX_PACK_STATE_ESTIMATION_ENDIANNESS (CAN_BIG_ENDIAN)
161 /**@}*/
162 
163 /** CAN message properties for pack values. Required properties are:
164  * - Message ID
165  * - Identifier type (standard or extended)
166  * - Message period and phase in ms
167  * - Endianness of message data @{*/
168 #define CANTX_PACK_VALUES_ID (0x222u)
169 #define CANTX_PACK_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
170 #define CANTX_PACK_VALUES_PERIOD_ms (100u)
171 #define CANTX_PACK_VALUES_PHASE_ms (60u)
172 #define CANTX_PACK_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
173 /**@}*/
174 
175 /** TX messages - string related */
176 
177 /** CAN message properties for string state. Required properties are:
178  * - Message ID
179  * - Identifier type (standard or extended)
180  * - Message period and phase in ms
181  * - Endianness of message data @{*/
182 #define CANTX_STRING_STATE_ID (0x221u)
183 #define CANTX_STRING_STATE_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
184 #define CANTX_STRING_STATE_PERIOD_ms (100u)
185 #define CANTX_STRING_STATE_PHASE_ms (70u)
186 #define CANTX_STRING_STATE_ENDIANNESS (CAN_BIG_ENDIAN)
187 /**@}*/
188 
189 /** CAN message properties for string values part 0. Required properties are:
190  * - Message ID
191  * - Identifier type (standard or extended)
192  * - Message period and phase in ms
193  * - Endianness of message data @{*/
194 #define CANTX_STRING_VALUES_P0_ID (0x280u)
195 #define CANTX_STRING_VALUES_P0_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
196 #define CANTX_STRING_VALUES_P0_PERIOD_ms (100u)
197 #define CANTX_STRING_VALUES_P0_PHASE_ms (80u)
198 #define CANTX_STRING_VALUES_P0_ENDIANNESS (CAN_BIG_ENDIAN)
199 /**@}*/
200 
201 /** CAN message properties for string values part 1. Required properties are:
202  * - Message ID
203  * - Identifier type (standard or extended)
204  * - Message period and phase in ms
205  * - Endianness of message data @{*/
206 #define CANTX_STRING_VALUES_P1_ID (0x283u)
207 #define CANTX_STRING_VALUES_P1_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
208 #define CANTX_STRING_VALUES_P1_PERIOD_ms (100u)
209 #define CANTX_STRING_VALUES_P1_PHASE_ms (10u)
210 #define CANTX_STRING_VALUES_P1_ENDIANNESS (CAN_BIG_ENDIAN)
211 /**@}*/
212 
213 /** CAN message properties for string minimum and maximum values. Required properties are:
214  * - Message ID
215  * - Identifier type (standard or extended)
216  * - Message period and phase in ms
217  * - Endianness of message data @{*/
218 #define CANTX_STRING_MIN_MAX_VALUES_ID (0x281u)
219 #define CANTX_STRING_MIN_MAX_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
220 #define CANTX_STRING_MIN_MAX_VALUES_PERIOD_ms (100u)
221 #define CANTX_STRING_MIN_MAX_VALUES_PHASE_ms (90u)
222 #define CANTX_STRING_MIN_MAX_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
223 /**@}*/
224 
225 /** CAN message properties for string state estimation values. Required properties are:
226  * - Message ID
227  * - Identifier type (standard or extended)
228  * - Message period and phase in ms
229  * - Endianness of message data @{*/
230 #define CANTX_STRING_STATE_ESTIMATION_ID (0x282u)
231 #define CANTX_STRING_STATE_ESTIMATION_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
232 #define CANTX_STRING_STATE_ESTIMATION_PERIOD_ms (1000u)
233 #define CANTX_STRING_STATE_ESTIMATION_PHASE_ms (0u)
234 #define CANTX_STRING_STATE_ESTIMATION_ENDIANNESS (CAN_BIG_ENDIAN)
235 /**@}*/
236 
237 /**
238  * -------------------------CAUTION-------------------------
239  * The following defines are used by the insulation monitoring device (IMD).
240  * If they are changed, the IMD will not work anymore
241  * -------------------------CAUTION-------------------------
242  */
243 /** CAN message ID for request message to iso165c */
244 #define CANTX_IMD_REQUEST_ID (0x22u)
245 /** CAN message identifier type */
246 #define CANTX_IMD_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
247 
248 /* composed Tx messages */
249 
250 /* AXIVION Disable Style Generic-NoUnsafeMacro: These macros MUST only be used
251  to populate the 'can_txMessages' array. The type of this array expects data
252  exactly as it is provided here and therefore these macros are good (for this
253  and only for this purpose!).*/
254 #define CANTX_BMS_STATE_MESSAGE \
255  { \
256  .id = CANTX_BMS_STATE_ID, \
257  .idType = CANTX_BMS_STATE_ID_TYPE, \
258  .dlc = CAN_DEFAULT_DLC, \
259  .endianness = CANTX_BMS_STATE_ENDIANNESS, \
260  }, \
261  { \
262  .period = CANTX_BMS_STATE_PERIOD_ms, .phase = CANTX_BMS_STATE_PHASE_ms \
263  }
264 
265 #define CANTX_BMS_STATE_DETAILS_MESSAGE \
266  { \
267  .id = CANTX_BMS_STATE_DETAILS_ID, \
268  .idType = CANTX_BMS_STATE_DETAILS_ID_TYPE, \
269  .dlc = CAN_DEFAULT_DLC, \
270  .endianness = CANTX_BMS_STATE_DETAILS_ENDIANNESS, \
271  }, \
272  { \
273  .period = CANTX_BMS_STATE_DETAILS_PERIOD_ms, .phase = CANTX_BMS_STATE_DETAILS_PHASE_ms \
274  }
275 
276 #define CANTX_CELL_VOLTAGES_MESSAGE \
277  { \
278  .id = CANTX_CELL_VOLTAGES_ID, \
279  .idType = CANTX_CELL_VOLTAGES_ID_TYPE, \
280  .dlc = CAN_DEFAULT_DLC, \
281  .endianness = CANTX_CELL_VOLTAGES_ENDIANNESS, \
282  }, \
283  { \
284  .period = CANTX_CELL_VOLTAGES_PERIOD_ms, .phase = CANTX_CELL_VOLTAGES_PHASE_ms \
285  }
286 
287 #define CANTX_MINIMUM_MAXIMUM_VALUES_MESSAGE \
288  { \
289  .id = CANTX_MINIMUM_MAXIMUM_VALUES_ID, \
290  .idType = CANTX_MINIMUM_MAXIMUM_VALUES_ID_TYPE, \
291  .dlc = CAN_DEFAULT_DLC, \
292  .endianness = CANTX_MINIMUM_MAXIMUM_VALUES_ENDIANNESS, \
293  }, \
294  { \
295  .period = CANTX_MINIMUM_MAXIMUM_VALUES_PERIOD_ms, .phase = CANTX_MINIMUM_MAXIMUM_VALUES_PHASE_ms \
296  }
297 
298 #define CANTX_LIMIT_VALUES_MESSAGE \
299  { \
300  .id = CANTX_LIMIT_VALUES_ID, \
301  .idType = CANTX_LIMIT_VALUES_ID_TYPE, \
302  .dlc = CAN_DEFAULT_DLC, \
303  .endianness = CANTX_LIMIT_VALUES_ENDIANNESS, \
304  }, \
305  { \
306  .period = CANTX_LIMIT_VALUES_PERIOD_ms, .phase = CANTX_LIMIT_VALUES_PHASE_ms \
307  }
308 
309 #define CANTX_CELL_TEMPERATURES_MESSAGE \
310  { \
311  .id = CANTX_CELL_TEMPERATURES_ID, \
312  .idType = CANTX_CELL_TEMPERATURES_ID_TYPE, \
313  .dlc = CAN_DEFAULT_DLC, \
314  .endianness = CANTX_CELL_TEMPERATURES_ENDIANNESS, \
315  }, \
316  { \
317  .period = CANTX_CELL_TEMPERATURES_PERIOD_ms, .phase = CANTX_CELL_TEMPERATURES_PHASE_ms \
318  }
319 
320 #define CANTX_PACK_STATE_ESTIMATION_MESSAGE \
321  { \
322  .id = CANTX_PACK_STATE_ESTIMATION_ID, \
323  .idType = CANTX_PACK_STATE_ESTIMATION_ID_TYPE, \
324  .dlc = CAN_DEFAULT_DLC, \
325  .endianness = CANTX_PACK_STATE_ESTIMATION_ENDIANNESS, \
326  }, \
327  { \
328  .period = CANTX_PACK_STATE_ESTIMATION_PERIOD_ms, .phase = CANTX_PACK_STATE_ESTIMATION_PHASE_ms \
329  }
330 
331 #define CANTX_PACK_VALUES_MESSAGE \
332  { \
333  .id = CANTX_PACK_VALUES_ID, \
334  .idType = CANTX_PACK_VALUES_ID_TYPE, \
335  .dlc = CAN_DEFAULT_DLC, \
336  .endianness = CANTX_PACK_VALUES_ENDIANNESS, \
337  }, \
338  { \
339  .period = CANTX_PACK_VALUES_PERIOD_ms, .phase = CANTX_PACK_VALUES_PHASE_ms \
340  }
341 
342 #define CANTX_STRING_STATE_MESSAGE \
343  { \
344  .id = CANTX_STRING_STATE_ID, \
345  .idType = CANTX_STRING_STATE_ID_TYPE, \
346  .dlc = CAN_DEFAULT_DLC, \
347  .endianness = CANTX_STRING_STATE_ENDIANNESS, \
348  }, \
349  { \
350  .period = CANTX_STRING_STATE_PERIOD_ms, .phase = CANTX_STRING_STATE_PHASE_ms \
351  }
352 
353 #define CANTX_STRING_VALUES_P0_MESSAGE \
354  { \
355  .id = CANTX_STRING_VALUES_P0_ID, \
356  .idType = CANTX_STRING_VALUES_P0_ID_TYPE, \
357  .dlc = CAN_DEFAULT_DLC, \
358  .endianness = CANTX_STRING_VALUES_P0_ENDIANNESS, \
359  }, \
360  { \
361  .period = CANTX_STRING_VALUES_P0_PERIOD_ms, .phase = CANTX_STRING_VALUES_P0_PHASE_ms \
362  }
363 
364 #define CANTX_STRING_VALUES_P1_MESSAGE \
365  { \
366  .id = CANTX_STRING_VALUES_P1_ID, \
367  .idType = CANTX_STRING_VALUES_P1_ID_TYPE, \
368  .dlc = CAN_DEFAULT_DLC, \
369  .endianness = CANTX_STRING_VALUES_P1_ENDIANNESS, \
370  }, \
371  { \
372  .period = CANTX_STRING_VALUES_P1_PERIOD_ms, .phase = CANTX_STRING_VALUES_P1_PHASE_ms \
373  }
374 
375 #define CANTX_STRING_MIN_MAX_VALUES_MESSAGE \
376  { \
377  .id = CANTX_STRING_MIN_MAX_VALUES_ID, \
378  .idType = CANTX_STRING_MIN_MAX_VALUES_ID_TYPE, \
379  .dlc = CAN_DEFAULT_DLC, \
380  .endianness = CANTX_STRING_MIN_MAX_VALUES_ENDIANNESS, \
381  }, \
382  { \
383  .period = CANTX_STRING_MIN_MAX_VALUES_PERIOD_ms, .phase = CANTX_STRING_MIN_MAX_VALUES_PHASE_ms \
384  }
385 
386 #define CANTX_STRING_STATE_ESTIMATION_MESSAGE \
387  { \
388  .id = CANTX_STRING_STATE_ESTIMATION_ID, \
389  .idType = CANTX_STRING_STATE_ESTIMATION_ID_TYPE, \
390  .dlc = CAN_DEFAULT_DLC, \
391  .endianness = CANTX_STRING_STATE_ESTIMATION_ENDIANNESS, \
392  }, \
393  { \
394  .period = CANTX_STRING_STATE_ESTIMATION_PERIOD_ms, .phase = CANTX_STRING_STATE_ESTIMATION_PHASE_ms \
395  }
396 /* AXIVION Enable Style Generic-NoUnsafeMacro */
397 
398 /*========== Extern Constant and Variable Declarations ======================*/
399 
400 /*========== Extern Function Prototypes =====================================*/
401 
402 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
403 #ifdef UNITY_UNIT_TEST
404 #endif
405 
406 #endif /* FOXBMS__CAN_CFG_TX_MESSAGE_DEFINITIONS_H_ */
Headers for the configuration for the CAN module.