foxBMS - Unit Tests  1.4.1
The foxBMS Unit Tests API Documentation
diag_cfg.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 diag_cfg.h
44  * @author foxBMS Team
45  * @date 2019-11-28 (date of creation)
46  * @updated 2022-10-27 (date of last update)
47  * @version v1.4.1
48  * @ingroup ENGINE_CONFIGURATION
49  * @prefix DIAG
50  *
51  * @brief Diagnostic module configuration header
52  * @details In this header filer are the different diagnosis channel defines
53  * assigned to different diagnosis IDs. Furthermore are the diagnosis
54  * error log settings be configured here.
55  */
56 
57 #ifndef FOXBMS__DIAG_CFG_H_
58 #define FOXBMS__DIAG_CFG_H_
59 
60 /*========== Includes =======================================================*/
61 #include "general.h"
62 
63 #include "battery_system_cfg.h"
64 #include "database_cfg.h"
65 
66 /*========== Macros and Definitions =========================================*/
67 #define DIAG_ERROR_SENSITIVITY_FIRST_EVENT (0) /*!< logging at first event */
68 #define DIAG_ERROR_SENSITIVITY_THIRD_EVENT (2) /*!< logging at third event */
69 #define DIAG_ERROR_SENSITIVITY_FIFTH_EVENT (4) /*!< logging at fifth event */
70 #define DIAG_ERROR_SENSITIVITY_TENTH_EVENT (9) /*!< logging at tenth event */
71 
72 #define DIAG_ERROR_SENSITIVITY_HIGH (0) /*!< logging at first event */
73 #define DIAG_ERROR_SENSITIVITY_MID (5) /*!< logging at fifth event */
74 #define DIAG_ERROR_SENSITIVITY_LOW (10) /*!< logging at tenth event */
75 
76 #define DIAG_ERROR_INTERLOCK_SENSITIVITY (10) /*!< logging level of interlock */
77 
78 #define DIAG_ERROR_VOLTAGE_SENSITIVITY_MSL (500) /*!< MSL level for event occurrence if over/under voltage event */
79 #define DIAG_ERROR_VOLTAGE_SENSITIVITY_RSL (500) /*!< RSL level for event occurrence if over/under voltage event */
80 #define DIAG_ERROR_VOLTAGE_SENSITIVITY_MOL (500) /*!< MOL level for event occurrence if over/under voltage event */
81 
82 /** MSL level for event occurrence if over/under temperature event */
83 #define DIAG_ERROR_TEMPERATURE_SENSITIVITY_MSL (500)
84 /** RSL level for event occurrence if over/under temperature event */
85 #define DIAG_ERROR_TEMPERATURE_SENSITIVITY_RSL (500)
86 /** MOL level for event occurrence if over/under temperature event */
87 #define DIAG_ERROR_TEMPERATURE_SENSITIVITY_MOL (500)
88 
89 /** MSL level for event occurrence if over/under current event */
90 #define DIAG_ERROR_CURRENT_SENSITIVITY_MSL (500)
91 /** RSL level for event occurrence if over/under current event */
92 #define DIAG_ERROR_CURRENT_SENSITIVITY_RSL (500)
93 /** MOL level for event occurrence if over/under current event */
94 #define DIAG_ERROR_CURRENT_SENSITIVITY_MOL (500)
95 
96 #define DIAG_ERROR_LTC_PEC_SENSITIVITY (5) /*!< logging level of LTC PEC errors */
97 #define DIAG_ERROR_LTC_MUX_SENSITIVITY (5) /*!< logging level of LTC MUX errors */
98 #define DIAG_ERROR_LTC_SPI_SENSITIVITY (5) /*!< logging level of LTC SPI errors */
99 
100 #define DIAG_ERROR_CAN_TIMING_SENSITIVITY (100) /*!< logging level of CAN timing errors */
101 #define DIAG_ERROR_CAN_TIMING_CC_SENSITIVITY (100) /*!< logging level of CAN timing errors on the current sensor */
102 #define DIAG_ERROR_CAN_SENSOR_SENSITIVITY (100) /*!< logging level of CAN errors on the current sensor */
103 
104 /**
105  * Logging after 20th event for errors connected related to the contactor
106  * feedback. This value is chosen to be so large because of the time delay
107  * between the request for a state and the actual physical response. It is
108  * caused by the SPI transaction to the SPS module, the rise time of the
109  * control signal and the actual opening/closing of the contactor. Only then
110  * can the feedback be read correctly, which also take some additional delay
111  * depending on the feedback source. */
112 #define DIAG_ERROR_CONTACTOR_FEEDBACK_SENSITIVITY (20)
113 
114 /** ---------------- DEFINES FOR ERROR STATE TRANSITION DELAY----------------
115  * These defines configure the delay before the transition to the error state
116  * occurs if a fault is detected. During this time the BMS can alert a
117  * superordinate control unit that the contactors will be opened soon. The
118  * superior control unit can take action and e.g., reduce the current until
119  * the transition to error state takes place.
120  *
121  * The delay is not taken into account if severity level #DIAG_FATAL_ERROR of
122  * type #DIAG_SEVERITY_LEVEL_e is configured in config array #diag_diagnosisIdConfiguration.
123  * For any other severity, #DIAG_DELAY_DISCARDED can be used as a dummy value.
124  */
125 #define DIAG_DELAY_DISCARDED (UINT32_MAX)
126 /** no delay after error is detected, open contactors instantaneous */
127 #define DIAG_NO_DELAY (0u)
128 /** delay for interlock error */
129 #define DIAG_DELAY_INTERLOCK_ms (100u)
130 /** delay for overvoltage errors */
131 #define DIAG_DELAY_OVERVOLTAGE_ms (200u)
132 /** delay for undervoltage errors */
133 #define DIAG_DELAY_UNDERVOLTAGE_ms (200u)
134 /** delay for temperature errors */
135 #define DIAG_DELAY_TEMPERATURE_ms (1000u)
136 /** delay for overcurrent errors */
137 #define DIAG_DELAY_OVERCURRENT_ms (100u)
138 /** delay for AFE related errors */
139 #define DIAG_DELAY_AFE_ms (100u)
140 /** delay for can timing error */
141 #define DIAG_DELAY_CAN_TIMING_ms (200u)
142 /** delay for energy counting/coulomb counting timing error */
143 #define DIAG_DELAY_EC_CC_TIMING_ms (2000u)
144 /** delay for current sensor response error */
145 #define DIAG_DELAY_CURRENT_SENSOR_ms (200u)
146 /** delay for SBC related errors */
147 #define DIAG_DELAY_SBC_ms (100u)
148 /** delay for pack voltage plausibility error */
149 #define DIAG_DELAY_PL_PACK_VOLTAGE_ms (100u)
150 /** delay for contactor feedback errors */
151 #define DIAG_DELAY_CONTACTOR_FEEDBACK_ms (100u)
152 /** delay for deep-discharge error */
153 #define DIAG_DELAY_DEEP_DISCHARGE_ms (100u)
154 /** delay redundancy measurement timeout errors */
155 #define DIAG_DELAY_REDUNDANCY_MEAS_TIMEOUT_ms (100u)
156 /** delay redundancy measurement errors */
157 #define DIAG_DELAY_REDUNDANCY_MEAS_ERROR_ms (100u)
158 
159 /** Maximum number of the same errors that are logged */
160 #define DIAG_MAX_ENTRIES_OF_ERROR (5)
161 
162 /** composite type for storing and passing on the local database table handles */
163 typedef struct {
164  DATA_BLOCK_ERRORSTATE_s *pTableError; /*!< database table with error states */
165  DATA_BLOCK_MOL_FLAG_s *pTableMol; /*!< database table with MOL flags */
166  DATA_BLOCK_RSL_FLAG_s *pTableRsl; /*!< database table with RSL flags */
167  DATA_BLOCK_MSL_FLAG_s *pTableMsl; /*!< database table with MSL flags */
169 
170 /** variable for storing and passing on the local database table handles */
172 
173 /** list of diag IDs */
174 typedef enum {
175  DIAG_ID_FLASHCHECKSUM, /*!< the checksum of the flashed software could not be validated */
176  DIAG_ID_SYSTEM_MONITORING, /*!< the system monitoring module has detected a deviation from task timing limits */
177  DIAG_ID_CONFIGASSERT, /*!< TODO */
178  DIAG_ID_AFE_SPI, /*!< issues with the SPI communication of the AFE */
179  DIAG_ID_AFE_COM_INTEGRITY, /*!< error on the communication integrity of the AFE, e.g. PEC error for LTC */
180  DIAG_ID_AFE_MUX, /*!< the multiplexer that is connected to the AFE does not react in an expected way */
181  DIAG_ID_AFE_CONFIG, /*!< the AFE driver has recognized a configuration error */
182  DIAG_ID_CAN_TIMING, /*!< the BMS does not receive CAN messages or they are not inside the expected timing constraints */
183  DIAG_ID_CAN_RX_QUEUE_FULL, /*!< the reception queue of the driver is full; no new messages can be received */
184  DIAG_ID_CAN_CC_RESPONDING, /*!< current counter measurements on the CAN bus are missing or not inside expected timing constraints */
185  DIAG_ID_CAN_EC_RESPONDING, /*!< energy counter measurements on the CAN bus are missing or not inside expected timing constraints */
186  DIAG_ID_CURRENT_SENSOR_RESPONDING, /*!< current sensor measurements on the CAN bus are missing or not inside expected timing constraints */
187  DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE, /*!< redundant measurement of the cell voltages has returned implausible values */
188  DIAG_ID_AFE_CELL_VOLTAGE_MEAS_ERROR, /*!< the AFE driver has determined a cell voltage measurement to be implausible */
189  DIAG_ID_AFE_CELL_TEMPERATURE_MEAS_ERROR, /*!< the AFE driver has determined a cell temperature measurement to be implausible */
190  DIAG_ID_PLAUSIBILITY_CELL_TEMP, /*!< redundant measurement of the cell temperatures has returned implausible values */
191  DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE_SPREAD, /*!< the spread (difference between min and max values) of the cell voltages is implausibly high */
192  DIAG_ID_PLAUSIBILITY_CELL_TEMPERATURE_SPREAD, /*!< the spread (difference between min and max values) of the cell temperatures is implausibly high */
193  DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL, /*!< Cell voltage limits violated */
194  DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL, /*!< Cell voltage limits violated */
195  DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MOL, /*!< Cell voltage limits violated */
196  DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL, /*!< Cell voltage limits violated */
197  DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_RSL, /*!< Cell voltage limits violated */
198  DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MOL, /*!< Cell voltage limits violated */
199  DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MSL, /*!< Temperature limits violated */
200  DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_RSL, /*!< Temperature limits violated */
201  DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MOL, /*!< Temperature limits violated */
202  DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MSL, /*!< Temperature limits violated */
203  DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_RSL, /*!< Temperature limits violated */
204  DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MOL, /*!< Temperature limits violated */
205  DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MSL, /*!< Temperature limits violated */
206  DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_RSL, /*!< Temperature limits violated */
207  DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MOL, /*!< Temperature limits violated */
208  DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MSL, /*!< Temperature limits violated */
209  DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_RSL, /*!< Temperature limits violated */
210  DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MOL, /*!< Temperature limits violated */
211  DIAG_ID_OVERCURRENT_CHARGE_CELL_MSL, /*!< Overcurrent on cell-level */
212  DIAG_ID_OVERCURRENT_CHARGE_CELL_RSL, /*!< Overcurrent on cell-level */
213  DIAG_ID_OVERCURRENT_CHARGE_CELL_MOL, /*!< Overcurrent on cell-level */
214  DIAG_ID_OVERCURRENT_DISCHARGE_CELL_MSL, /*!< Overcurrent on cell-level */
215  DIAG_ID_OVERCURRENT_DISCHARGE_CELL_RSL, /*!< Overcurrent on cell-level */
216  DIAG_ID_OVERCURRENT_DISCHARGE_CELL_MOL, /*!< Overcurrent on cell-level */
217  DIAG_ID_STRING_OVERCURRENT_CHARGE_MSL, /*!< Overcurrent on string-level */
218  DIAG_ID_STRING_OVERCURRENT_CHARGE_RSL, /*!< Overcurrent on string-level */
219  DIAG_ID_STRING_OVERCURRENT_CHARGE_MOL, /*!< Overcurrent on string-level */
220  DIAG_ID_STRING_OVERCURRENT_DISCHARGE_MSL, /*!< Overcurrent on string-level */
221  DIAG_ID_STRING_OVERCURRENT_DISCHARGE_RSL, /*!< Overcurrent on string-level */
222  DIAG_ID_STRING_OVERCURRENT_DISCHARGE_MOL, /*!< Overcurrent on string-level */
223  DIAG_ID_PACK_OVERCURRENT_CHARGE_MSL, /*!< Overcurrent on string-level */
224  DIAG_ID_PACK_OVERCURRENT_DISCHARGE_MSL, /*!< Overcurrent on pack-level */
225  DIAG_ID_CURRENT_ON_OPEN_STRING, /*!< Current flowing on open string */
226  DIAG_ID_DEEP_DISCHARGE_DETECTED, /*!< the deep discharge flag has been set in persistent memory */
227  DIAG_ID_AFE_OPEN_WIRE, /*!< an open (broken) sense wire has been detected on the battery cell measurement */
228  DIAG_ID_PLAUSIBILITY_PACK_VOLTAGE, /*!< the plausibility module has decided that the pack voltage is implausible */
229  DIAG_ID_INTERLOCK_FEEDBACK, /*!< the interlock feedback indicates it to be open (but it is expected to be closed) */
230  DIAG_ID_STRING_MINUS_CONTACTOR_FEEDBACK, /*!< the feedback on a string minus contactor does not match the expected value */
231  DIAG_ID_STRING_PLUS_CONTACTOR_FEEDBACK, /*!< the feedback on a string plus contactor does not match the expected value */
232  DIAG_ID_PRECHARGE_CONTACTOR_FEEDBACK, /*!< the feedback on a precharge contactor does not match the expected value */
233  DIAG_ID_SBC_FIN_STATE, /*!< the state of the FIN signal in the SBC is not ok */
234  DIAG_ID_SBC_RSTB_STATE, /*!< an activation of the RSTB pin of the SBC has been detected */
235  DIAG_ID_BASE_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the base cell voltage measurements are missing */
236  DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the redundancy0 cell voltage measurements are missing */
237  DIAG_ID_BASE_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the base cell temperature measurements are missing */
238  DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the redundancy0 temperature measurements are missing */
239  DIAG_ID_CURRENT_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the current measurement on a string is not updated */
240  DIAG_ID_CURRENT_MEASUREMENT_ERROR, /*!< the redundancy module has detected a current measurement to be invalid */
241  DIAG_ID_CURRENT_SENSOR_V1_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the voltage 1 measurement of a current sensor is not updated */
242  DIAG_ID_CURRENT_SENSOR_V3_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the voltage 3 measurement of a current sensor is not updated */
243  DIAG_ID_CURRENT_SENSOR_POWER_MEASUREMENT_TIMEOUT, /*!< the redundancy module has detected that the power measurement of a current sensor is not updated */
244  DIAG_ID_POWER_MEASUREMENT_ERROR, /*!< the redundancy module has detected a power measurement to be invalid */
245  DIAG_ID_INSULATION_MEASUREMENT_VALID, /*!< the insulation measurement is valid or invalid */
246  DIAG_ID_LOW_INSULATION_RESISTANCE_ERROR, /*!< a critical low insulation resistance has been measured */
247  DIAG_ID_LOW_INSULATION_RESISTANCE_WARNING, /*!< a warnable low insulation resistance has been measured */
248  DIAG_ID_INSULATION_GROUND_ERROR, /*!< insulation monitoring has detected a ground error */
249  DIAG_ID_I2C_PEX_ERROR, /*!< general error with the port expanders */
250  DIAG_ID_FRAM_READ_CRC_ERROR, /*!< CRC does not match when reading from the FRAM */
251  DIAG_ID_ALERT_MODE, /*!< Critical error while opening the contactors. Fuse has not triggered */
252  DIAG_ID_MAX, /*!< MAX indicator - do not change */
253 } DIAG_ID_e;
254 
255 /** diagnosis check result (event) */
256 typedef enum {
257  DIAG_EVENT_OK, /**< diag channel event OK */
258  DIAG_EVENT_NOT_OK, /**< diag channel event NOK */
259  DIAG_EVENT_RESET, /**< reset diag channel eventcounter to 0 */
260 } DIAG_EVENT_e;
261 
262 /** enable or disable the diagnosis handling for an event */
263 typedef enum {
264  DIAG_EVALUATION_ENABLED, /**< enables evaluation of diagnosis handling */
265  DIAG_EVALUATION_DISABLED, /**< disables evaluation of diagnosis handling */
267 
268 /** impact level of diagnosis event, e.g., influences the event the whole system or only a string */
269 typedef enum {
270  DIAG_SYSTEM, /**< diag event impact is system related e.g., can timing */
271  DIAG_STRING, /**< diag event impact is string related e.g., overvoltage in string x */
273 
274 /**
275  * @def DIAG_CAN_TIMING
276  * @brief Value that is written into the field that describes whether CAN
277  * timing diag entries should be generated
278  */
279 #if CHECK_CAN_TIMING == true
280 #define DIAG_CAN_TIMING (DIAG_EVALUATION_ENABLED)
281 #else
282 #define DIAG_CAN_TIMING (DIAG_EVALUATION_DISABLED)
283 #endif
284 
285 /**
286  * @def DIAG_CAN_SENSOR_PRESENT
287  * @brief Value that is written into the field that describes whether current
288  * sensor diag entries should be generated if it is not present
289  */
290 #if CURRENT_SENSOR_PRESENT == true
291 #define DIAG_CAN_SENSOR_PRESENT (DIAG_EVALUATION_ENABLED)
292 #else /* CURRENT_SENSOR_PRESENT == true */
293 #define DIAG_CAN_SENSOR_PRESENT (DIAG_EVALUATION_DISABLED)
294 #endif /* CURRENT_SENSOR_PRESENT */
295 
296 /** diagnosis severity level */
297 typedef enum {
298  DIAG_FATAL_ERROR, /*!< severity level fatal error */
299  DIAG_WARNING, /*!< severity level warning */
300  DIAG_INFO, /*!< severity level info */
302 
303 /** diagnosis recording activation */
304 typedef enum {
305  DIAG_RECORDING_ENABLED, /**< enable diagnosis event recording */
306  DIAG_RECORDING_DISABLED, /**< disable diagnosis event recording */
308 
309 /**
310  * @brief function type for diag callbacks
311  * @param[in] diagId ID of diag entry
312  * @param[in] event #DIAG_EVENT_e
313  * @param[in] kpkDiagShim shim to the database entries
314  * @param[in] data data
315  */
317  DIAG_ID_e diagId,
318  DIAG_EVENT_e event,
319  const DIAG_DATABASE_SHIM_s *const kpkDiagShim,
320  uint32_t data);
321 
322 /** Channel configuration of one diag channel */
323 typedef struct {
324  DIAG_ID_e id; /**< diagnosis event id diag_id */
325  uint16_t threshold; /**< threshold for number of events which will be
326  * tolerated before generating a notification in both directions:
327  * threshold = 0: reports the value at first occurrence,
328  * threshold = 1: reports the value at second occurrence */
330  severity; /**< severity of diag entry, #DIAG_FATAL_ERROR will lead to an opening of the contactors */
331  uint32_t
332  delay_ms; /**< delay in ms after error detection if severity is #DIAG_FATAL_ERROR until an opening the contactors */
333  DIAG_RECORDING_e enable_recording; /**< if enabled recording in diag_memory * will be activated */
334  DIAG_EVALUATE_e enable_evaluate; /**< if enabled diagnosis event will be evaluated */
335  DIAG_CALLBACK_FUNCTION_f *fpCallback; /**< will be called if
336  * number of events exceeds threshold in both
337  * directions with parameter DIAG_EVENT_e
338  * string id or system related data */
339 } DIAG_ID_CFG_s;
340 
341 /** struct for device Configuration of diag module */
342 typedef struct {
343  uint8_t nrOfConfiguredDiagnosisEntries; /*!< number of entries in DIAG_ID_CFG_s */
344  DIAG_ID_CFG_s *pConfigurationOfDiagnosisEntries; /*!< pointer to configuration array for all diagnosis entries */
345  uint16_t numberOfFatalErrors; /*!< number of configured diagnosis entries with severity #DIAG_FATAL_ERROR */
346  DIAG_ID_CFG_s *pFatalErrorLinkTable
347  [DIAG_ID_MAX]; /*!< list with pointers to all diagnosis entries with severity #DIAG_FATAL_ERROR */
348 } DIAG_DEV_s;
349 
350 /*========== Extern Constant and Variable Declarations ======================*/
351 /** diag device configuration struct */
352 extern DIAG_DEV_s diag_device;
354 
355 /*========== Extern Function Prototypes =====================================*/
356 /**
357  * @brief update function for diagnosis flags
358  * @details TODO
359  */
360 extern void DIAG_UpdateFlags(void);
361 
362 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
363 
364 #endif /* FOXBMS__DIAG_CFG_H_ */
Configuration of the battery system (e.g., number of battery modules, battery cells,...
Database configuration header.
void DIAG_CALLBACK_FUNCTION_f(DIAG_ID_e diagId, DIAG_EVENT_e event, const DIAG_DATABASE_SHIM_s *const kpkDiagShim, uint32_t data)
function type for diag callbacks
Definition: diag_cfg.h:316
DIAG_EVENT_e
Definition: diag_cfg.h:256
@ DIAG_EVENT_RESET
Definition: diag_cfg.h:259
@ DIAG_EVENT_NOT_OK
Definition: diag_cfg.h:258
@ DIAG_EVENT_OK
Definition: diag_cfg.h:257
DIAG_IMPACT_LEVEL_e
Definition: diag_cfg.h:269
@ DIAG_SYSTEM
Definition: diag_cfg.h:270
@ DIAG_STRING
Definition: diag_cfg.h:271
DIAG_EVALUATE_e
Definition: diag_cfg.h:263
@ DIAG_EVALUATION_ENABLED
Definition: diag_cfg.h:264
@ DIAG_EVALUATION_DISABLED
Definition: diag_cfg.h:265
DIAG_SEVERITY_LEVEL_e
Definition: diag_cfg.h:297
@ DIAG_WARNING
Definition: diag_cfg.h:299
@ DIAG_INFO
Definition: diag_cfg.h:300
@ DIAG_FATAL_ERROR
Definition: diag_cfg.h:298
DIAG_ID_e
Definition: diag_cfg.h:174
@ DIAG_ID_AFE_MUX
Definition: diag_cfg.h:180
@ DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MSL
Definition: diag_cfg.h:202
@ DIAG_ID_POWER_MEASUREMENT_ERROR
Definition: diag_cfg.h:244
@ DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MSL
Definition: diag_cfg.h:196
@ DIAG_ID_PACK_OVERCURRENT_CHARGE_MSL
Definition: diag_cfg.h:223
@ DIAG_ID_OVERCURRENT_CHARGE_CELL_RSL
Definition: diag_cfg.h:212
@ DIAG_ID_AFE_CELL_VOLTAGE_MEAS_ERROR
Definition: diag_cfg.h:188
@ DIAG_ID_CAN_CC_RESPONDING
Definition: diag_cfg.h:184
@ DIAG_ID_CURRENT_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:239
@ DIAG_ID_AFE_CELL_TEMPERATURE_MEAS_ERROR
Definition: diag_cfg.h:189
@ DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MSL
Definition: diag_cfg.h:205
@ DIAG_ID_PLAUSIBILITY_CELL_TEMPERATURE_SPREAD
Definition: diag_cfg.h:192
@ DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_RSL
Definition: diag_cfg.h:203
@ DIAG_ID_STRING_OVERCURRENT_DISCHARGE_MOL
Definition: diag_cfg.h:222
@ DIAG_ID_INSULATION_MEASUREMENT_VALID
Definition: diag_cfg.h:245
@ DIAG_ID_STRING_OVERCURRENT_DISCHARGE_RSL
Definition: diag_cfg.h:221
@ DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE_SPREAD
Definition: diag_cfg.h:191
@ DIAG_ID_BASE_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:237
@ DIAG_ID_AFE_OPEN_WIRE
Definition: diag_cfg.h:227
@ DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_RSL
Definition: diag_cfg.h:209
@ DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_RSL
Definition: diag_cfg.h:197
@ DIAG_ID_PLAUSIBILITY_PACK_VOLTAGE
Definition: diag_cfg.h:228
@ DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MSL
Definition: diag_cfg.h:193
@ DIAG_ID_STRING_OVERCURRENT_CHARGE_RSL
Definition: diag_cfg.h:218
@ DIAG_ID_STRING_PLUS_CONTACTOR_FEEDBACK
Definition: diag_cfg.h:231
@ DIAG_ID_I2C_PEX_ERROR
Definition: diag_cfg.h:249
@ DIAG_ID_PLAUSIBILITY_CELL_VOLTAGE
Definition: diag_cfg.h:187
@ DIAG_ID_FLASHCHECKSUM
Definition: diag_cfg.h:175
@ DIAG_ID_PLAUSIBILITY_CELL_TEMP
Definition: diag_cfg.h:190
@ DIAG_ID_OVERCURRENT_DISCHARGE_CELL_MSL
Definition: diag_cfg.h:214
@ DIAG_ID_CONFIGASSERT
Definition: diag_cfg.h:177
@ DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_RSL
Definition: diag_cfg.h:206
@ DIAG_ID_TEMP_OVERTEMPERATURE_DISCHARGE_MOL
Definition: diag_cfg.h:204
@ DIAG_ID_STRING_OVERCURRENT_CHARGE_MSL
Definition: diag_cfg.h:217
@ DIAG_ID_STRING_MINUS_CONTACTOR_FEEDBACK
Definition: diag_cfg.h:230
@ DIAG_ID_STRING_OVERCURRENT_CHARGE_MOL
Definition: diag_cfg.h:219
@ DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MSL
Definition: diag_cfg.h:199
@ DIAG_ID_AFE_COM_INTEGRITY
Definition: diag_cfg.h:179
@ DIAG_ID_CURRENT_SENSOR_POWER_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:243
@ DIAG_ID_BASE_CELL_VOLTAGE_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:235
@ DIAG_ID_SYSTEM_MONITORING
Definition: diag_cfg.h:176
@ DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_RSL
Definition: diag_cfg.h:194
@ DIAG_ID_INSULATION_GROUND_ERROR
Definition: diag_cfg.h:248
@ DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_MOL
Definition: diag_cfg.h:201
@ DIAG_ID_TEMP_UNDERTEMPERATURE_CHARGE_MOL
Definition: diag_cfg.h:207
@ DIAG_ID_FRAM_READ_CRC_ERROR
Definition: diag_cfg.h:250
@ DIAG_ID_MAX
Definition: diag_cfg.h:252
@ DIAG_ID_SBC_RSTB_STATE
Definition: diag_cfg.h:234
@ DIAG_ID_PRECHARGE_CONTACTOR_FEEDBACK
Definition: diag_cfg.h:232
@ DIAG_ID_CAN_TIMING
Definition: diag_cfg.h:182
@ DIAG_ID_PACK_OVERCURRENT_DISCHARGE_MSL
Definition: diag_cfg.h:224
@ DIAG_ID_CURRENT_SENSOR_V1_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:241
@ DIAG_ID_DEEP_DISCHARGE_DETECTED
Definition: diag_cfg.h:226
@ DIAG_ID_CURRENT_SENSOR_V3_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:242
@ DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MOL
Definition: diag_cfg.h:210
@ DIAG_ID_SBC_FIN_STATE
Definition: diag_cfg.h:233
@ DIAG_ID_CELL_VOLTAGE_UNDERVOLTAGE_MOL
Definition: diag_cfg.h:198
@ DIAG_ID_LOW_INSULATION_RESISTANCE_ERROR
Definition: diag_cfg.h:246
@ DIAG_ID_CELL_VOLTAGE_OVERVOLTAGE_MOL
Definition: diag_cfg.h:195
@ DIAG_ID_CURRENT_ON_OPEN_STRING
Definition: diag_cfg.h:225
@ DIAG_ID_STRING_OVERCURRENT_DISCHARGE_MSL
Definition: diag_cfg.h:220
@ DIAG_ID_REDUNDANCY0_CELL_VOLTAGE_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:236
@ DIAG_ID_OVERCURRENT_CHARGE_CELL_MSL
Definition: diag_cfg.h:211
@ DIAG_ID_OVERCURRENT_DISCHARGE_CELL_MOL
Definition: diag_cfg.h:216
@ DIAG_ID_CURRENT_SENSOR_RESPONDING
Definition: diag_cfg.h:186
@ DIAG_ID_CURRENT_MEASUREMENT_ERROR
Definition: diag_cfg.h:240
@ DIAG_ID_CAN_RX_QUEUE_FULL
Definition: diag_cfg.h:183
@ DIAG_ID_AFE_SPI
Definition: diag_cfg.h:178
@ DIAG_ID_OVERCURRENT_CHARGE_CELL_MOL
Definition: diag_cfg.h:213
@ DIAG_ID_CAN_EC_RESPONDING
Definition: diag_cfg.h:185
@ DIAG_ID_ALERT_MODE
Definition: diag_cfg.h:251
@ DIAG_ID_TEMP_OVERTEMPERATURE_CHARGE_RSL
Definition: diag_cfg.h:200
@ DIAG_ID_INTERLOCK_FEEDBACK
Definition: diag_cfg.h:229
@ DIAG_ID_OVERCURRENT_DISCHARGE_CELL_RSL
Definition: diag_cfg.h:215
@ DIAG_ID_AFE_CONFIG
Definition: diag_cfg.h:181
@ DIAG_ID_TEMP_UNDERTEMPERATURE_DISCHARGE_MSL
Definition: diag_cfg.h:208
@ DIAG_ID_REDUNDANCY0_CELL_TEMPERATURE_MEASUREMENT_TIMEOUT
Definition: diag_cfg.h:238
@ DIAG_ID_LOW_INSULATION_RESISTANCE_WARNING
Definition: diag_cfg.h:247
void DIAG_UpdateFlags(void)
update function for diagnosis flags
Definition: diag_cfg.c:237
const DIAG_DATABASE_SHIM_s diag_kDatabaseShim
Definition: diag_cfg.c:111
DIAG_ID_CFG_s diag_diagnosisIdConfiguration[DIAG_ID_MAX]
Definition: diag_cfg.c:122
DIAG_DEV_s diag_device
Definition: diag_cfg.c:227
DIAG_RECORDING_e
Definition: diag_cfg.h:304
@ DIAG_RECORDING_ENABLED
Definition: diag_cfg.h:305
@ DIAG_RECORDING_DISABLED
Definition: diag_cfg.h:306
General macros and definitions for the whole platform.
DATA_BLOCK_MOL_FLAG_s * pTableMol
Definition: diag_cfg.h:165
DATA_BLOCK_RSL_FLAG_s * pTableRsl
Definition: diag_cfg.h:166
DATA_BLOCK_ERRORSTATE_s * pTableError
Definition: diag_cfg.h:164
DATA_BLOCK_MSL_FLAG_s * pTableMsl
Definition: diag_cfg.h:167
uint8_t nrOfConfiguredDiagnosisEntries
Definition: diag_cfg.h:343
DIAG_ID_CFG_s * pConfigurationOfDiagnosisEntries
Definition: diag_cfg.h:344
uint16_t numberOfFatalErrors
Definition: diag_cfg.h:345
DIAG_RECORDING_e enable_recording
Definition: diag_cfg.h:333
DIAG_SEVERITY_LEVEL_e severity
Definition: diag_cfg.h:330
uint32_t delay_ms
Definition: diag_cfg.h:332
DIAG_CALLBACK_FUNCTION_f * fpCallback
Definition: diag_cfg.h:335
uint16_t threshold
Definition: diag_cfg.h:325
DIAG_EVALUATE_e enable_evaluate
Definition: diag_cfg.h:334
DIAG_ID_e id
Definition: diag_cfg.h:324