foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests 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-02-03 (date of last update)
47  * @version v1.5.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 properties for BMS state message. Required properties are:
76  * - Message ID
77  * - Identifier type (standard or extended)
78  * - Message period and phase in ms
79  * - Endianness of message data @{*/
80 #define CANTX_BMS_STATE_ID (0x220u)
81 #define CANTX_BMS_STATE_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
82 #define CANTX_BMS_STATE_PERIOD_ms (100u)
83 #define CANTX_BMS_STATE_PHASE_ms (0u)
84 #define CANTX_BMS_STATE_ENDIANNESS (CAN_BIG_ENDIAN)
85 /**@}*/
86 
87 /** CAN message properties for BMS detail state. Required properties are:
88  * - Message ID
89  * - Identifier type (standard or extended)
90  * - Message period and phase in ms
91  * - Endianness of message data @{*/
92 #define CANTX_BMS_STATE_DETAILS_ID (0x226u)
93 #define CANTX_BMS_STATE_DETAILS_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
94 #define CANTX_BMS_STATE_DETAILS_PERIOD_ms (1000u)
95 #define CANTX_BMS_STATE_DETAILS_PHASE_ms (100u)
96 #define CANTX_BMS_STATE_DETAILS_ENDIANNESS (CAN_BIG_ENDIAN)
97 /**@}*/
98 
99 /** CAN message properties for BMS cell voltages. Required properties are:
100  * - Message ID
101  * - Identifier type (standard or extended)
102  * - Message period and phase in ms
103  * - Endianness of message data @{*/
104 #define CANTX_CELL_VOLTAGES_ID (0x240u)
105 #define CANTX_CELL_VOLTAGES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
106 #define CANTX_CELL_VOLTAGES_PERIOD_ms (100u)
107 #define CANTX_CELL_VOLTAGES_PHASE_ms (10u)
108 #define CANTX_CELL_VOLTAGES_ENDIANNESS (CAN_BIG_ENDIAN)
109 /**@}*/
110 
111 /** CAN message properties for BMS cell temperatures. Required properties are:
112  * - Message ID
113  * - Identifier type (standard or extended)
114  * - Message period and phase in ms
115  * - Endianness of message data @{*/
116 #define CANTX_CELL_TEMPERATURES_ID (0x250u)
117 #define CANTX_CELL_TEMPERATURES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
118 #define CANTX_CELL_TEMPERATURES_PERIOD_ms (200u)
119 #define CANTX_CELL_TEMPERATURES_PHASE_ms (20u)
120 #define CANTX_CELL_TEMPERATURES_ENDIANNESS (CAN_BIG_ENDIAN)
121 /**@}*/
122 
123 /** CAN message properties for BMS limit values. Required properties are:
124  * - Message ID
125  * - Identifier type (standard or extended)
126  * - Message period and phase in ms
127  * - Endianness of message data @{*/
128 #define CANTX_LIMIT_VALUES_ID (0x224u)
129 #define CANTX_LIMIT_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
130 #define CANTX_LIMIT_VALUES_PERIOD_ms (100u)
131 #define CANTX_LIMIT_VALUES_PHASE_ms (30u)
132 #define CANTX_LIMIT_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
133 /**@}*/
134 
135 /** CAN message properties for minimum and maximum values. Required properties are:
136  * - Message ID
137  * - Identifier type (standard or extended)
138  * - Message period and phase in ms
139  * - Endianness of message data @{*/
140 #define CANTX_MINIMUM_MAXIMUM_VALUES_ID (0x223u)
141 #define CANTX_MINIMUM_MAXIMUM_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
142 #define CANTX_MINIMUM_MAXIMUM_VALUES_PERIOD_ms (100u)
143 #define CANTX_MINIMUM_MAXIMUM_VALUES_PHASE_ms (40u)
144 #define CANTX_MINIMUM_MAXIMUM_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
145 /**@}*/
146 
147 /** CAN message properties for pack state estimation values. Required properties are:
148  * - Message ID
149  * - Identifier type (standard or extended)
150  * - Message period and phase in ms
151  * - Endianness of message data @{*/
152 #define CANTX_PACK_STATE_ESTIMATION_ID (0x225u)
153 #define CANTX_PACK_STATE_ESTIMATION_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
154 #define CANTX_PACK_STATE_ESTIMATION_PERIOD_ms (1000u)
155 #define CANTX_PACK_STATE_ESTIMATION_PHASE_ms (50u)
156 #define CANTX_PACK_STATE_ESTIMATION_ENDIANNESS (CAN_BIG_ENDIAN)
157 /**@}*/
158 
159 /** CAN message properties for pack values. Required properties are:
160  * - Message ID
161  * - Identifier type (standard or extended)
162  * - Message period and phase in ms
163  * - Endianness of message data @{*/
164 #define CANTX_PACK_VALUES_ID (0x222u)
165 #define CANTX_PACK_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
166 #define CANTX_PACK_VALUES_PERIOD_ms (100u)
167 #define CANTX_PACK_VALUES_PHASE_ms (60u)
168 #define CANTX_PACK_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
169 /**@}*/
170 
171 /** TX messages - string related */
172 
173 /** CAN message properties for string state. Required properties are:
174  * - Message ID
175  * - Identifier type (standard or extended)
176  * - Message period and phase in ms
177  * - Endianness of message data @{*/
178 #define CANTX_STRING_STATE_ID (0x221u)
179 #define CANTX_STRING_STATE_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
180 #define CANTX_STRING_STATE_PERIOD_ms (100u)
181 #define CANTX_STRING_STATE_PHASE_ms (70u)
182 #define CANTX_STRING_STATE_ENDIANNESS (CAN_BIG_ENDIAN)
183 /**@}*/
184 
185 /** CAN message properties for string values part 0. Required properties are:
186  * - Message ID
187  * - Identifier type (standard or extended)
188  * - Message period and phase in ms
189  * - Endianness of message data @{*/
190 #define CANTX_STRING_VALUES_P0_ID (0x280u)
191 #define CANTX_STRING_VALUES_P0_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
192 #define CANTX_STRING_VALUES_P0_PERIOD_ms (100u)
193 #define CANTX_STRING_VALUES_P0_PHASE_ms (80u)
194 #define CANTX_STRING_VALUES_P0_ENDIANNESS (CAN_BIG_ENDIAN)
195 /**@}*/
196 
197 /** CAN message properties for string values part 1. Required properties are:
198  * - Message ID
199  * - Identifier type (standard or extended)
200  * - Message period and phase in ms
201  * - Endianness of message data @{*/
202 #define CANTX_STRING_VALUES_P1_ID (0x283u)
203 #define CANTX_STRING_VALUES_P1_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
204 #define CANTX_STRING_VALUES_P1_PERIOD_ms (100u)
205 #define CANTX_STRING_VALUES_P1_PHASE_ms (10u)
206 #define CANTX_STRING_VALUES_P1_ENDIANNESS (CAN_BIG_ENDIAN)
207 /**@}*/
208 
209 /** CAN message properties for string minimum and maximum values. Required properties are:
210  * - Message ID
211  * - Identifier type (standard or extended)
212  * - Message period and phase in ms
213  * - Endianness of message data @{*/
214 #define CANTX_STRING_MIN_MAX_VALUES_ID (0x281u)
215 #define CANTX_STRING_MIN_MAX_VALUES_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
216 #define CANTX_STRING_MIN_MAX_VALUES_PERIOD_ms (100u)
217 #define CANTX_STRING_MIN_MAX_VALUES_PHASE_ms (90u)
218 #define CANTX_STRING_MIN_MAX_VALUES_ENDIANNESS (CAN_BIG_ENDIAN)
219 /**@}*/
220 
221 /** CAN message properties for string state estimation values. Required properties are:
222  * - Message ID
223  * - Identifier type (standard or extended)
224  * - Message period and phase in ms
225  * - Endianness of message data @{*/
226 #define CANTX_STRING_STATE_ESTIMATION_ID (0x282u)
227 #define CANTX_STRING_STATE_ESTIMATION_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
228 #define CANTX_STRING_STATE_ESTIMATION_PERIOD_ms (1000u)
229 #define CANTX_STRING_STATE_ESTIMATION_PHASE_ms (0u)
230 #define CANTX_STRING_STATE_ESTIMATION_ENDIANNESS (CAN_BIG_ENDIAN)
231 /**@}*/
232 
233 /**
234  * -------------------------CAUTION-------------------------
235  * The following defines are used by the insulation monitoring device (IMD).
236  * If they are changed, the IMD will not work anymore
237  * -------------------------CAUTION-------------------------
238  */
239 /** CAN message ID for request message to iso165c */
240 #define CANTX_IMD_REQUEST_ID (0x22u)
241 /** CAN message identifier type */
242 #define CANTX_IMD_ID_TYPE (CAN_STANDARD_IDENTIFIER_11_BIT)
243 
244 /* composed Tx messages */
245 
246 /* AXIVION Disable Style Generic-NoUnsafeMacro: These macros MUST only be used
247  to populate the 'can_txMessages' array. The type of this array expects data
248  exactly as it is provided here and therefore these macros are good (for this
249  and only for this purpose!).*/
250 #define CANTX_BMS_STATE_MESSAGE \
251  { \
252  .id = CANTX_BMS_STATE_ID, \
253  .idType = CANTX_BMS_STATE_ID_TYPE, \
254  .dlc = CAN_DEFAULT_DLC, \
255  .endianness = CANTX_BMS_STATE_ENDIANNESS, \
256  }, \
257  { \
258  .period = CANTX_BMS_STATE_PERIOD_ms, .phase = CANTX_BMS_STATE_PHASE_ms \
259  }
260 
261 #define CANTX_BMS_STATE_DETAILS_MESSAGE \
262  { \
263  .id = CANTX_BMS_STATE_DETAILS_ID, \
264  .idType = CANTX_BMS_STATE_DETAILS_ID_TYPE, \
265  .dlc = CAN_DEFAULT_DLC, \
266  .endianness = CANTX_BMS_STATE_DETAILS_ENDIANNESS, \
267  }, \
268  { \
269  .period = CANTX_BMS_STATE_DETAILS_PERIOD_ms, .phase = CANTX_BMS_STATE_DETAILS_PHASE_ms \
270  }
271 
272 #define CANTX_CELL_VOLTAGES_MESSAGE \
273  { \
274  .id = CANTX_CELL_VOLTAGES_ID, \
275  .idType = CANTX_CELL_VOLTAGES_ID_TYPE, \
276  .dlc = CAN_DEFAULT_DLC, \
277  .endianness = CANTX_CELL_VOLTAGES_ENDIANNESS, \
278  }, \
279  { \
280  .period = CANTX_CELL_VOLTAGES_PERIOD_ms, .phase = CANTX_CELL_VOLTAGES_PHASE_ms \
281  }
282 
283 #define CANTX_MINIMUM_MAXIMUM_VALUES_MESSAGE \
284  { \
285  .id = CANTX_MINIMUM_MAXIMUM_VALUES_ID, \
286  .idType = CANTX_MINIMUM_MAXIMUM_VALUES_ID_TYPE, \
287  .dlc = CAN_DEFAULT_DLC, \
288  .endianness = CANTX_MINIMUM_MAXIMUM_VALUES_ENDIANNESS, \
289  }, \
290  { \
291  .period = CANTX_MINIMUM_MAXIMUM_VALUES_PERIOD_ms, .phase = CANTX_MINIMUM_MAXIMUM_VALUES_PHASE_ms \
292  }
293 
294 #define CANTX_LIMIT_VALUES_MESSAGE \
295  { \
296  .id = CANTX_LIMIT_VALUES_ID, \
297  .idType = CANTX_LIMIT_VALUES_ID_TYPE, \
298  .dlc = CAN_DEFAULT_DLC, \
299  .endianness = CANTX_LIMIT_VALUES_ENDIANNESS, \
300  }, \
301  { \
302  .period = CANTX_LIMIT_VALUES_PERIOD_ms, .phase = CANTX_LIMIT_VALUES_PHASE_ms \
303  }
304 
305 #define CANTX_CELL_TEMPERATURES_MESSAGE \
306  { \
307  .id = CANTX_CELL_TEMPERATURES_ID, \
308  .idType = CANTX_CELL_TEMPERATURES_ID_TYPE, \
309  .dlc = CAN_DEFAULT_DLC, \
310  .endianness = CANTX_CELL_TEMPERATURES_ENDIANNESS, \
311  }, \
312  { \
313  .period = CANTX_CELL_TEMPERATURES_PERIOD_ms, .phase = CANTX_CELL_TEMPERATURES_PHASE_ms \
314  }
315 
316 #define CANTX_PACK_STATE_ESTIMATION_MESSAGE \
317  { \
318  .id = CANTX_PACK_STATE_ESTIMATION_ID, \
319  .idType = CANTX_PACK_STATE_ESTIMATION_ID_TYPE, \
320  .dlc = CAN_DEFAULT_DLC, \
321  .endianness = CANTX_PACK_STATE_ESTIMATION_ENDIANNESS, \
322  }, \
323  { \
324  .period = CANTX_PACK_STATE_ESTIMATION_PERIOD_ms, .phase = CANTX_PACK_STATE_ESTIMATION_PHASE_ms \
325  }
326 
327 #define CANTX_PACK_VALUES_MESSAGE \
328  { \
329  .id = CANTX_PACK_VALUES_ID, \
330  .idType = CANTX_PACK_VALUES_ID_TYPE, \
331  .dlc = CAN_DEFAULT_DLC, \
332  .endianness = CANTX_PACK_VALUES_ENDIANNESS, \
333  }, \
334  { \
335  .period = CANTX_PACK_VALUES_PERIOD_ms, .phase = CANTX_PACK_VALUES_PHASE_ms \
336  }
337 
338 #define CANTX_STRING_STATE_MESSAGE \
339  { \
340  .id = CANTX_STRING_STATE_ID, \
341  .idType = CANTX_STRING_STATE_ID_TYPE, \
342  .dlc = CAN_DEFAULT_DLC, \
343  .endianness = CANTX_STRING_STATE_ENDIANNESS, \
344  }, \
345  { \
346  .period = CANTX_STRING_STATE_PERIOD_ms, .phase = CANTX_STRING_STATE_PHASE_ms \
347  }
348 
349 #define CANTX_STRING_VALUES_P0_MESSAGE \
350  { \
351  .id = CANTX_STRING_VALUES_P0_ID, \
352  .idType = CANTX_STRING_VALUES_P0_ID_TYPE, \
353  .dlc = CAN_DEFAULT_DLC, \
354  .endianness = CANTX_STRING_VALUES_P0_ENDIANNESS, \
355  }, \
356  { \
357  .period = CANTX_STRING_VALUES_P0_PERIOD_ms, .phase = CANTX_STRING_VALUES_P0_PHASE_ms \
358  }
359 
360 #define CANTX_STRING_VALUES_P1_MESSAGE \
361  { \
362  .id = CANTX_STRING_VALUES_P1_ID, \
363  .idType = CANTX_STRING_VALUES_P1_ID_TYPE, \
364  .dlc = CAN_DEFAULT_DLC, \
365  .endianness = CANTX_STRING_VALUES_P1_ENDIANNESS, \
366  }, \
367  { \
368  .period = CANTX_STRING_VALUES_P1_PERIOD_ms, .phase = CANTX_STRING_VALUES_P1_PHASE_ms \
369  }
370 
371 #define CANTX_STRING_MIN_MAX_VALUES_MESSAGE \
372  { \
373  .id = CANTX_STRING_MIN_MAX_VALUES_ID, \
374  .idType = CANTX_STRING_MIN_MAX_VALUES_ID_TYPE, \
375  .dlc = CAN_DEFAULT_DLC, \
376  .endianness = CANTX_STRING_MIN_MAX_VALUES_ENDIANNESS, \
377  }, \
378  { \
379  .period = CANTX_STRING_MIN_MAX_VALUES_PERIOD_ms, .phase = CANTX_STRING_MIN_MAX_VALUES_PHASE_ms \
380  }
381 
382 #define CANTX_STRING_STATE_ESTIMATION_MESSAGE \
383  { \
384  .id = CANTX_STRING_STATE_ESTIMATION_ID, \
385  .idType = CANTX_STRING_STATE_ESTIMATION_ID_TYPE, \
386  .dlc = CAN_DEFAULT_DLC, \
387  .endianness = CANTX_STRING_STATE_ESTIMATION_ENDIANNESS, \
388  }, \
389  { \
390  .period = CANTX_STRING_STATE_ESTIMATION_PERIOD_ms, .phase = CANTX_STRING_STATE_ESTIMATION_PHASE_ms \
391  }
392 /* AXIVION Enable Style Generic-NoUnsafeMacro */
393 
394 /*========== Extern Constant and Variable Declarations ======================*/
395 
396 /*========== Extern Function Prototypes =====================================*/
397 
398 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
399 #ifdef UNITY_UNIT_TEST
400 #endif
401 
402 #endif /* FOXBMS__CAN_CFG_TX_MESSAGE_DEFINITIONS_H_ */
Headers for the configuration for the CAN module.