foxBMS - Unit Tests  1.4.1
The foxBMS Unit Tests API Documentation
can_cfg_tx-message-definitions.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2022, 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 2022-10-27 (date of last update)
47  * @version v1.4.1
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 /*========== Macros and Definitions =========================================*/
62 #define CANTX_NOT_PERIODIC (0u)
63 
64 /* Message IDs */
65 
66 /** CAN message ID for boot message */
67 #define CANTX_BOOT_ID (0x199u) /* check_ids silence: CANTX_BOOT_ID */
68 /** Periodicity of boot messages in ms */
69 #define CANTX_BOOT_PERIOD_ms (CANTX_NOT_PERIODIC) /* dummy */
70 #define CANTX_BOOT_PHASE_ms (0u) /* dummy */
71 #define CANTX_BOOT_MESSAGE (-1) /* dummy */
72 
73 /** CAN message ID for die ID message */
74 #define CANTX_DIE_ID_ID (0x227u) /* mark as dummy but it is not src/app/driver/config/can_cfg_tx_boot-message.c */
75 /** Periodicity of die ID messages in ms */
76 #define CANTX_DIE_ID_PERIOD_ms (CANTX_NOT_PERIODIC) /* dummy */
77 #define CANTX_DIE_ID_PHASE_ms (0u) /* dummy */
78 #define CANTX_DIE_ID_MESSAGE (-1) /* dummy */
79 
80 /** CAN message ID to send state */
81 #define CANTX_BMS_STATE_ID (0x220u)
82 /** Periodicity of CAN state messages in ms */
83 #define CANTX_BMS_STATE_PERIOD_ms (100u)
84 /** Phase of CAN state messages in ms */
85 #define CANTX_BMS_STATE_PHASE_ms (0u)
86 
87 /** CAN message ID to send detail state */
88 #define CANTX_BMS_STATE_DETAILS_ID (0x226u)
89 /** Periodicity of CAN detail state messages in ms */
90 #define CANTX_BMS_STATE_DETAILS_PERIOD_ms (1000u)
91 /** Phase of CAN detail state messages in ms */
92 #define CANTX_BMS_STATE_DETAILS_PHASE_ms (100u)
93 
94 /** CAN message ID to send voltages */
95 #define CANTX_CELL_VOLTAGES_ID (0x240u)
96 /** Periodicity of CAN voltage messages in ms */
97 #define CANTX_CELL_VOLTAGES_PERIOD_ms (100u)
98 /** Phase of CAN voltage messages in ms */
99 #define CANTX_CELL_VOLTAGES_PHASE_ms (10u)
100 
101 /** CAN message ID to send temperatures */
102 #define CANTX_CELL_TEMPERATURES_ID (0x250u)
103 /** Periodicity of CAN temperature messages in ms */
104 #define CANTX_CELL_TEMPERATURES_PERIOD_ms (200u)
105 /** Phase of CAN temperature messages in ms */
106 #define CANTX_CELL_TEMPERATURES_PHASE_ms (20u)
107 
108 /** CAN message ID to send limit values */
109 #define CANTX_LIMIT_VALUES_ID (0x224u)
110 /** Periodicity of CAN limit messages in ms */
111 #define CANTX_LIMIT_VALUES_PERIOD_ms (100u)
112 /** Phase of CAN limit messages in ms */
113 #define CANTX_LIMIT_VALUES_PHASE_ms (30u)
114 
115 /** CAN message ID to send minimum and maximum values */
116 #define CANTX_MINIMUM_MAXIMUM_VALUES_ID (0x223u)
117 /** Periodicity of CAN minimum and maximum value messages in ms */
118 #define CANTX_MINIMUM_MAXIMUM_VALUES_PERIOD_ms (100u)
119 /** Phase of CAN minimum and maximum value messages in ms */
120 #define CANTX_MINIMUM_MAXIMUM_VALUES_PHASE_ms (40u)
121 
122 /** CAN message ID to send pack state estimation values */
123 #define CANTX_PACK_STATE_ESTIMATION_ID (0x225u)
124 /** Periodicity of CAN pack state estimation messages in ms */
125 #define CANTX_PACK_STATE_ESTIMATION_PERIOD_ms (1000u)
126 /** Phase of CAN pack state estimation messages in ms */
127 #define CANTX_PACK_STATE_ESTIMATION_PHASE_ms (50u)
128 
129 /** CAN message ID to send pack values */
130 #define CANTX_PACK_VALUES_ID (0x222u)
131 /** Periodicity of CAN pack values messages in ms */
132 #define CANTX_PACK_VALUES_PERIOD_ms (100u)
133 /** Phase of CAN pack values messages in ms */
134 #define CANTX_PACK_VALUES_PHASE_ms (60u)
135 
136 /** TX messages - string related */
137 
138 /** CAN message ID to send string state */
139 #define CANTX_STRING_STATE_ID (0x221u)
140 /** Periodicity of CAN string state messages in ms */
141 #define CANTX_STRING_STATE_PERIOD_ms (100u)
142 /** Phase of CAN string state messages in ms */
143 #define CANTX_STRING_STATE_PHASE_ms (70u)
144 
145 /** CAN message ID to send string values */
146 #define CANTX_STRING_VALUES_P0_ID (0x280u)
147 /** Periodicity of CAN string state messages in ms */
148 #define CANTX_STRING_VALUES_P0_PERIOD_ms (100u)
149 /** Phase of CAN string state messages in ms */
150 #define CANTX_STRING_VALUES_P0_PHASE_ms (80u)
151 
152 /** CAN message ID to send string minimum and maximum values */
153 #define CANTX_STRING_MIN_MAX_VALUES_ID (0x281u)
154 /** Periodicity of CAN string state messages in ms */
155 #define CANTX_STRING_MIN_MAX_VALUES_PERIOD_ms (100u)
156 /** Phase of CAN string state messages in ms */
157 #define CANTX_STRING_MIN_MAX_VALUES_PHASE_ms (90u)
158 
159 /** CAN message ID to send string minimum and maximum values */
160 #define CANTX_STRING_STATE_ESTIMATION_ID (0x282u)
161 /** Periodicity of CAN string state messages in ms */
162 #define CANTX_STRING_STATE_ESTIMATION_PERIOD_ms (1000u)
163 /** Phase of CAN string state messages in ms */
164 #define CANTX_STRING_STATE_ESTIMATION_PHASE_ms (0u)
165 
166 /** CAN message ID to send string values 2 */
167 #define CANTX_STRING_VALUES_P1_ID (0x283u)
168 /** Periodicity of CAN string state messages in ms */
169 #define CANTX_STRING_VALUES_P1_PERIOD_ms (100u)
170 /** Phase of CAN string state messages in ms */
171 #define CANTX_STRING_VALUES_P1_PHASE_ms (10u)
172 
173 /* composed Tx messages */
174 
175 /* AXIVION Disable Style Generic-NoUnsafeMacro: These macros MUST only be used
176  to populate the 'can_txMessages' array. The type of this array expects data
177  exactly as it is provided here and therefore these macros are good (for this
178  and only for this purpose!).*/
179 #define CANTX_BMS_STATE_MESSAGE \
180  { \
181  .dlc = CAN_DEFAULT_DLC, \
182  .id = CANTX_BMS_STATE_ID, \
183  .endianness = CAN_BIG_ENDIAN, \
184  }, \
185  { \
186  .period = CANTX_BMS_STATE_PERIOD_ms, .phase = CANTX_BMS_STATE_PHASE_ms \
187  }
188 
189 #define CANTX_BMS_STATE_DETAILS_MESSAGE \
190  { \
191  .id = CANTX_BMS_STATE_DETAILS_ID, \
192  .dlc = CAN_DEFAULT_DLC, \
193  .endianness = CAN_BIG_ENDIAN, \
194  }, \
195  { \
196  .period = CANTX_BMS_STATE_DETAILS_PERIOD_ms, .phase = CANTX_BMS_STATE_DETAILS_PHASE_ms \
197  }
198 
199 #define CANTX_CELL_VOLTAGES_MESSAGE \
200  { \
201  .id = CANTX_CELL_VOLTAGES_ID, \
202  .dlc = CAN_DEFAULT_DLC, \
203  .endianness = CAN_BIG_ENDIAN, \
204  }, \
205  { \
206  .period = CANTX_CELL_VOLTAGES_PERIOD_ms, .phase = CANTX_CELL_VOLTAGES_PHASE_ms \
207  }
208 
209 #define CANTX_MINIMUM_MAXIMUM_VALUES_MESSAGE \
210  { \
211  .id = CANTX_MINIMUM_MAXIMUM_VALUES_ID, \
212  .dlc = CAN_DEFAULT_DLC, \
213  .endianness = CAN_BIG_ENDIAN, \
214  }, \
215  { \
216  .period = CANTX_MINIMUM_MAXIMUM_VALUES_PERIOD_ms, .phase = CANTX_MINIMUM_MAXIMUM_VALUES_PHASE_ms \
217  }
218 
219 #define CANTX_LIMIT_VALUES_MESSAGE \
220  { \
221  .id = CANTX_LIMIT_VALUES_ID, \
222  .dlc = CAN_DEFAULT_DLC, \
223  .endianness = CAN_BIG_ENDIAN, \
224  }, \
225  { \
226  .period = CANTX_LIMIT_VALUES_PERIOD_ms, .phase = CANTX_LIMIT_VALUES_PHASE_ms \
227  }
228 
229 #define CANTX_CELL_TEMPERATURES_MESSAGE \
230  { \
231  .id = CANTX_CELL_TEMPERATURES_ID, \
232  .dlc = CAN_DEFAULT_DLC, \
233  .endianness = CAN_BIG_ENDIAN, \
234  }, \
235  { \
236  .period = CANTX_CELL_TEMPERATURES_PERIOD_ms, .phase = CANTX_CELL_TEMPERATURES_PHASE_ms \
237  }
238 
239 #define CANTX_PACK_STATE_ESTIMATION_MESSAGE \
240  { \
241  .id = CANTX_PACK_STATE_ESTIMATION_ID, \
242  .dlc = CAN_DEFAULT_DLC, \
243  .endianness = CAN_BIG_ENDIAN, \
244  }, \
245  { \
246  .period = CANTX_PACK_STATE_ESTIMATION_PERIOD_ms, .phase = CANTX_PACK_STATE_ESTIMATION_PHASE_ms \
247  }
248 
249 #define CANTX_PACK_VALUES_MESSAGE \
250  { \
251  .id = CANTX_PACK_VALUES_ID, \
252  .dlc = CAN_DEFAULT_DLC, \
253  .endianness = CAN_BIG_ENDIAN, \
254  }, \
255  { \
256  .period = CANTX_PACK_VALUES_PERIOD_ms, .phase = CANTX_PACK_VALUES_PHASE_ms \
257  }
258 
259 #define CANTX_STRING_STATE_MESSAGE \
260  { \
261  .id = CANTX_STRING_STATE_ID, \
262  .dlc = CAN_DEFAULT_DLC, \
263  .endianness = CAN_BIG_ENDIAN, \
264  }, \
265  { \
266  .period = CANTX_STRING_STATE_PERIOD_ms, .phase = CANTX_STRING_STATE_PHASE_ms \
267  }
268 
269 #define CANTX_STRING_VALUES_P0_MESSAGE \
270  { \
271  .id = CANTX_STRING_VALUES_P0_ID, \
272  .dlc = CAN_DEFAULT_DLC, \
273  .endianness = CAN_BIG_ENDIAN, \
274  }, \
275  { \
276  .period = CANTX_STRING_VALUES_P0_PERIOD_ms, .phase = CANTX_STRING_VALUES_P0_PHASE_ms \
277  }
278 
279 #define CANTX_STRING_VALUES_P1_MESSAGE \
280  { \
281  .id = CANTX_STRING_VALUES_P1_ID, \
282  .dlc = CAN_DEFAULT_DLC, \
283  .endianness = CAN_BIG_ENDIAN, \
284  }, \
285  { \
286  .period = CANTX_STRING_VALUES_P1_PERIOD_ms, .phase = CANTX_STRING_VALUES_P1_PHASE_ms \
287  }
288 
289 #define CANTX_STRING_MIN_MAX_VALUES_MESSAGE \
290  { \
291  .id = CANTX_STRING_MIN_MAX_VALUES_ID, \
292  .dlc = CAN_DEFAULT_DLC, \
293  .endianness = CAN_BIG_ENDIAN, \
294  }, \
295  { \
296  .period = CANTX_STRING_MIN_MAX_VALUES_PERIOD_ms, .phase = CANTX_STRING_MIN_MAX_VALUES_PHASE_ms \
297  }
298 
299 #define CANTX_STRING_STATE_ESTIMATION_MESSAGE \
300  { \
301  .id = CANTX_STRING_STATE_ESTIMATION_ID, \
302  .dlc = CAN_DEFAULT_DLC, \
303  .endianness = CAN_BIG_ENDIAN, \
304  }, \
305  { \
306  .period = CANTX_STRING_STATE_ESTIMATION_PERIOD_ms, .phase = CANTX_STRING_STATE_ESTIMATION_PHASE_ms \
307  }
308 /* AXIVION Enable Style Generic-NoUnsafeMacro */
309 
310 /*========== Extern Constant and Variable Declarations ======================*/
311 
312 /*========== Extern Function Prototypes =====================================*/
313 
314 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
315 
316 #endif /* FOXBMS__CAN_CFG_TX_MESSAGE_DEFINITIONS_H_ */
Headers for the configuration for the CAN module.