foxBMS  1.6.0
The foxBMS Battery Management System API Documentation
ltc_6813-1_cfg.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2023, 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 2023-10-12 (date of last update)
47  * @version v1.6.0
48  * @ingroup DRIVERS_CONFIGURATION
49  * @prefix LTC
50  *
51  * @brief Configuration for the LTC analog front-end
52  *
53  */
54 
55 /*========== Includes =======================================================*/
56 #include "ltc_6813-1_cfg.h"
57 
58 #include "tsi.h"
59 
60 #include <stdint.h>
61 
62 /*========== Macros and Definitions =========================================*/
63 
64 /*========== Static Constant and Variable Definitions =======================*/
65 
66 /*========== Extern Constant and Variable Definitions =======================*/
67 /**
68  * Default multiplexer measurement sequence
69  * Must be adapted to the application
70  */
72  /* multiplexer 0 measurement */
73  {
74  .muxID = 0,
75  .muxCh = 0,
76  },
77  {
78  .muxID = 0,
79  .muxCh = 1,
80  },
81  {
82  .muxID = 0,
83  .muxCh = 2,
84  },
85  {
86  .muxID = 0,
87  .muxCh = 3,
88  },
89  {
90  .muxID = 0,
91  .muxCh = 4,
92  },
93  {
94  .muxID = 0,
95  .muxCh = 5,
96  },
97  {
98  .muxID = 0,
99  .muxCh = 6,
100  },
101  {
102  .muxID = 0,
103  .muxCh = 7,
104  },
105  /* ,
106  multiplexer 2 and 3 measurement
107  {
108  .muxID = 0,
109  .muxCh = 0xFF, disable enabled mux
110  },
111  {
112  .muxID = 1,
113  .muxCh = 0,
114  },
115  {
116  .muxID = 1,
117  .muxCh = 1,
118  },
119  {
120  .muxID = 1,
121  .muxCh = 2,
122  },
123  {
124  .muxID = 1,
125  .muxCh = 3,
126  },
127  {
128  .muxID = 1,
129  .muxCh = 4,
130  },
131  {
132  .muxID = 1,
133  .muxCh = 5,
134  },
135  {
136  .muxID = 1,
137  .muxCh = 6,
138  },
139  {
140  .muxID = 1,
141  .muxCh = 7,
142  },
143  {
144  .muxID = 1,
145  .muxCh = 0xFF, disable enabled mux
146  },
147 
148  {
149  .muxID = 2,
150  .muxCh = 0,
151  },
152  {
153  .muxID = 2,
154  .muxCh = 1,
155  },
156  {
157  .muxID = 2,
158  .muxCh = 2,
159  },
160  {
161  .muxID = 2,
162  .muxCh = 3,
163  },
164  {
165  .muxID = 2,
166  .muxCh = 4,
167  },
168  {
169  .muxID = 2,
170  .muxCh = 5,
171  },
172  {
173  .muxID = 2,
174  .muxCh = 6,
175  },
176  {
177  .muxID = 2,
178  .muxCh = 7,
179  }*/
180 };
181 
184  .nr_of_steps = (sizeof(ltc_mux_seq_main_ch1) / sizeof(LTC_MUX_CH_CFG_s))};
185 
187  1 - 1, /*!< index 0 = mux 0, ch 0 */
188  2 - 1, /*!< index 1 = mux 0, ch 1 */
189  3 - 1, /*!< index 2 = mux 0, ch 2 */
190  4 - 1, /*!< index 3 = mux 0, ch 3 */
191  5 - 1, /*!< index 4 = mux 0, ch 4 */
192  6 - 1, /*!< index 5 = mux 0, ch 5 */
193  7 - 1, /*!< index 6 = mux 0, ch 6 */
194  8 - 1, /*!< index 7 = mux 0, ch 7 */
195  /* 9-1 , !< index 8 = mux 1, ch 0 */
196  /* 10-1 , !< index 9 = mux 1, ch 1 */
197  /* 11-1 , !< index 10 = mux 1, ch 2 */
198  /* 12-1 , !< index 11 = mux 1, ch 3 */
199  /* 13-1 , !< index 12 = mux 1, ch 4 */
200  /* 14-1 , !< index 13 = mux 1, ch 5 */
201  /* 15-1 , !< index 14 = mux 1, ch 6 */
202  /* 16-1 !< index 15 = mux 1, ch 7 */
203 };
204 
206  1,
207  1,
208  1,
209  1,
210  1,
211  1,
212  1,
213  1,
214  1,
215  1,
216  1,
217  1,
218  1,
219  1,
220  1,
221  1,
222  1,
223  1,
224 };
225 
226 /*========== Static Function Prototypes =====================================*/
227 
228 /*========== Static Function Implementations ================================*/
229 
230 /*========== Extern Function Implementations ================================*/
231 
232 int16_t LTC_ConvertMuxVoltagesToTemperatures(uint16_t adcVoltage_mV) {
233  return TSI_GetTemperature(adcVoltage_mV); /* Convert degree celsius to deci degree celsius */
234 }
235 
236 /*========== Externalized Static Function Implementations (Unit Test) =======*/
237 #ifdef UNITY_UNIT_TEST
238 #endif
#define BS_NR_OF_TEMP_SENSORS_PER_MODULE
number of temperature sensors per battery module
const uint8_t ltc_muxsensortemperatur_cfg[BS_NR_OF_TEMP_SENSORS_PER_MODULE]
const uint8_t ltc_voltage_input_used[LTC_6813_MAX_SUPPORTED_CELLS]
LTC_MUX_SEQUENCE_s ltc_mux_seq
LTC_MUX_CH_CFG_s ltc_mux_seq_main_ch1[]
int16_t LTC_ConvertMuxVoltagesToTemperatures(uint16_t adcVoltage_mV)
converts a raw voltage from multiplexer to a temperature value in deci °C.
Header for the configuration for the LTC 6804-1 6811-1, 6812-1, and 6813-1 monitoring IC.
#define LTC_6813_MAX_SUPPORTED_CELLS
Defines the maximal number of supported cells per module.
uint8_t muxID
Definition: ltc_defs.h:427
LTC_MUX_CH_CFG_s * seqptr
Definition: ltc_defs.h:434
Temperature Sensor Interface on Slave Unit driver header.
int16_t TSI_GetTemperature(uint16_t adcVoltage_mV)
translate a voltage to a temperature