| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC6811.cpp
Go to the documentation of this file.
1 /*! LTC6811: Multicell Battery Monitors
2 *
3 *@verbatim
4 *The LTC6811 is multi-cell battery stack monitor that measures up to 12 series
5 *connected battery cells with a total measurement error of less than 1.2mV.
6 *The cell measurement range of 0V to 5V makes the LTC6811 suitable for most
7 *battery chemistries. All 12 cell voltages can be captured in 290uS, and lower
8 *data acquisition rates can be selected for high noise reduction.
9 *Using the LTC6811-1, multiple devices are connected in a daisy-chain with one
10 *host processor connection for all devices.
11 *@endverbatim
12 *
13 * https://www.analog.com/en/products/ltc6811-1.html
14 * https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/dc2259a.html
15 *
16 ********************************************************************************
17 * Copyright 2019(c) Analog Devices, Inc.
18 *
19 * All rights reserved.
20 *
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions are met:
23 * - Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 * - Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in
27 * the documentation and/or other materials provided with the
28 * distribution.
29 * - Neither the name of Analog Devices, Inc. nor the names of its
30 * contributors may be used to endorse or promote products derived
31 * from this software without specific prior written permission.
32 * - The use of this software may or may not infringe the patent rights
33 * of one or more patent holders. This license does not release you
34 * from the requirement that you obtain separate licenses from these
35 * patent holders to use this software.
36 * - Use of the software either in source or binary form, must be run
37 * on or directly connected to an Analog Devices Inc. component.
38 *
39 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
40 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
41 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
43 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
45 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 *******************************************************************************/
50
51 //! @ingroup BMS
52 //! @{
53 //! @defgroup LTC6811-1 LTC6811-1: Multicell Battery Monitor
54 //! @}
55
56 /*! @file
57 @ingroup LTC6811-1
58 Library for LTC6811-1 Multicell Battery Monitor
59 */
60
61 #include "stdint.h"
62 #include "LTC681x.h"
63 #include "LTC6811.h"
64
65 /* Initialize the Register limits */
66 void LTC6811_init_reg_limits(uint8_t total_ic, //The number of ICs in the system
67 cell_asic *ic //A two dimensional array where data will be written
68 )
69 {
70 for (uint8_t cic=0; cic<total_ic; cic++)
71 {
72 ic[cic].ic_reg.cell_channels=12;
73 ic[cic].ic_reg.stat_channels=4;
74 ic[cic].ic_reg.aux_channels=6;
75 ic[cic].ic_reg.num_cv_reg=4;
76 ic[cic].ic_reg.num_gpio_reg=2;
77 ic[cic].ic_reg.num_stat_reg=3;
78 }
79 }
80
81 /*
82 This command will write the configuration registers of the LTC6811-1s
83 connected. The configuration is written in descending
84 order so the last device's configuration is written first.
85 */
86 void LTC6811_wrcfg(uint8_t total_ic, //The number of ICs being written to
87 cell_asic *ic //A two dimensional array of the configuration data that will be written
88 )
89 {
90 LTC681x_wrcfg(total_ic,ic);
91 }
92
93 /* Reads configuration registers of a LTC6811 */
94 int8_t LTC6811_rdcfg(uint8_t total_ic, //Number of ICs in the system
95 cell_asic *ic //A two dimensional array that the function stores the read configuration data.
96 )
97 {
98 int8_t pec_error = 0;
99 pec_error = LTC681x_rdcfg(total_ic,ic);
100 return(pec_error);
101 }
102
103 /* Starts cell voltage conversion */
104 void LTC6811_adcv(uint8_t MD, //ADC Mode
105 uint8_t DCP, //Discharge Permit
106 uint8_t CH //Cell Channels to be measured
107 )
108 {
109 LTC681x_adcv(MD,DCP,CH);
110 }
111
112 /* Start a GPIO and Vref2 Conversion */
113 void LTC6811_adax(uint8_t MD, //ADC Mode
114 uint8_t CHG //GPIO Channels to be measured
115 )
116 {
117 LTC681x_adax(MD,CHG);
118 }
119
120 /* Start a Status ADC Conversion */
121 void LTC6811_adstat(uint8_t MD, //ADC Mode
122 uint8_t CHST //Stat Channels to be measured
123 )
124 {
125 LTC681x_adstat(MD,CHST);
126 }
127
128 /* Starts cell voltage and GPIO 1 & 2 conversion */
129 void LTC6811_adcvax(uint8_t MD, //ADC Mode
130 uint8_t DCP //Discharge Permit
131 )
132 {
133 LTC681x_adcvax(MD,DCP);
134 }
135
136 /* Starts cell voltage and Sum of cells conversion */
137 void LTC6811_adcvsc(uint8_t MD, //ADC Mode
138 uint8_t DCP //Discharge Permit
139 )
140 {
141 LTC681x_adcvsc(MD,DCP);
142 }
143
144 /*
145 The function is used to read the parsed cell voltage codes of the LTC6811.
146 This function will send the requested read commands parse the data and
147 store the cell voltages in c_codes variable
148 */
149 uint8_t LTC6811_rdcv(uint8_t reg, // Controls which cell voltage register is read back.
150 uint8_t total_ic, // The number of ICs in the system
151 cell_asic *ic // Array of the parsed cell codes
152 )
153 {
154 int8_t pec_error = 0;
155 pec_error = LTC681x_rdcv(reg,total_ic,ic);
156 return(pec_error);
157 }
158
159 /*
160 The function is used to read the parsed GPIO codes of the LTC6811.
161 This function will send the requested read commands parse the data
162 and store the gpio voltages in a_codes variable
163 */
164 int8_t LTC6811_rdaux(uint8_t reg, //Determines which GPIO voltage register is read back.
165 uint8_t total_ic,//The number of ICs in the system
166 cell_asic *ic//A two dimensional array of the gpio voltage codes.
167 )
168 {
169 int8_t pec_error = 0;
170 LTC681x_rdaux(reg,total_ic,ic);
171 return (pec_error);
172 }
173
174 /*
175 Reads and parses the LTC6811 stat registers.
176 The function is used to read the parsed stat codes of the LTC6811.
177 This function will send the requested read commands parse the data
178 and store the stat voltages in stat_codes variable
179 */
180 int8_t LTC6811_rdstat(uint8_t reg, //Determines which Stat register is read back.
181 uint8_t total_ic,//The number of ICs in the system
182 cell_asic *ic //Array of the parsed stat codes
183 )
184 {
185 int8_t pec_error = 0;
186 pec_error = LTC681x_rdstat(reg,total_ic,ic);
187 return (pec_error);
188 }
189
190 /* Sends the poll ADC command */
191 uint8_t LTC6811_pladc()
192 {
193 return(LTC681x_pladc());
194 }
195
196 //This function will block operation until the ADC has finished it's conversion */
197 uint32_t LTC6811_pollAdc()
198 {
199 return(LTC681x_pollAdc());
200 }
201
202 /*
203 The command clears the cell voltage registers and initializes all values to 1.
204 The register will read back hexadecimal 0xFF after the command is sent.
205 */
206 void LTC6811_clrcell()
207 {
208 LTC681x_clrcell();
209 }
210
211 /*
212 The command clears the Auxiliary registers and initializes all values to 1.
213 The register will read back hexadecimal 0xFF after the command is sent.
214 */
215 void LTC6811_clraux()
216 {
217 LTC681x_clraux();
218 }
219
220 /*
221 The command clears the Stat registers and initializes all values to 1.
222 The register will read back hexadecimal 0xFF after the command is sent.
223 */
224 void LTC6811_clrstat()
225 {
226 LTC681x_clrstat();
227 }
228
229 /* Starts the Mux Decoder diagnostic self test */
230 void LTC6811_diagn()
231 {
232 LTC681x_diagn();
233 }
234
235 /* Starts cell voltage self test conversion */
236 void LTC6811_cvst(uint8_t MD, //ADC Mode
237 uint8_t ST //Self Test
238 )
239 {
240 LTC681x_cvst(MD,ST);
241 }
242
243 /* Start an Auxiliary Register Self Test Conversion */
244 void LTC6811_axst(uint8_t MD, //ADC Mode
245 uint8_t ST //Self Test
246 )
247 {
248 LTC681x_axst(MD,ST);
249 }
250
251 /* Start a Status Register Self Test Conversion */
252 void LTC6811_statst(uint8_t MD, //ADC Mode
253 uint8_t ST //Self Test
254 )
255 {
256 LTC681x_statst(MD,ST);
257 }
258
259 /* Starts cell voltage overlap conversion */
260 void LTC6811_adol(uint8_t MD, //ADC Mode
261 uint8_t DCP //Discharge Permit
262 )
263 {
264 LTC681x_adol(MD,DCP);
265 }
266
267 /* Start an GPIO Redundancy test */
268 void LTC6811_adaxd(uint8_t MD, //ADC Mode
269 uint8_t CHG //GPIO Channels to be measured
270 )
271 {
272 LTC681x_adaxd(MD,CHG);
273 }
274
275 /* Start a Status register redundancy test Conversion */
276 void LTC6811_adstatd(uint8_t MD, //ADC Mode
277 uint8_t CHST //Stat Channels to be measured
278 )
279 {
280 LTC681x_adstatd(MD,CHST);
281 }
282
283 /* Runs the Digital Filter Self Test */
284 int16_t LTC6811_run_cell_adc_st(uint8_t adc_reg, // Type of register
285 uint8_t total_ic,//Number of ICs in the system
286 cell_asic *ic, //A two dimensional array that will store the data
287 uint8_t md, //ADC Mode
288 bool adcopt //The adcopt bit in the configuration register
289 )
290 {
291 int16_t error = 0;
292 error = LTC681x_run_cell_adc_st(adc_reg,total_ic,ic,md,adcopt);
293 return(error);
294 }
295
296 /* Runs the ADC overlap test for the IC */
297 uint16_t LTC6811_run_adc_overlap(uint8_t total_ic,//Number of ICs in the system
298 cell_asic *ic //A two dimensional array that will store the data
299 )
300 {
301 uint16_t error = 0;
302 LTC681x_run_adc_overlap(total_ic, ic);
303 return(error);
304 }
305
306 /* Runs the redundancy self test */
307 int16_t LTC6811_run_adc_redundancy_st(uint8_t adc_mode, //ADC Mode
308 uint8_t adc_reg, // Type of register
309 uint8_t total_ic,//Number of ICs in the system
310 cell_asic *ic //A two dimensional array that will store the data
311 )
312 {
313 int16_t error = 0;
314 LTC681x_run_adc_redundancy_st(adc_mode,adc_reg,total_ic,ic);
315 return(error);
316 }
317
318 /* Start an open wire Conversion */
319 void LTC6811_adow(uint8_t MD, //ADC Mode
320 uint8_t PUP,//Pull up/ Pull down
321 uint8_t CH, //Cell selection
322 uint8_t DCP //Discharge Permit
323 )
324 {
325 LTC681x_adow(MD,PUP,CH,DCP);
326 }
327
328 /* Runs the data sheet algorithm for open wire for single cell detection */
329 void LTC6811_run_openwire_single(uint8_t total_ic,//Number of ICs in the system
330 cell_asic *ic //A two dimensional array that will store the data
331 )
332 {
333 LTC681x_run_openwire_single(total_ic,ic);
334 }
335
336 /* Runs the data sheet algorithm for open wire for multiple cell and two consecutive cells detection */
337 void LTC6811_run_openwire_multi(uint8_t total_ic,//Number of ICs in the system
338 cell_asic *ic //A two dimensional array that will store the data
339 )
340 {
341 LTC681x_run_openwire_multi(total_ic,ic);
342 }
343
344 /* Helper function to set discharge bit in CFG register */
345 void LTC6811_set_discharge(int Cell, //The cell to be discharged
346 uint8_t total_ic, //Number of ICs in the system
347 cell_asic *ic //A two dimensional array that will store the data
348 )
349 {
350 for (int i=0; i<total_ic; i++)
351 {
352 if ((Cell<9)&& (Cell!=0) )
353 {
354 ic[i].config.tx_data[4] = ic[i].config.tx_data[4] | (1<<(Cell-1));
355 }
356 else if (Cell < 13)
357 {
358 ic[i].config.tx_data[5] = ic[i].config.tx_data[5] | (1<<(Cell-9));
359 }
360 else
361 {
362 break;
363 }
364 }
365 }
366
367 /* Clears all of the DCC bits in the configuration registers */
368 void LTC6811_clear_discharge(uint8_t total_ic, cell_asic *ic)
369 {
370 LTC681x_clear_discharge(total_ic,ic);
371 }
372
373 /* Writes the pwm registers of a LTC6811 */
374 void LTC6811_wrpwm(uint8_t total_ic, //Number of ICs in the system
375 uint8_t pwmReg, //The number of registers being written to
376 cell_asic *ic //A two dimensional array that the function stores the data in.
377 )
378 {
379 LTC681x_wrpwm(total_ic,pwmReg,ic);
380 }
381
382
383 /* Reads pwm registers of a LTC6811 */
384 int8_t LTC6811_rdpwm(uint8_t total_ic, //Number of ICs in the system
385 uint8_t pwmReg, //The number of registers being written to
386 cell_asic *ic //A two dimensional array that the function stores the read pwm data.
387 )
388 {
389 int8_t pec_error =0;
390 pec_error = LTC681x_rdpwm(total_ic,pwmReg,ic);
391 return(pec_error);
392 }
393
394 /* Writes data in S control register the LTC6811-1s connected */
395 void LTC6811_wrsctrl(uint8_t total_ic, //Number of ICs in the system
396 uint8_t sctrl_reg, //The number of registers being written to
397 cell_asic *ic //A two dimensional array of the data that will be written
398 )
399 {
400 LTC681x_wrsctrl(total_ic, sctrl_reg, ic);
401 }
402
403 /* Reads sctrl registers of a LTC6811 */
404 int8_t LTC6811_rdsctrl(uint8_t total_ic, //Number of ICs in the system
405 uint8_t sctrl_reg,//The number of registers being written to
406 cell_asic *ic //A two dimensional array that the function stores the read data
407 )
408 {
409 int8_t pec_error =0;
410 pec_error = LTC681x_rdsctrl(total_ic, sctrl_reg,ic );
411 return(pec_error);
412 }
413
414 /*
415 Start Sctrl data communication
416 This command will start the sctrl pulse communication over the spins
417 */
418 void LTC6811_stsctrl()
419 {
420 LTC681x_stsctrl();
421 }
422
423 /*
424 The command clears the Sctrl registers and initializes
425 all values to 0. The register will read back hexadecimal 0x00
426 after the command is sent.
427 */
428 void LTC6811_clrsctrl()
429 {
430 LTC681x_clrsctrl();
431 }
432
433 /* Writes the COMM registers of a LTC6811 */
434 void LTC6811_wrcomm(uint8_t total_ic, //The number of ICs being written to
435 cell_asic *ic //A two dimensional array of the comm data that will be written
436 )
437 {
438 LTC681x_wrcomm(total_ic,ic);
439 }
440
441 /* Reads COMM registers of a LTC6811 */
442 int8_t LTC6811_rdcomm(uint8_t total_ic, //Number of ICs in the system
443 cell_asic *ic //A two dimensional array that the function stores the read comm data.
444 )
445 {
446 int8_t pec_error = 0;
447 LTC681x_rdcomm(total_ic, ic);
448 return(pec_error);
449 }
450
451 /* Shifts data in COMM register out over LTC6811 SPI/I2C port */
452 void LTC6811_stcomm(uint8_t len)
453 {
454 LTC681x_stcomm(len); // length of data to be transmitted
455 }
456
457 /* Helper function that increments PEC counters */
458 void LTC6811_check_pec(uint8_t total_ic,//Number of ICs in the system
459 uint8_t reg, // Type of register
460 cell_asic *ic//A two dimensional array that will store the data
461 )
462 {
463 LTC681x_check_pec(total_ic,reg,ic);
464 }
465
466 /* Helper Function to reset PEC counters */
467 void LTC6811_reset_crc_count(uint8_t total_ic, //Number of ICs in the system
468 cell_asic *ic //A two dimensional array that will store the data
469 )
470 {
471 LTC681x_reset_crc_count(total_ic,ic);
472 }
473
474 /* Helper function to initialize CFG variables.*/
475 void LTC6811_init_cfg(uint8_t total_ic, //Number of ICs in the system
476 cell_asic *ic //A two dimensional array that will store the data
477 )
478 {
479 LTC681x_init_cfg(total_ic,ic);
480 }
481
482 /* Helper function to set CFGR variable */
483 void LTC6811_set_cfgr(uint8_t nIC, //current IC
484 cell_asic *ic,//a two dimensional array that will store the data
485 bool refon, // The REFON bit
486 bool adcopt, // The ADCOPT bit
487 bool gpio[5],// The GPIO bit
488 bool dcc[12],// The DCC bit
489 bool dcto[4],// The Dcto bit
490 uint16_t uv, // The UV bit
491 uint16_t ov // The OV bit
492 )
493 {
494 LTC681x_set_cfgr(nIC ,ic,refon,adcopt,gpio,dcc,dcto, uv, ov);
495 }
496
497 /* Helper function to set the REFON bit */
498 void LTC6811_set_cfgr_refon(uint8_t nIC, cell_asic *ic, bool refon)
499 {
500 LTC681x_set_cfgr_refon(nIC,ic,refon);
501 }
502
503 /* Helper function to set the adcopt bit */
504 void LTC6811_set_cfgr_adcopt(uint8_t nIC, cell_asic *ic, bool adcopt)
505 {
506 LTC681x_set_cfgr_adcopt(nIC,ic,adcopt);
507 }
508
509 /* Helper function to set GPIO bits */
510 void LTC6811_set_cfgr_gpio(uint8_t nIC, cell_asic *ic,bool gpio[5])
511 {
512 LTC681x_set_cfgr_gpio(nIC,ic,gpio);
513 }
514
515 /* Helper function to control discharge */
516 void LTC6811_set_cfgr_dis(uint8_t nIC, cell_asic *ic,bool dcc[12])
517 {
518 LTC681x_set_cfgr_dis(nIC,ic,dcc);
519 }
520
521 /* Helper function to control discharge */
522 void LTC6811_set_cfgr_dcto(uint8_t nIC, cell_asic *ic,bool dcto[4])
523 {
524 LTC681x_set_cfgr_dcto(nIC, ic,dcto);
525 }
526
527 /* Helper Function to set uv value in CFG register */
528 void LTC6811_set_cfgr_uv(uint8_t nIC, cell_asic *ic,uint16_t uv)
529 {
530 LTC681x_set_cfgr_uv(nIC, ic, uv);
531 }
532
533 /* Helper function to set OV value in CFG register */
534 void LTC6811_set_cfgr_ov(uint8_t nIC, cell_asic *ic,uint16_t ov)
535 {
536 LTC681x_set_cfgr_ov( nIC, ic, ov);
537 }
LTC6811_reset_crc_count
void LTC6811_reset_crc_count(uint8_t total_ic, cell_asic *ic)
Helper Function that resets the PEC error counters.
Definition: LTC6811.cpp:467
LTC6811_clrsctrl
void LTC6811_clrsctrl()
Clears the LTC6811 Sctrl registers.
Definition: LTC6811.cpp:428
LTC681x_adaxd
void LTC681x_adaxd(uint8_t MD, uint8_t CHG)
Start an GPIO Redundancy test.
Definition: LTC681x.cpp:1038
LTC6811_rdsctrl
int8_t LTC6811_rdsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Reads sctrl registers of a LTC6811 daisy chain.
Definition: LTC6811.cpp:404
LTC681x_adcvax
void LTC681x_adcvax(uint8_t MD, uint8_t DCP)
Starts cell voltage and GPIO 1&2 conversion.
Definition: LTC681x.cpp:415
LTC681x.h
General BMS Library.
LTC6811_set_cfgr_dcto
void LTC6811_set_cfgr_dcto(uint8_t nIC, cell_asic *ic, bool dcto[4])
Definition: LTC6811.cpp:522
LTC681x_stcomm
void LTC681x_stcomm(uint8_t len)
Issues a stcomm command and clocks data out of the COMM register.
Definition: LTC681x.cpp:1978
LTC681x_adow
void LTC681x_adow(uint8_t MD, uint8_t PUP, uint8_t CH, uint8_t DCP)
Start an open wire Conversion.
Definition: LTC681x.cpp:1292
LTC681x_set_cfgr_gpio
void LTC681x_set_cfgr_gpio(uint8_t nIC, cell_asic *ic, bool gpio[5])
Definition: LTC681x.cpp:2133
LTC681x_diagn
void LTC681x_diagn()
Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnosti...
Definition: LTC681x.cpp:967
LTC6811_clraux
void LTC6811_clraux()
Clears the LTC6811 Auxiliary registers.
Definition: LTC6811.cpp:215
LTC681x_rdstat
int8_t LTC681x_rdstat(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC681x stat registers.
Definition: LTC681x.cpp:560
ic_register::tx_data
uint8_t tx_data[6]
Stores data to be transmitted.
Definition: LTC681x.h:143
LTC6811_rdstat
int8_t LTC6811_rdstat(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6811 stat registers.
Definition: LTC6811.cpp:180
LTC681x_wrpwm
void LTC681x_wrpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic ic[])
Definition: LTC681x.cpp:1696
LTC6811_clrcell
void LTC6811_clrcell()
Clears the LTC6811 cell voltage registers.
Definition: LTC6811.cpp:206
LTC681x_set_cfgr
void LTC681x_set_cfgr(uint8_t nIC, cell_asic *ic, bool refon, bool adcopt, bool gpio[5], bool dcc[12], bool dcto[4], uint16_t uv, uint16_t ov)
Helper function to set appropriate bits in CFGR register based on bit function.
Definition: LTC681x.cpp:2098
LTC6811_set_cfgr_uv
void LTC6811_set_cfgr_uv(uint8_t nIC, cell_asic *ic, uint16_t uv)
Helper function to set uv field in CFGRA register.
Definition: LTC6811.cpp:528
LTC681x_set_cfgr_uv
void LTC681x_set_cfgr_uv(uint8_t nIC, cell_asic *ic, uint16_t uv)
Helper function to set uv field in CFGRA register.
Definition: LTC681x.cpp:2168
LTC681x_run_adc_overlap
uint16_t LTC681x_run_adc_overlap(uint8_t total_ic, cell_asic *ic)
Helper Function that runs the ADC Overlap test.
Definition: LTC681x.cpp:1158
LTC681x_clrcell
void LTC681x_clrcell()
Clears the LTC681x Cell voltage registers The command clears the cell voltage registers and initializ...
Definition: LTC681x.cpp:937
LTC6811_set_cfgr_dis
void LTC6811_set_cfgr_dis(uint8_t nIC, cell_asic *ic, bool dcc[12])
Definition: LTC6811.cpp:516
LTC6811_axst
void LTC6811_axst(uint8_t MD, uint8_t ST)
Start an Auxiliary Register Self Test Conversion.
Definition: LTC6811.cpp:244
LTC681x_statst
void LTC681x_statst(uint8_t MD, uint8_t ST)
Start a Status Register Self Test Conversion.
Definition: LTC681x.cpp:1006
LTC6811_clrstat
void LTC6811_clrstat()
Clears the LTC6811 Stat registers.
Definition: LTC6811.cpp:224
LTC6811_statst
void LTC6811_statst(uint8_t MD, uint8_t ST)
Start a Status Register Self Test Conversion.
Definition: LTC6811.cpp:252
LTC681x_adstat
void LTC681x_adstat(uint8_t MD, uint8_t CHST)
Start a Status ADC Conversion.
Definition: LTC681x.cpp:383
cell_asic
Cell variable structure.
Definition: LTC681x.h:170
LTC6811_rdcomm
int8_t LTC6811_rdcomm(uint8_t total_ic, cell_asic *ic)
Reads comm registers of a LTC6811 daisy chain.
Definition: LTC6811.cpp:442
LTC6811_cvst
void LTC6811_cvst(uint8_t MD, uint8_t ST)
Starts cell voltage self test conversion.
Definition: LTC6811.cpp:236
LTC681x_clrsctrl
void LTC681x_clrsctrl()
Clears the LTC681x SCTRL registers The command clears the SCTRL registers and initializes all values ...
Definition: LTC681x.cpp:1900
cell_asic::ic_reg
register_cfg ic_reg
Definition: LTC681x.h:185
LTC6811_pollAdc
uint32_t LTC6811_pollAdc()
This function will block operation until the ADC has finished it&#39;s conversion.
Definition: LTC6811.cpp:197
LTC681x_wrcfg
void LTC681x_wrcfg(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:204
LTC681x_set_cfgr_ov
void LTC681x_set_cfgr_ov(uint8_t nIC, cell_asic *ic, uint16_t ov)
Helper function to set ov field in CFGRA register.
Definition: LTC681x.cpp:2177
register_cfg::num_cv_reg
uint8_t num_cv_reg
Number of Cell voltage register.
Definition: LTC681x.h:164
register_cfg::num_gpio_reg
uint8_t num_gpio_reg
Number of Aux register.
Definition: LTC681x.h:165
LTC681x_wrsctrl
void LTC681x_wrsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Write the LTC681x Sctrl register.
Definition: LTC681x.cpp:1791
LTC681x_adax
void LTC681x_adax(uint8_t MD, uint8_t CHG)
Start a GPIO and Vref2 Conversion.
Definition: LTC681x.cpp:367
LTC6811_pladc
uint8_t LTC6811_pladc()
Sends the poll ADC command.
Definition: LTC6811.cpp:191
LTC681x_set_cfgr_refon
void LTC681x_set_cfgr_refon(uint8_t nIC, cell_asic *ic, bool refon)
Helper function to turn the REFON bit HIGH or LOW.
Definition: LTC681x.cpp:2119
LTC6811_rdaux
int8_t LTC6811_rdaux(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6811 auxiliary registers.
Definition: LTC6811.cpp:164
LTC6811_adax
void LTC6811_adax(uint8_t MD, uint8_t CHG)
Start a GPIO and Vref2 Conversion.
Definition: LTC6811.cpp:113
LTC681x_rdcv
uint8_t LTC681x_rdcv(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC681x cell voltage registers.
Definition: LTC681x.cpp:436
LTC6811_wrcfg
void LTC6811_wrcfg(uint8_t total_ic, cell_asic *ic)
Write the LTC6811 configuration register.
Definition: LTC6811.cpp:86
LTC6811_rdcv
uint8_t LTC6811_rdcv(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6811 cell voltage registers.
Definition: LTC6811.cpp:149
LTC6811_set_cfgr
void LTC6811_set_cfgr(uint8_t nIC, cell_asic *ic, bool refon, bool adcopt, bool gpio[5], bool dcc[12], bool dcto[4], uint16_t uv, uint16_t ov)
Helper function to set appropriate bits in CFGR register based on bit function.
Definition: LTC6811.cpp:483
LTC6811_run_openwire_multi
void LTC6811_run_openwire_multi(uint8_t total_ic, cell_asic *ic)
Helper function that runs open wire for multiple cell and two consecutive cells detection.
Definition: LTC6811.cpp:337
LTC6811_adcvsc
void LTC6811_adcvsc(uint8_t MD, uint8_t DCP)
Starts cell voltage and SOC conversion.
Definition: LTC6811.cpp:137
LTC681x_cvst
void LTC681x_cvst(uint8_t MD, uint8_t ST)
Starts cell voltage self test conversion.
Definition: LTC681x.cpp:974
LTC681x_adcvsc
void LTC681x_adcvsc(uint8_t MD, uint8_t DCP)
Starts cell voltage and SOC conversion.
Definition: LTC681x.cpp:399
LTC681x_wrcomm
void LTC681x_wrcomm(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1907
LTC681x_stsctrl
void LTC681x_stsctrl()
Start Sctrl data communication This command will start the sctrl pulse communication over the spins...
Definition: LTC681x.cpp:1879
LTC6811_adow
void LTC6811_adow(uint8_t MD, uint8_t PUP, uint8_t CH, uint8_t DCP)
Start an open wire Conversion.
Definition: LTC6811.cpp:319
LTC681x_rdsctrl
int8_t LTC681x_rdsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Reads sctrl registers of a LTC681x daisy chain.
Definition: LTC681x.cpp:1827
LTC681x_reset_crc_count
void LTC681x_reset_crc_count(uint8_t total_ic, cell_asic *ic)
Helper Function that resets the PEC error counters.
Definition: LTC681x.cpp:2059
LTC6811_run_cell_adc_st
int16_t LTC6811_run_cell_adc_st(uint8_t adc_reg, uint8_t total_ic, cell_asic *ic, uint8_t md, bool adcopt)
Helper function that runs the ADC Self Tests.
Definition: LTC6811.cpp:284
LTC6811_diagn
void LTC6811_diagn()
Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnosti...
Definition: LTC6811.cpp:230
LTC681x_clear_discharge
void LTC681x_clear_discharge(uint8_t total_ic, cell_asic *ic)
Helper Function to clear DCC bits in the CFGR Registers.
Definition: LTC681x.cpp:1682
LTC6811_adstatd
void LTC6811_adstatd(uint8_t MD, uint8_t CHST)
Start a Status register redundancy test Conversion.
Definition: LTC6811.cpp:276
LTC6811_adaxd
void LTC6811_adaxd(uint8_t MD, uint8_t CHG)
Start an GPIO Redundancy test.
Definition: LTC6811.cpp:268
LTC6811_run_openwire_single
void LTC6811_run_openwire_single(uint8_t total_ic, cell_asic *ic)
Helper function that runs the data sheet open wire algorithm for single cell detection.
Definition: LTC6811.cpp:329
LTC681x_rdaux
int8_t LTC681x_rdaux(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC681x auxiliary registers.
Definition: LTC681x.cpp:498
register_cfg::stat_channels
uint8_t stat_channels
Number of Stat channels.
Definition: LTC681x.h:162
LTC681x_adstatd
void LTC681x_adstatd(uint8_t MD, uint8_t CHST)
Start a Status register redundancy test Conversion.
Definition: LTC681x.cpp:1054
LTC681x_clrstat
void LTC681x_clrstat()
Clears the LTC681x Stat registers The command clears the Stat registers and initializes all values to...
Definition: LTC681x.cpp:960
LTC681x_pollAdc
uint32_t LTC681x_pollAdc()
This function will block operation until the ADC has finished it&#39;s conversion.
Definition: LTC681x.cpp:899
LTC6811_adcv
void LTC6811_adcv(uint8_t MD, uint8_t DCP, uint8_t CH)
Starts cell voltage conversion.
Definition: LTC6811.cpp:104
LTC6811_adol
void LTC6811_adol(uint8_t MD, uint8_t DCP)
Starts cell voltage overlap conversion.
Definition: LTC6811.cpp:260
LTC681x_axst
void LTC681x_axst(uint8_t MD, uint8_t ST)
Start an Auxiliary Register Self Test Conversion.
Definition: LTC681x.cpp:990
LTC681x_check_pec
void LTC681x_check_pec(uint8_t total_ic, uint8_t reg, cell_asic *ic)
Helper Function that counts overall PEC errors and register/IC PEC errors.
Definition: LTC681x.cpp:1999
LTC6811_rdcfg
int8_t LTC6811_rdcfg(uint8_t total_ic, cell_asic *ic)
Reads configuration registers of a LTC6811.
Definition: LTC6811.cpp:94
LTC681x_pladc
uint8_t LTC681x_pladc()
Sends the poll ADC command.
Definition: LTC681x.cpp:878
register_cfg::cell_channels
uint8_t cell_channels
Number of Cell channels.
Definition: LTC681x.h:161
register_cfg::num_stat_reg
uint8_t num_stat_reg
Number of Status register.
Definition: LTC681x.h:166
error
static int error
Definition: LT1054_voltage_mode_buck.ino:64
LTC6811_init_reg_limits
void LTC6811_init_reg_limits(uint8_t total_ic, cell_asic *ic)
Initialize the Register limits.
Definition: LTC6811.cpp:66
LTC6811_wrpwm
void LTC6811_wrpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
Write the LTC6811 PWM register.
Definition: LTC6811.cpp:374
LTC6811_stcomm
void LTC6811_stcomm(uint8_t len)
Issues a stcomm command and clocks data out of the COMM register.
Definition: LTC6811.cpp:452
LTC6811_adstat
void LTC6811_adstat(uint8_t MD, uint8_t CHST)
Start a Status ADC Conversion.
Definition: LTC6811.cpp:121
LTC681x_set_cfgr_dcto
void LTC681x_set_cfgr_dcto(uint8_t nIC, cell_asic *ic, bool dcto[4])
Definition: LTC681x.cpp:2158
LTC681x_rdpwm
int8_t LTC681x_rdpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic ic[])
Definition: LTC681x.cpp:1738
LTC6811_stsctrl
void LTC6811_stsctrl()
Start Sctrl data communication This command will start the sctrl pulse communication over the spins...
Definition: LTC6811.cpp:418
LTC6811_init_cfg
void LTC6811_init_cfg(uint8_t total_ic, cell_asic *ic)
Helper Function to initialize the CFGR data structures.
Definition: LTC6811.cpp:475
LTC6811_wrsctrl
void LTC6811_wrsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Write the LTC6811 Sctrl register.
Definition: LTC6811.cpp:395
cell_asic::config
ic_register config
Definition: LTC681x.h:172
LTC6811_set_cfgr_ov
void LTC6811_set_cfgr_ov(uint8_t nIC, cell_asic *ic, uint16_t ov)
Helper function to set ov field in CFGRA register.
Definition: LTC6811.cpp:534
LTC681x_rdcomm
int8_t LTC681x_rdcomm(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1936
LTC6811_run_adc_redundancy_st
int16_t LTC6811_run_adc_redundancy_st(uint8_t adc_mode, uint8_t adc_reg, uint8_t total_ic, cell_asic *ic)
Helper function that runs the ADC Digital Redundancy commands and checks output for errors...
Definition: LTC6811.cpp:307
LTC6811_check_pec
void LTC6811_check_pec(uint8_t total_ic, uint8_t reg, cell_asic *ic)
Helper Function that counts overall PEC errors and register/IC PEC errors.
Definition: LTC6811.cpp:458
LTC6811_run_adc_overlap
uint16_t LTC6811_run_adc_overlap(uint8_t total_ic, cell_asic *ic)
Helper Function that runs the ADC Overlap test.
Definition: LTC6811.cpp:297
LTC6811_wrcomm
void LTC6811_wrcomm(uint8_t total_ic, cell_asic *ic)
Writes to the LTC6811 COMM register.
Definition: LTC6811.cpp:434
LTC6811_set_cfgr_adcopt
void LTC6811_set_cfgr_adcopt(uint8_t nIC, cell_asic *ic, bool adcopt)
Helper function to turn the ADCOPT bit HIGH or LOW.
Definition: LTC6811.cpp:504
LTC6811_rdpwm
int8_t LTC6811_rdpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
Reads pwm registers of a LTC6811 daisy chain.
Definition: LTC6811.cpp:384
LTC6811_set_cfgr_gpio
void LTC6811_set_cfgr_gpio(uint8_t nIC, cell_asic *ic, bool gpio[5])
Definition: LTC6811.cpp:510
LTC681x_init_cfg
void LTC681x_init_cfg(uint8_t total_ic, cell_asic *ic)
Helper Function to initialize the CFGR data structures.
Definition: LTC681x.cpp:2084
LTC681x_rdcfg
int8_t LTC681x_rdcfg(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:264
LTC6811.h
LTC6811: Multicell Battery Monitors.
LTC681x_clraux
void LTC681x_clraux()
Clears the LTC681x Auxiliary registers The command clears the Auxiliary registers and initializes all...
Definition: LTC681x.cpp:948
LTC681x_adcv
void LTC681x_adcv(uint8_t MD, uint8_t DCP, uint8_t CH)
Starts cell voltage conversion Starts ADC conversions of the LTC681x Cpin inputs. ...
Definition: LTC681x.cpp:350
LTC6811_adcvax
void LTC6811_adcvax(uint8_t MD, uint8_t DCP)
Starts cell voltage and GPIO 1&2 conversion.
Definition: LTC6811.cpp:129
LTC681x_run_adc_redundancy_st
int16_t LTC681x_run_adc_redundancy_st(uint8_t adc_mode, uint8_t adc_reg, uint8_t total_ic, cell_asic *ic)
Helper function that runs the ADC Digital Redundancy commands and checks output for errors...
Definition: LTC681x.cpp:1188
LTC681x_set_cfgr_adcopt
void LTC681x_set_cfgr_adcopt(uint8_t nIC, cell_asic *ic, bool adcopt)
Helper function to turn the ADCOPT bit HIGH or LOW.
Definition: LTC681x.cpp:2126
LTC6811_set_discharge
void LTC6811_set_discharge(int Cell, uint8_t total_ic, cell_asic *ic)
Helper function to set discharge bit in CFG register.
Definition: LTC6811.cpp:345
i
static int i
Definition: DC2430A.ino:184
LTC681x_run_openwire_multi
void LTC681x_run_openwire_multi(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1416
LTC681x_run_openwire_single
void LTC681x_run_openwire_single(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1326
LTC681x_set_cfgr_dis
void LTC681x_set_cfgr_dis(uint8_t nIC, cell_asic *ic, bool dcc[12])
Definition: LTC681x.cpp:2143
register_cfg::aux_channels
uint8_t aux_channels
Number of Aux channels.
Definition: LTC681x.h:163
LTC681x_adol
void LTC681x_adol(uint8_t MD, uint8_t DCP)
Starts cell voltage overlap conversion.
Definition: LTC681x.cpp:1022
LTC681x_run_cell_adc_st
int16_t LTC681x_run_cell_adc_st(uint8_t adc_reg, uint8_t total_ic, cell_asic *ic, uint8_t md, bool adcopt)
Helper function that runs the ADC Self Tests.
Definition: LTC681x.cpp:1070
LTC6811_clear_discharge
void LTC6811_clear_discharge(uint8_t total_ic, cell_asic *ic)
Clears all of the DCC bits in the configuration registers.
Definition: LTC6811.cpp:368
LTC6811_set_cfgr_refon
void LTC6811_set_cfgr_refon(uint8_t nIC, cell_asic *ic, bool refon)
Helper function to turn the refon bit HIGH or LOW.
Definition: LTC6811.cpp:498