foxBMS-UnitTests  1.0.0
The foxBMS Unit Tests API Documentation
ltc_6813-1_cfg.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der
4  * angewandten Forschung e.V. All rights reserved.
5  *
6  * BSD 3-Clause License
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * We kindly request you to use one or more of the following phrases to refer
31  * to foxBMS in your hardware, software, documentation or advertising
32  * materials:
33  *
34  * ″This product uses parts of foxBMS®″
35  *
36  * ″This product includes parts of foxBMS®″
37  *
38  * ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file ltc_6813-1_cfg.c
44  * @author foxBMS Team
45  * @date 2015-02-18 (date of creation)
46  * @updated 2015-02-18 (date of last update)
47  * @ingroup DRIVERS_CONFIGURATION
48  * @prefix LTC
49  *
50  * @brief Configuration for the LTC monitoring chip
51  *
52  */
53 
54 /*========== Includes =======================================================*/
55 #include "ltc_6813-1_cfg.h"
56 
57 #include "tsi.h"
58 
59 /*========== Macros and Definitions =========================================*/
60 
61 /*========== Static Constant and Variable Definitions =======================*/
62 
63 /*========== Extern Constant and Variable Definitions =======================*/
64 /**
65  * Default multiplexer measurement sequence
66  * Must be adapted to the application
67  */
69  /* multiplexer 0 measurement */
70  /* {*/
71  /* .muxID = 0, */
72  /* .muxCh = 0xFF, */
73  /* }, */
74  {
75  .muxID = 0,
76  .muxCh = 0,
77  },
78  {
79  .muxID = 0,
80  .muxCh = 1,
81  },
82  {
83  .muxID = 0,
84  .muxCh = 2,
85  },
86  {
87  .muxID = 0,
88  .muxCh = 3,
89  },
90  {
91  .muxID = 0,
92  .muxCh = 4,
93  },
94  {
95  .muxID = 0,
96  .muxCh = 5,
97  },
98  {
99  .muxID = 0,
100  .muxCh = 6,
101  },
102  {
103  .muxID = 0,
104  .muxCh = 7,
105  },
106  /* ,
107  multiplexer 2 and 3 measurement
108  {
109  .muxID = 0,
110  .muxCh = 0xFF, disable enabled mux
111  },
112  {
113  .muxID = 1,
114  .muxCh = 0,
115  },
116  {
117  .muxID = 1,
118  .muxCh = 1,
119  },
120  {
121  .muxID = 1,
122  .muxCh = 2,
123  },
124  {
125  .muxID = 1,
126  .muxCh = 3,
127  },
128  {
129  .muxID = 1,
130  .muxCh = 4,
131  },
132  {
133  .muxID = 1,
134  .muxCh = 5,
135  },
136  {
137  .muxID = 1,
138  .muxCh = 6,
139  },
140  {
141  .muxID = 1,
142  .muxCh = 7,
143  },
144  {
145  .muxID = 1,
146  .muxCh = 0xFF, disable enabled mux
147  },
148 
149  {
150  .muxID = 2,
151  .muxCh = 0,
152  },
153  {
154  .muxID = 2,
155  .muxCh = 1,
156  },
157  {
158  .muxID = 2,
159  .muxCh = 2,
160  },
161  {
162  .muxID = 2,
163  .muxCh = 3,
164  },
165  {
166  .muxID = 2,
167  .muxCh = 4,
168  },
169  {
170  .muxID = 2,
171  .muxCh = 5,
172  },
173  {
174  .muxID = 2,
175  .muxCh = 6,
176  },
177  {
178  .muxID = 2,
179  .muxCh = 7,
180  }*/
181 };
182 
185  .nr_of_steps = (sizeof(ltc_mux_seq_main_ch1) / sizeof(LTC_MUX_CH_CFG_s))};
186 
188  1 - 1, /*!< index 0 = mux 0, ch 0 */
189  2 - 1, /*!< index 1 = mux 0, ch 1 */
190  3 - 1, /*!< index 2 = mux 0, ch 2 */
191  4 - 1, /*!< index 3 = mux 0, ch 3 */
192  5 - 1, /*!< index 4 = mux 0, ch 4 */
193  6 - 1, /*!< index 5 = mux 0, ch 5 */
194  7 - 1, /*!< index 6 = mux 0, ch 6 */
195  8 - 1, /*!< index 7 = mux 0, ch 7 */
196  /* 9-1 , !< index 8 = mux 1, ch 0 */
197  /* 10-1 , !< index 9 = mux 1, ch 1 */
198  /* 11-1 , !< index 10 = mux 1, ch 2 */
199  /* 12-1 , !< index 11 = mux 1, ch 3 */
200  /* 13-1 , !< index 12 = mux 1, ch 4 */
201  /* 14-1 , !< index 13 = mux 1, ch 5 */
202  /* 15-1 , !< index 14 = mux 1, ch 6 */
203  /* 16-1 !< index 15 = mux 1, ch 7 */
204 };
205 
207 #if (BS_MAX_SUPPORTED_CELLS == 12) || (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || \
208  (BS_MAX_SUPPORTED_CELLS == 36)
209  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
210 #endif
211 #if (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36)
212  1, 1, 1,
213 #endif
214 #if (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36)
215  1, 1, 1,
216 #endif
217 #if (BS_MAX_SUPPORTED_CELLS == 36)
218  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
219 
220 #endif
221 };
222 
223 /*========== Static Function Prototypes =====================================*/
224 
225 /*========== Static Function Implementations ================================*/
226 
227 /*========== Extern Function Implementations ================================*/
228 
229 int16_t LTC_Convert_MuxVoltages_to_Temperatures(uint16_t adcVoltage_mV) {
230  return TSI_GetTemperature(adcVoltage_mV); /* Convert degree celsius to deci degree celsius */
231 }
232 
233 /*========== Externalized Static Function Implementations (Unit Test) =======*/
ltc_6813-1_cfg.h
Header for the configuration for the LTC 6811-1, 6812-1, 6813-1 monitoring IC.
ltc_mux_seq
LTC_MUX_SEQUENCE_s ltc_mux_seq
Definition: ltc_6813-1_cfg.c:183
ltc_voltage_input_used
const uint8_t ltc_voltage_input_used[BS_MAX_SUPPORTED_CELLS]
Definition: ltc_6813-1_cfg.c:206
BS_NR_OF_TEMP_SENSORS_PER_MODULE
#define BS_NR_OF_TEMP_SENSORS_PER_MODULE
number of temperature sensors per battery module
Definition: battery_system_cfg.h:153
ltc_mux_seq_main_ch1
LTC_MUX_CH_CFG_s ltc_mux_seq_main_ch1[]
Definition: ltc_6813-1_cfg.c:68
LTC_MUX_SEQUENCE_s
Definition: ltc_defs.h:425
tsi.h
Temperature Sensor Interface on Slave Unit driver header.
TSI_GetTemperature
int16_t TSI_GetTemperature(uint16_t adcVoltage_mV)
translate a voltage to a temperature
Definition: epcos_b57251v5103j060_lookup-table.c:70
LTC_MUX_CH_CFG_s
Definition: ltc_defs.h:419
LTC_MUX_SEQUENCE_s::seqptr
LTC_MUX_CH_CFG_s * seqptr
Definition: ltc_defs.h:427
BS_MAX_SUPPORTED_CELLS
#define BS_MAX_SUPPORTED_CELLS
Defines the maximal number of supported cells per module.
LTC_Convert_MuxVoltages_to_Temperatures
int16_t LTC_Convert_MuxVoltages_to_Temperatures(uint16_t adcVoltage_mV)
converts a raw voltage from multiplexer to a temperature value in deci °C.
Definition: ltc_6813-1_cfg.c:229
LTC_MUX_CH_CFG_s::muxID
uint8_t muxID
Definition: ltc_defs.h:420
ltc_muxsensortemperatur_cfg
const uint8_t ltc_muxsensortemperatur_cfg[BS_NR_OF_TEMP_SENSORS_PER_MODULE]
Definition: ltc_6813-1_cfg.c:187