foxBMS  1.4.0
The foxBMS Battery Management System API Documentation
interlock_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 interlock_cfg.h
44  * @author foxBMS Team
45  * @date 2020-02-24 (date of creation)
46  * @updated 2022-07-28 (date of last update)
47  * @version v1.4.0
48  * @ingroup DRIVERS_CONFIGURATION
49  * @prefix ILCK
50  *
51  * @brief Header for the configuration for the driver for the interlock
52  *
53  */
54 
55 #ifndef FOXBMS__INTERLOCK_CFG_H_
56 #define FOXBMS__INTERLOCK_CFG_H_
57 
58 /*========== Includes =======================================================*/
59 #include "general.h"
60 
61 #include "HL_het.h"
62 
63 /*========== Macros and Definitions =========================================*/
64 
65 /** IO register to which the interlock is connected */
66 #define ILCK_IO_REG_DIR (hetREG1->DIR)
67 /** IO port for interlock related pins */
68 #define ILCK_IO_REG_PORT (hetREG1)
69 
70 /** Enable pin for diagnostic power supply */
71 #define ILCK_INTERLOCK_CONTROL_PIN_IL_HS_ENABLE (30u)
72 
73 /** Defines the pin where interlock feedback pin is connected to the mcu */
74 #define ILCK_INTERLOCK_FEEDBACK_PIN_IL_STATE (29u)
75 
76 /* Defines to which ADC input the interlock circuitry is connected to */
77 /** High-side voltage sense signal connected to ADC input 2 (IL_HS_VS) */
78 #define ILCK_ADC_INPUT_HIGH_SIDE_VOLTAGE_SENSE (2u)
79 /** Low-side voltage sense signal connected to ADC input 3 (IL_LS_VS) */
80 #define ILCK_ADC_INPUT_LOW_SIDE_VOLTAGE_SENSE (3u)
81 /** High-side current sense signal connected to ADC input 4 (IL_HS_CS) */
82 #define ILCK_ADC_INPUT_HIGH_SIDE_CURRENT_SENSE (4u)
83 /** Low-side current sense signal connected to ADC input 5 (IL_LS_CS) */
84 #define ILCK_ADC_INPUT_LOW_SIDE_CURRENT_SENSE (5u)
85 
86 /** Factor of resistor divider used for measuring the low- and high-side
87  * interlock voltages. Used resistor values are 5k6 ohm and 3k9 ohm. */
88 #define ILCK_VOLTAGE_DIVIDER_FACTOR ((5.6f + 3.9f) / 3.9f)
89 
90 /**
91  * Conversion factor for interlock current IL_HS_CS
92  * 2k49 ohm is the resistance through which sense current flows
93  * 80 is the (output current / sense current) ratio of high-side power switch
94  * TPS2H000-Q1 data sheet SLVSD72D - DECEMBER 2015 - REVISED DECEMBER 2019 p.8
95  */
96 #define ILCK_FACTOR_IL_HS_CS_1_ohm (80.0f / 2049.0f)
97 
98 /** Linear conversion factor for low-side interlock current measurement
99  * (IL_LS_CS). Measurement performed via 2 ohm shunt with a gain of 20V/V */
100 #define ILCK_FACTOR_IL_LS_CS_1_ohm (0.025f)
101 
102 /**
103  * @brief ILCK statemachine short time definition in #ILCK_Trigger() calls
104  * until next state/substate is processed
105  */
106 #define ILCK_STATEMACH_SHORTTIME (1u)
107 
108 /** Symbolic names for contactors' possible states */
109 typedef enum {
110  ILCK_SWITCH_OFF, /*!< Contactor off --> Contactor is open */
111  ILCK_SWITCH_ON, /*!< Contactor on --> Contactor is closed */
112  ILCK_SWITCH_UNDEF, /*!< Contactor undefined --> Contactor state not known */
114 
115 /*========== Extern Constant and Variable Declarations ======================*/
116 
117 /*========== Extern Function Prototypes =====================================*/
118 
119 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
120 
121 #endif /* FOXBMS__INTERLOCK_CFG_H_ */
General macros and definitions for the whole platform.
ILCK_ELECTRICAL_STATE_TYPE_e
@ ILCK_SWITCH_ON
@ ILCK_SWITCH_UNDEF
@ ILCK_SWITCH_OFF