foxBMS  1.4.1
The foxBMS Battery Management System API Documentation
can_cfg_rx-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_rx-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 CANRX
50  *
51  * @brief Header for the driver for the CAN module
52  *
53  */
54 
55 #ifndef FOXBMS__CAN_CFG_RX_MESSAGE_DEFINITIONS_H_
56 #define FOXBMS__CAN_CFG_RX_MESSAGE_DEFINITIONS_H_
57 
58 /*========== Includes =======================================================*/
59 #include "can_cfg.h"
60 
61 /*========== Macros and Definitions =========================================*/
62 #define CANRX_NOT_PERIODIC (0u)
63 
64 /* Message IDs */
65 
66 /** CAN message ID to perform a software reset */
67 #define CANRX_SOFTWARE_RESET_ID (0x95u)
68 /** Periodicity of CAN software reset messages in ms */
69 #define CANRX_SOFTWARE_RESET_PERIOD_ms (CANRX_NOT_PERIODIC)
70 
71 /** CAN message ID to perform a state request */
72 #define CANRX_BMS_STATE_REQUEST_ID (0x230u)
73 /** Periodicity of CAN software reset messages in ms */
74 #define CANRX_BMS_STATE_REQUEST_PERIOD_ms (CANRX_NOT_PERIODIC)
75 
76 /** CAN message ID for debug message */
77 #define CANRX_DEBUG_ID (0x200u)
78 /** Periodicity of CAN software reset messages in ms */
79 #define CANRX_DEBUG_PERIOD_ms (CANRX_NOT_PERIODIC)
80 
81 /** CAN message ID to get software version */
82 #define CANRX_SOFTWARE_VERSION_ID (0x777u)
83 /** Periodicity of CAN ID to get the software version in ms */
84 #define CANRX_SOFTWARE_VERSION_PERIOD_ms (CANRX_NOT_PERIODIC)
85 
86 /**
87  * -------------------------CAUTION-------------------------
88  * The 3 following defines are used by the insulation monitoring device (IMD).
89  * If they are changed, the IMD will not work anymore
90  * -------------------------CAUTION-------------------------
91  */
92 /** CAN message ID for info message from iso165c */
93 #define CANRX_IMD_INFO_ID (0x37u)
94 /** CAN message ID for request message to iso165c */
95 #define CANRX_IMD_REQUEST_ID (0x22u)
96 /** CAN message ID for response message from iso165c */
97 #define CANRX_IMD_RESPONSE_ID (0x23u)
98 
99 /** IDs for the messages from the current sensors */
100 /** String 0 @{*/
101 #define CANRX_STRING0_CURRENT_ID (0x521u)
102 #define CANRX_STRING0_CURRENT_PERIOD_ms (CANRX_NOT_PERIODIC)
103 #define CANRX_STRING0_VOLTAGE1_ID (0x522u)
104 #define CANRX_STRING0_VOLTAGE1_PERIOD_ms (CANRX_NOT_PERIODIC)
105 #define CANRX_STRING0_VOLTAGE2_ID (0x523u)
106 #define CANRX_STRING0_VOLTAGE2_PERIOD_ms (CANRX_NOT_PERIODIC)
107 #define CANRX_STRING0_VOLTAGE3_ID (0x524u)
108 #define CANRX_STRING0_VOLTAGE3_PERIOD_ms (CANRX_NOT_PERIODIC)
109 #define CANRX_STRING0_TEMPERATURE_ID (0x525u)
110 #define CANRX_STRING0_TEMPERATURE_PERIOD_ms (CANRX_NOT_PERIODIC)
111 #define CANRX_STRING0_POWER_ID (0x526u)
112 #define CANRX_STRING0_POWER_PERIOD_ms (CANRX_NOT_PERIODIC)
113 #define CANRX_STRING0_CURRENT_COUNTER_ID (0x527u)
114 #define CANRX_STRING0_CURRENT_COUNTER_PERIOD_ms (CANRX_NOT_PERIODIC)
115 #define CANRX_STRING0_ENERGY_COUNTER_ID (0x528u)
116 #define CANRX_STRING0_ENERGY_COUNTER_PERIOD_ms (CANRX_NOT_PERIODIC)
117 /**@} */
118 
119 /** The Isabellenhuette current sensors use a data length code of 6 */
120 #define CANRX_CURRENT_SENSOR_MESSAGES_DLC (6u)
121 
122 /* composed Rx messages */
123 
124 /* AXIVION Disable Style Generic-NoUnsafeMacro: These macros MUST only be used
125  to populate the 'can_rxMessages' array. The type of this array expects data
126  exactly as it is provided here and therefore these macros are good (for this
127  and only for this purpose!).*/
128 #define CANRX_DEBUG_MESSAGE \
129  { \
130  .id = CANRX_DEBUG_ID, \
131  .dlc = CAN_DEFAULT_DLC, \
132  .endianness = CAN_LITTLE_ENDIAN, \
133  }, \
134  { \
135  .period = CANRX_DEBUG_PERIOD_ms \
136  }
137 
138 #define CANRX_SOFTWARE_VERSION_MESSAGE \
139  { \
140  .id = CANRX_SOFTWARE_VERSION_ID, \
141  .dlc = CAN_DEFAULT_DLC, \
142  .endianness = CAN_LITTLE_ENDIAN, \
143  }, \
144  { \
145  .period = CANRX_SOFTWARE_VERSION_PERIOD_ms \
146  }
147 
148 #define CANRX_IMD_INFO_MESSAGE \
149  { \
150  .id = CANRX_IMD_INFO_ID, \
151  .dlc = CAN_DEFAULT_DLC, \
152  .endianness = CAN_LITTLE_ENDIAN, \
153  }, \
154  { \
155  .period = CANRX_NOT_PERIODIC \
156  }
157 
158 #define CANRX_IMD_RESPONSE_MESSAGE \
159  { \
160  .id = CANRX_IMD_RESPONSE_ID, \
161  .dlc = CAN_DEFAULT_DLC, \
162  .endianness = CAN_LITTLE_ENDIAN, \
163  }, \
164  { \
165  .period = CANRX_NOT_PERIODIC \
166  }
167 
168 #define CANRX_BMS_STATE_REQUEST_MESSAGE \
169  { \
170  .id = CANRX_BMS_STATE_REQUEST_ID, \
171  .dlc = CAN_DEFAULT_DLC, \
172  .endianness = CAN_BIG_ENDIAN, \
173  }, \
174  { \
175  .period = CANRX_BMS_STATE_REQUEST_PERIOD_ms \
176  }
177 
178 #define CANRX_SOFTWARE_RESET_MESSAGE \
179  { \
180  .id = CANRX_SOFTWARE_RESET_ID, \
181  .dlc = CAN_DEFAULT_DLC, \
182  .endianness = CAN_LITTLE_ENDIAN, \
183  }, \
184  { \
185  .period = CANRX_SOFTWARE_RESET_PERIOD_ms \
186  }
187 
188 #define CANRX_STRING0_CURRENT_MESSAGE \
189  { \
190  .id = CANRX_STRING0_CURRENT_ID, \
191  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
192  .endianness = CAN_BIG_ENDIAN, \
193  }, \
194  { \
195  .period = CANRX_STRING0_CURRENT_PERIOD_ms \
196  }
197 
198 #define CANRX_STRING0_VOLTAGE1_MESSAGE \
199  { \
200  .id = CANRX_STRING0_VOLTAGE1_ID, \
201  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
202  .endianness = CAN_BIG_ENDIAN, \
203  }, \
204  { \
205  .period = CANRX_STRING0_VOLTAGE1_PERIOD_ms \
206  }
207 
208 #define CANRX_STRING0_VOLTAGE2_MESSAGE \
209  { \
210  .id = CANRX_STRING0_VOLTAGE2_ID, \
211  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
212  .endianness = CAN_BIG_ENDIAN, \
213  }, \
214  { \
215  .period = CANRX_STRING0_VOLTAGE2_PERIOD_ms \
216  }
217 
218 #define CANRX_STRING0_VOLTAGE3_MESSAGE \
219  { \
220  .id = CANRX_STRING0_VOLTAGE3_ID, \
221  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
222  .endianness = CAN_BIG_ENDIAN, \
223  }, \
224  { \
225  .period = CANRX_STRING0_VOLTAGE3_PERIOD_ms \
226  }
227 
228 #define CANRX_STRING0_TEMPERATURE_MESSAGE \
229  { \
230  .id = CANRX_STRING0_TEMPERATURE_ID, \
231  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
232  .endianness = CAN_BIG_ENDIAN, \
233  }, \
234  { \
235  .period = CANRX_STRING0_TEMPERATURE_PERIOD_ms \
236  }
237 
238 #define CANRX_STRING0_POWER_MESSAGE \
239  { \
240  .id = CANRX_STRING0_POWER_ID, \
241  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
242  .endianness = CAN_BIG_ENDIAN, \
243  }, \
244  { \
245  .period = CANRX_STRING0_POWER_PERIOD_ms \
246  }
247 
248 #define CANRX_STRING0_CURRENT_COUNTER_MESSAGE \
249  { \
250  .id = CANRX_STRING0_CURRENT_COUNTER_ID, \
251  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
252  .endianness = CAN_BIG_ENDIAN, \
253  }, \
254  { \
255  .period = CANRX_STRING0_CURRENT_COUNTER_PERIOD_ms \
256  }
257 
258 #define CANRX_STRING0_ENERGY_COUNTER_MESSAGE \
259  { \
260  .id = CANRX_STRING0_ENERGY_COUNTER_ID, \
261  .dlc = CANRX_CURRENT_SENSOR_MESSAGES_DLC, \
262  .endianness = CAN_BIG_ENDIAN, \
263  }, \
264  { \
265  .period = CANRX_STRING0_ENERGY_COUNTER_PERIOD_ms \
266  }
267 /* AXIVION Enable Style Generic-NoUnsafeMacro */
268 
269 /*========== Extern Constant and Variable Declarations ======================*/
270 
271 /*========== Extern Function Prototypes =====================================*/
272 
273 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
274 
275 #endif /* FOXBMS__CAN_CFG_RX_MESSAGE_DEFINITIONS_H_ */
Headers for the configuration for the CAN module.