foxBMS  1.2.1
The foxBMS Battery Management System 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 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 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 = 0,
73  },
74  {
75  .muxID = 0,
76  .muxCh = 1,
77  },
78  {
79  .muxID = 0,
80  .muxCh = 2,
81  },
82  {
83  .muxID = 0,
84  .muxCh = 3,
85  },
86  {
87  .muxID = 0,
88  .muxCh = 4,
89  },
90  {
91  .muxID = 0,
92  .muxCh = 5,
93  },
94  {
95  .muxID = 0,
96  .muxCh = 6,
97  },
98  {
99  .muxID = 0,
100  .muxCh = 7,
101  },
102  /* ,
103  multiplexer 2 and 3 measurement
104  {
105  .muxID = 0,
106  .muxCh = 0xFF, disable enabled mux
107  },
108  {
109  .muxID = 1,
110  .muxCh = 0,
111  },
112  {
113  .muxID = 1,
114  .muxCh = 1,
115  },
116  {
117  .muxID = 1,
118  .muxCh = 2,
119  },
120  {
121  .muxID = 1,
122  .muxCh = 3,
123  },
124  {
125  .muxID = 1,
126  .muxCh = 4,
127  },
128  {
129  .muxID = 1,
130  .muxCh = 5,
131  },
132  {
133  .muxID = 1,
134  .muxCh = 6,
135  },
136  {
137  .muxID = 1,
138  .muxCh = 7,
139  },
140  {
141  .muxID = 1,
142  .muxCh = 0xFF, disable enabled mux
143  },
144 
145  {
146  .muxID = 2,
147  .muxCh = 0,
148  },
149  {
150  .muxID = 2,
151  .muxCh = 1,
152  },
153  {
154  .muxID = 2,
155  .muxCh = 2,
156  },
157  {
158  .muxID = 2,
159  .muxCh = 3,
160  },
161  {
162  .muxID = 2,
163  .muxCh = 4,
164  },
165  {
166  .muxID = 2,
167  .muxCh = 5,
168  },
169  {
170  .muxID = 2,
171  .muxCh = 6,
172  },
173  {
174  .muxID = 2,
175  .muxCh = 7,
176  }*/
177 };
178 
181  .nr_of_steps = (sizeof(ltc_mux_seq_main_ch1) / sizeof(LTC_MUX_CH_CFG_s))};
182 
184  1 - 1, /*!< index 0 = mux 0, ch 0 */
185  2 - 1, /*!< index 1 = mux 0, ch 1 */
186  3 - 1, /*!< index 2 = mux 0, ch 2 */
187  4 - 1, /*!< index 3 = mux 0, ch 3 */
188  5 - 1, /*!< index 4 = mux 0, ch 4 */
189  6 - 1, /*!< index 5 = mux 0, ch 5 */
190  7 - 1, /*!< index 6 = mux 0, ch 6 */
191  8 - 1, /*!< index 7 = mux 0, ch 7 */
192  /* 9-1 , !< index 8 = mux 1, ch 0 */
193  /* 10-1 , !< index 9 = mux 1, ch 1 */
194  /* 11-1 , !< index 10 = mux 1, ch 2 */
195  /* 12-1 , !< index 11 = mux 1, ch 3 */
196  /* 13-1 , !< index 12 = mux 1, ch 4 */
197  /* 14-1 , !< index 13 = mux 1, ch 5 */
198  /* 15-1 , !< index 14 = mux 1, ch 6 */
199  /* 16-1 !< index 15 = mux 1, ch 7 */
200 };
201 
203 #if (BS_MAX_SUPPORTED_CELLS == 12) || (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || \
204  (BS_MAX_SUPPORTED_CELLS == 36)
205  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
206 #endif
207 #if (BS_MAX_SUPPORTED_CELLS == 15) || (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36)
208  1, 1, 1,
209 #endif
210 #if (BS_MAX_SUPPORTED_CELLS == 18) || (BS_MAX_SUPPORTED_CELLS == 36)
211  1, 1, 1,
212 #endif
213 #if (BS_MAX_SUPPORTED_CELLS == 36)
214  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
215 
216 #endif
217 };
218 
219 /*========== Static Function Prototypes =====================================*/
220 
221 /*========== Static Function Implementations ================================*/
222 
223 /*========== Extern Function Implementations ================================*/
224 
225 int16_t LTC_Convert_MuxVoltages_to_Temperatures(uint16_t adcVoltage_mV) {
226  return TSI_GetTemperature(adcVoltage_mV); /* Convert degree celsius to deci degree celsius */
227 }
228 
229 /*========== Externalized Static Function Implementations (Unit Test) =======*/
#define BS_MAX_SUPPORTED_CELLS
Defines the maximal number of supported cells per module.
#define BS_NR_OF_TEMP_SENSORS_PER_MODULE
number of temperature sensors per battery module
int16_t LTC_Convert_MuxVoltages_to_Temperatures(uint16_t adcVoltage_mV)
converts a raw voltage from multiplexer to a temperature value in deci °C.
const uint8_t ltc_muxsensortemperatur_cfg[BS_NR_OF_TEMP_SENSORS_PER_MODULE]
const uint8_t ltc_voltage_input_used[BS_MAX_SUPPORTED_CELLS]
LTC_MUX_SEQUENCE_s ltc_mux_seq
LTC_MUX_CH_CFG_s ltc_mux_seq_main_ch1[]
Header for the configuration for the LTC 6804-1 6811-1, 6812-1, and 6813-1 monitoring IC.
uint8_t muxID
Definition: ltc_defs.h:422
LTC_MUX_CH_CFG_s * seqptr
Definition: ltc_defs.h:429
Temperature Sensor Interface on Slave Unit driver header.
int16_t TSI_GetTemperature(uint16_t adcVoltage_mV)
translate a voltage to a temperature