| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC6812.h
Go to the documentation of this file.
1 /*! LTC6812: Multicell Battery Monitors
2 *
3 *@verbatim
4 *The LTC6812 is multicell battery stack monitor that measures up to 15 series
5 *connected battery cells with a total measurement error of less than 2.2mV.
6 *The cell measurement range of 0V to 5V makes the LTC6812 suitable for most
7 *battery chemistries. All 15 cell voltages can be captured in 245uS, and lower
8 *data acquisition rates can be selected for high noise reduction.
9 *Using the LTC6812-1, multiple devices are connected in a daisy-chain with one
10 *host processor connection for all devices, permitting simultaneous cell monitoring
11 *of long, high voltage battery strings.
12 *@endverbatim
13 *
14 * https://www.analog.com/en/products/ltc6812-1.html
15 * The schematic of DC2350A : https://www.analog.com/media/en/technical-documentation/eval-board-schematic/DC2350A-4-SCH.PDF
16 * ( Ensure that you modify the DC2350A board as mentioned on the schematic to work for LTC6812 (DC2350A-A) )
17 *
18 *********************************************************************************
19 * Copyright 2019(c) Analog Devices, Inc.
20 *
21 * All rights reserved.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are met:
25 * - Redistributions of source code must retain the above copyright
26 * notice, this list of conditions and the following disclaimer.
27 * - Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in
29 * the documentation and/or other materials provided with the
30 * distribution.
31 * - Neither the name of Analog Devices, Inc. nor the names of its
32 * contributors may be used to endorse or promote products derived
33 * from this software without specific prior written permission.
34 * - The use of this software may or may not infringe the patent rights
35 * of one or more patent holders. This license does not release you
36 * from the requirement that you obtain separate licenses from these
37 * patent holders to use this software.
38 * - Use of the software either in source or binary form, must be run
39 * on or directly connected to an Analog Devices Inc. component.
40 *
41 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
42 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
43 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
44 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
45 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
47 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 *******************************************************************************/
52
53 /*! @file
54 @ingroup LTC6812-1
55 Library Header for LTC6812-1 Multicell Battery Monitor
56 */
57
58 #ifndef LTC6812_H
59 #define LTC6812_H
60
61 #include "stdint.h"
62 #include "LTC681x.h"
63
64 #define CELL 1
65 #define AUX 2
66 #define STAT 3
67
68 /*!
69 Initialize the Register limits
70 @return void
71 */
72 void LTC6812_init_reg_limits(uint8_t total_ic, //!< Number of ICs in the system
73 cell_asic *ic //!< A two dimensional array that will store the data
74 );
75
76 /*!
77 Write the LTC6812 configuration register
78 @return void
79 */
80 void LTC6812_wrcfg(uint8_t total_ic, //!< The number of ICs being written
81 cell_asic *ic //!< A two dimensional array of the configuration data that will be written
82 );
83
84 /*!
85 Write the LTC6812 configuration register B
86 @return void
87 */
88 void LTC6812_wrcfgb(uint8_t total_ic, //!< The number of ICs being written
89 cell_asic *ic //!< A two dimensional array of the configuration data that will be written
90 );
91
92 /*!
93 Reads configuration registers of a LTC6812 daisy chain
94 @return int8_t, pec_error PEC Status.
95 0: Data read back has matching PEC
96 -1: Data read back has incorrect PEC
97 */
98 int8_t LTC6812_rdcfg(uint8_t total_ic, //!< Number of ICs in the daisy chain
99 cell_asic *ic //!< A two dimensional array that the function stores the read configuration data
100 );
101
102 /*!
103 Reads configuration registers of a LTC6812 daisy chain
104 @return int8_t, pec_error PEC Status.
105 0: Data read back has matching PEC
106 -1: Data read back has incorrect PEC
107 */
108 int8_t LTC6812_rdcfgb(uint8_t total_ic, //!< Number of ICs in the daisy chain
109 cell_asic *ic //!< A two dimensional array that the function stores the read configuration data
110 );
111
112 /*!
113 Starts cell voltage conversion
114 @return void
115 */
116 void LTC6812_adcv(uint8_t MD, //!< ADC Conversion Mode
117 uint8_t DCP, //!< Controls if Discharge is permitted during conversion
118 uint8_t CH //!< Sets which Cell channels are converted
119 );
120
121 /*!
122 Start a GPIO and Vref2 Conversion
123 @return void
124 */
125 void LTC6812_adax(uint8_t MD, //!< ADC Conversion Mode
126 uint8_t CHG //!< Sets which GPIO channels are converted
127 );
128
129 /*!
130 Start a Status ADC Conversion
131 @return void
132 */
133 void LTC6812_adstat(uint8_t MD, //!< ADC Conversion Mode
134 uint8_t CHST //!< Sets which Stat channels are converted
135 );
136
137 /*!
138 Starts cell voltage and GPIO 1&2 conversion
139 @return void
140 */
141 void LTC6812_adcvax(uint8_t MD, //!< ADC Conversion Mode
142 uint8_t DCP //!< Controls if Discharge is permitted during conversion
143 );
144
145 /*!
146 Starts cell voltage and SOC conversion
147 @return void
148 */
149 void LTC6812_adcvsc(uint8_t MD, //!< ADC Conversion Mode
150 uint8_t DCP //!< Controls if Discharge is permitted during conversion
151 );
152
153 /*!
154 Reads and parses the LTC6812 cell voltage registers.
155 @return uint8_t, pec_error PEC Status.
156 0: No PEC error detected
157 -1: PEC error detected, retry read
158 */
159 uint8_t LTC6812_rdcv(uint8_t reg, //!< Controls which cell voltage register is read back
160 uint8_t total_ic, //!< The number of ICs in the daisy chain
161 cell_asic *ic //!< Array of the parsed cell codes from lowest to highest
162 );
163
164 /*!
165 Reads and parses the LTC6812 auxiliary registers.
166 @return int8_t, pec_error PEC Status
167 0: No PEC error detected
168 -1: PEC error detected, retry read
169 */
170 int8_t LTC6812_rdaux(uint8_t reg, //!< Controls which GPIO voltage register is read back
171 uint8_t total_ic, //!< The number of ICs in the daisy chain
172 cell_asic *ic //!< A two dimensional array of the parsed gpio voltage codes
173 );
174
175 /*!
176 Reads and parses the LTC6812 stat registers.
177 @return int8_t, pec_error PEC Status
178 0: No PEC error detected
179 -1: PEC error detected, retry read
180 */
181 int8_t LTC6812_rdstat(uint8_t reg, //!<Determines which Stat register is read back
182 uint8_t total_ic,//!<The number of ICs in the system
183 cell_asic *ic //!< A two dimensional array that will store the data
184 );
185
186 /*!
187 Sends the poll ADC command
188 @returns 1 byte read back after a pladc command. If the byte is not 0xFF ADC conversion has completed
189 */
190 uint8_t LTC6812_pladc();
191
192 /*!
193 This function will block operation until the ADC has finished it's conversion.
194 @returns uint32_t, counter The approximate time it took for the ADC function to complete
195 */
196 uint32_t LTC6812_pollAdc();
197
198 /*!
199 Clears the LTC6812 cell voltage registers
200 @return void
201 */
202 void LTC6812_clrcell();
203
204 /*!
205 Clears the LTC6812 Auxiliary registers
206 @return void
207 */
208 void LTC6812_clraux();
209
210 /*!
211 Clears the LTC6812 Stat registers
212 @return void
213 */
214 void LTC6812_clrstat();
215
216 /*!
217 Starts the Mux Decoder diagnostic self test
218 Running this command will start the Mux Decoder Diagnostic Self Test.
219 This test takes roughly 1ms to complete. The MUXFAIL bit will be updated.
220 The bit will be set to 1 for a failure and 0 if the test has been passed.
221 @return void
222 */
223 void LTC6812_diagn();
224
225 /*!
226 Starts cell voltage self test conversion
227 @return void
228 */
229 void LTC6812_cvst(uint8_t MD, //!< ADC Conversion Mode
230 uint8_t ST //!< Sets if self test 1 or 2 is run
231 );
232
233 /*!
234 Start an Auxiliary Register Self Test Conversion
235 @return void
236 */
237 void LTC6812_axst(uint8_t MD, //!< ADC Conversion Mode
238 uint8_t ST //!< Sets if self test 1 or 2 is run
239 );
240
241 /*!
242 Start a Status Register Self Test Conversion
243 @return void
244 */
245 void LTC6812_statst(uint8_t MD, //!< ADC Conversion Mode
246 uint8_t ST //!< Sets if self test 1 or 2 is run
247 );
248
249 /*!
250 Starts Cell voltage overlap conversion
251 @return void
252 */
253 void LTC6812_adol(uint8_t MD, //!< ADC Conversion Mode
254 uint8_t DCP //!< Discharge permitted during conversion
255 );
256
257 /*!
258 Start an GPIO Redundancy test
259 @return void
260 */
261 void LTC6812_adaxd(uint8_t MD, //!< ADC Conversion Mode
262 uint8_t CHG //!< Sets which GPIO channels are converted
263 );
264
265 /*!
266 Start a Status register redundancy test Conversion
267 @return void
268 */
269 void LTC6812_adstatd(uint8_t MD, //!< ADC Mode
270 uint8_t CHST //!< Sets which Status channels are converted
271 );
272
273 /*!
274 Helper function that runs the ADC Self Tests
275 @return int16_t, error Number of errors detected.
276 */
277 int16_t LTC6812_run_cell_adc_st(uint8_t adc_reg, //!< Type of register
278 uint8_t total_ic, //!< Number of ICs in the daisy chain
279 cell_asic *ic, //!< A two dimensional array that will store the data
280 uint8_t md, //!< ADC Mode
281 bool adcopt //!< The ADCOPT bit in the configuration register
282 );
283
284 /*!
285 Helper Function that runs the ADC Overlap test
286 @return uint16_t, error
287 0: Pass
288 -1: False, Error detected
289 */
290 uint16_t LTC6812_run_adc_overlap(uint8_t total_ic, //!< Number of ICs in the daisy chain
291 cell_asic *ic //!< A two dimensional array that will store the data
292 );
293
294 /*!
295 Helper function that runs the ADC Digital Redundancy commands and checks output for errors
296 @return int16_t, error Number of errors detected.
297 */
298 int16_t LTC6812_run_adc_redundancy_st(uint8_t adc_mode, //!< ADC Mode
299 uint8_t adc_reg, //!< Type of register
300 uint8_t total_ic, //!< Number of ICs in the daisy chain
301 cell_asic *ic //!< A two dimensional array that will store the data
302 );
303
304 /*!
305 Start an open wire Conversion
306 @return void
307 */
308 void LTC6812_adow(uint8_t MD, //!< ADC Conversion Mode
309 uint8_t PUP, //!< Pull up/Pull down current
310 uint8_t CH, //!< Sets which Cell channels are converted
311 uint8_t DCP //!< Discharge permitted during conversion
312 );
313
314 /*!
315 Start GPIOs open wire ADC conversion
316 @return void
317 */
318 void LTC6812_axow( uint8_t MD, //!< ADC Mode
319 uint8_t PUP //!< Pull up/Pull down current
320 );
321
322 /*!
323 Runs the data sheet algorithm for open wire for single cell detection
324 @return void
325 */
326 void LTC6812_run_openwire_single(uint8_t total_ic, //!< Number of ICs in the daisy chain
327 cell_asic *ic //!< A two dimensional array that will store the data
328 );
329
330 /*!
331 Runs the data sheet algorithm for open wire for multiple cell and two consecutive cells detection
332 @return void
333 */
334 void LTC6812_run_openwire_multi(uint8_t total_ic, //!< Number of ICs in the daisy chain
335 cell_asic *ic //!< A two dimensional array that will store the data
336 );
337
338 /*!
339 Runs open wire for GPIOs
340 @return void
341 */
342 void LTC6812_run_gpio_openwire(uint8_t total_ic, //!< Number of ICs in the daisy chain
343 cell_asic *ic //!< A two dimensional array that will store the data
344 );
345
346 /*!
347 Helper function to set discharge bit in CFG register
348 @return void
349 */
350 void LTC6812_set_discharge(int Cell, //!< The cell to be discharged
351 uint8_t total_ic, //!< Number of ICs in the system
352 cell_asic *ic//!< A two dimensional array that will store the data
353 );
354
355 /*!
356 Clears all of the DCC bits in the configuration registers
357 @return void
358 */
359 void LTC6812_clear_discharge(uint8_t total_ic, //!< Number of ICs in the system
360 cell_asic *ic //!< A two dimensional array that will store the data
361 );
362
363 /*!
364 Write the LTC6812 PWM register
365 @return void
366 */
367 void LTC6812_wrpwm(uint8_t total_ic, //!< Number of ICs in the daisy chain
368 uint8_t pwmReg, //!< Select register
369 cell_asic *ic //!< a two dimensional array that will store the data
370 );
371
372 /*!
373 Reads pwm registers of a LTC6811 daisy chain
374 @return int8_t, pec_error PEC Status.
375 0: Data read back has matching PEC
376 -1: Data read back has incorrect PEC
377 */
378 int8_t LTC6812_rdpwm(uint8_t total_ic, //!< Number of ICs in the daisy chain
379 uint8_t pwmReg, //!< Select register
380 cell_asic *ic //!< A two dimensional array that the function stores the read pwm data
381 );
382
383 /*!
384 Write the LTC6812 Sctrl register
385 @return void
386 */
387 void LTC6812_wrsctrl(uint8_t total_ic, //!< Number of ICs in the daisy chain
388 uint8_t sctrl_reg, //!< Select register
389 cell_asic *ic //!< A two dimensional array that will store the data
390 );
391
392 /*!
393 Reads sctrl registers of a LTC6812 daisy chain
394 @return int8_t, pec_error PEC Status.
395 0: Data read back has matching PEC
396 -1: Data read back has incorrect PEC
397 */
398 int8_t LTC6812_rdsctrl(uint8_t total_ic, //!< Number of ICs in the daisy chain
399 uint8_t sctrl_reg, //!< Select register
400 cell_asic *ic //!< A two dimensional array that the function stores the read data
401 );
402
403 /*!
404 Start Sctrl data communication
405 This command will start the sctrl pulse communication over the spins
406 @return void
407 */
408 void LTC6812_stsctrl();
409
410 /*!
411 Clears the LTC6812 Sctrl registers
412 @return void
413 */
414 void LTC6812_clrsctrl();
415
416 /*!
417 Write the 6812 PWM/Sctrl Register B
418 @return void
419 */
420 void LTC6812_wrpsb(uint8_t total_ic, //!< Number of ICs in the daisy chain
421 cell_asic *ic //!< A two dimensional array that will store the data
422
423 );
424
425 /*!
426 Reading pwm/s control register b
427 @return int8_t, pec_error PEC Status.
428 0: Data read back has matching PEC
429 -1: Data read back has incorrect PEC
430 */
431 int8_t LTC6812_rdpsb(uint8_t total_ic, //!< Number of ICs in the daisy chain
432 cell_asic *ic //!< A two dimensional array that the function stores the read data
433 );
434
435 /*!
436 Write the LTC6812 COMM register
437 @return void
438 */
439 void LTC6812_wrcomm(uint8_t total_ic, //!< Number of ICs in the daisy chain
440 cell_asic *ic //!< A two dimensional array of the comm data that will be written
441 );
442
443 /*!
444 Reads comm registers of a LTC6812 daisy chain
445 @return int8_t, pec_error PEC Status.
446 0: Data read back has matching PEC
447 -1: Data read back has incorrect PEC
448 */
449 int8_t LTC6812_rdcomm(uint8_t total_ic, //!< Number of ICs in the daisy chain
450 cell_asic *ic //!< Two dimensional array that the function stores the read comm data
451 );
452
453 /*!
454 Issues a stcomm command and clocks data out of the COMM register
455 @return void
456 */
457 void LTC6812_stcomm(uint8_t len);
458
459 /*!
460 Mutes the LTC6812 discharge transistors
461 @return void
462 */
463 void LTC6812_mute();
464
465 /*!
466 Clears the LTC6812 Mute Discharge
467 @return void
468 */
469 void LTC6812_unmute();
470
471 /*!
472 Helper Function that counts overall PEC errors and register/IC PEC errors
473 @return void
474 */
475 void LTC6812_check_pec(uint8_t total_ic, //!< Number of ICs in the daisy chain
476 uint8_t reg, //!< Type of register
477 cell_asic *ic //!< A two dimensional array that will store the data
478 );
479
480 /*!
481 Helper Function that resets the PEC error counters
482 @return void
483 */
484 void LTC6812_reset_crc_count(uint8_t total_ic, //!< Number of ICs in the daisy chain
485 cell_asic *ic //!< A two dimensional array that will store the data
486 );
487
488 /*!
489 Helper Function to initialize the CFGR data structures
490 @return void
491 */
492 void LTC6812_init_cfg(uint8_t total_ic, //!< Number of ICs in the daisy chain
493 cell_asic *ic //!< A two dimensional array that will store the data
494 );
495
496 /*!
497 Helper function to set appropriate bits in CFGR register based on bit function
498 @return void
499 */
500 void LTC6812_set_cfgr(uint8_t nIC, //!< Current IC
501 cell_asic *ic, //!< A two dimensional array that will store the data
502 bool refon, //!< The REFON bit
503 bool adcopt, //!< The ADCOPT bit
504 bool gpio[5], //!< The GPIO bits
505 bool dcc[12], //!< The DCC bits
506 bool dcto[4], //!< The Dcto bits
507 uint16_t uv, //!< The UV value
508 uint16_t ov //!< The OV value
509 );
510
511 /*!
512 Helper function to turn the refon bit HIGH or LOW
513 @return void
514 */
515 void LTC6812_set_cfgr_refon(uint8_t nIC,//!< Current IC
516 cell_asic *ic, //!< A two dimensional array that will store the data
517 bool refon //!< The REFON bit
518 );
519
520 /*!
521 Helper function to turn the ADCOPT bit HIGH or LOW
522 @return void
523 */
524 void LTC6812_set_cfgr_adcopt(uint8_t nIC,//!< Current IC
525 cell_asic *ic, //!< A two dimensional array that will store the data
526 bool adcopt //!< The ADCOPT bit
527 );
528
529 /*!
530 Helper function to turn the GPIO bits HIGH or LOW
531 @return void
532 */
533 void LTC6812_set_cfgr_gpio(uint8_t nIC, //!< Current IC
534 cell_asic *ic, //!< A two dimensional array that will store the data
535 bool gpio[] //!< The GPIO bits
536 );
537
538 /*!
539 Helper function to turn the DCC bits HIGH or LOW
540 @return void
541 */
542 void LTC6812_set_cfgr_dis(uint8_t nIC, //!< Current IC
543 cell_asic *ic, //!< A two dimensional array that will store the data
544 bool dcc[] //!< The DCC bits
545 );
546
547 /*!
548 Helper Function to set dcto value in CFG register
549 @return void
550 */
551 void LTC6812_set_cfgr_dcto(uint8_t nIC, //!< Current IC
552 cell_asic *ic, //!< A two dimensional array that will store the data
553 bool dcto[4] //!< The Dcto bits
554 );
555
556 /*! Helper function to set uv field in CFGRA register
557 @return void
558 */
559 void LTC6812_set_cfgr_uv(uint8_t nIC, //!< Current IC
560 cell_asic *ic, //!< A two dimensional array that will store the data
561 uint16_t uv //!< The UV value
562 );
563
564 /*!
565 Helper function to set OV field in CFGRA register
566 @return void
567 */
568 void LTC6812_set_cfgr_ov(uint8_t nIC, //!< Current IC
569 cell_asic *ic, //!< A two dimensional array that will store the data
570 uint16_t ov //!< The OV value
571 );
572
573 /*!
574 Helper Function to initialize the CFGR B data structures
575 @return void
576 */
577 void LTC6812_init_cfgb(uint8_t total_ic, //!< Number of ICs in the daisy chain
578 cell_asic *ic//!< A two dimensional array that will store the data
579 );
580
581 /*!
582 Helper function to set appropriate bits in CFGR register based on bit function
583 @return void
584 */
585 void LTC6812_set_cfgrb(uint8_t nIC, //!< Current IC
586 cell_asic *ic, //!< A two dimensional array that will store the data
587 bool fdrf, //!< The FDRF bit
588 bool dtmen, //!< The DTMEN bit
589 bool ps[2], //!< Path selection bits
590 bool gpiobits[4], //!< The GPIO bits
591 bool dccbits[4] //!< The DCC bits
592 );
593
594 /*!
595 Helper function to turn the FDRF bit HIGH or LOW
596 @return void
597 */
598 void LTC6812_set_cfgrb_fdrf(uint8_t nIC,//!< Current IC
599 cell_asic *ic, //!< A two dimensional array that will store the data
600 bool fdrf //!< The FDRF bit
601 );
602
603 /*!
604 Helper function to turn the DTMEN bit HIGH or LOW
605 @return void
606 */
607 void LTC6812_set_cfgrb_dtmen(uint8_t nIC,//!< Current IC
608 cell_asic *ic, //!< A two dimensional array that will store the data
609 bool dtmen //!< The DTMEN bit
610 );
611
612 /*!
613 Helper function to turn the Path Select bit HIGH or LOW
614 @return void
615 */
616 void LTC6812_set_cfgrb_ps(uint8_t nIC,//!< Current IC
617 cell_asic *ic, //!< A two dimensional array that will store the data
618 bool ps[] //!< Path selection bits
619 );
620
621 /*!
622 Helper function to turn the GPIO bit HIGH or LOW
623 @return void
624 */
625 void LTC6812_set_cfgrb_gpio_b(uint8_t nIC,//!< Current IC
626 cell_asic *ic, //!< A two dimensional array that will store the data
627 bool gpiobits[] //!< The GPIO bits
628 );
629
630 /*!
631 Helper function to turn the DCC bit HIGH or LOW
632 @return void
633 */
634 void LTC6812_set_cfgrb_dcc_b(uint8_t nIC,//!< Current IC
635 cell_asic *ic, //!< A two dimensional array that will store the data
636 bool dccbits[] //!< The DCC bits
637 );
638
639 #endif
LTC6812_run_gpio_openwire
void LTC6812_run_gpio_openwire(uint8_t total_ic, cell_asic *ic)
Runs open wire for GPIOs.
Definition: LTC6812.cpp:399
LTC681x.h
General BMS Library.
LTC6812_rdpsb
int8_t LTC6812_rdpsb(uint8_t total_ic, cell_asic *ic)
Reading pwm/s control register b.
Definition: LTC6812.cpp:526
LTC6812_wrcomm
void LTC6812_wrcomm(uint8_t total_ic, cell_asic *ic)
Write the LTC6812 COMM register.
Definition: LTC6812.cpp:580
LTC6812_clrcell
void LTC6812_clrcell()
Clears the LTC6812 cell voltage registers.
Definition: LTC6812.cpp:229
LTC6812_rdcfgb
int8_t LTC6812_rdcfgb(uint8_t total_ic, cell_asic *ic)
Reads configuration registers of a LTC6812 daisy chain.
Definition: LTC6812.cpp:118
LTC6812_pollAdc
uint32_t LTC6812_pollAdc()
This function will block operation until the ADC has finished it&#39;s conversion.
Definition: LTC6812.cpp:219
LTC6812_adcvsc
void LTC6812_adcvsc(uint8_t MD, uint8_t DCP)
Starts cell voltage and SOC conversion.
Definition: LTC6812.cpp:153
LTC6812_adstatd
void LTC6812_adstatd(uint8_t MD, uint8_t CHST)
Start a Status register redundancy test Conversion.
Definition: LTC6812.cpp:302
LTC6812_axow
void LTC6812_axow(uint8_t MD, uint8_t PUP)
Start GPIOs open wire ADC conversion.
Definition: LTC6812.cpp:379
LTC6812_rdstat
int8_t LTC6812_rdstat(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6812 stat registers.
Definition: LTC6812.cpp:202
LTC6812_init_cfgb
void LTC6812_init_cfgb(uint8_t total_ic, cell_asic *ic)
Helper Function to initialize the CFGR B data structures.
Definition: LTC6812.cpp:688
LTC6812_diagn
void LTC6812_diagn()
Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnosti...
Definition: LTC6812.cpp:256
LTC6812_init_reg_limits
void LTC6812_init_reg_limits(uint8_t total_ic, cell_asic *ic)
Initialize the Register limits.
Definition: LTC6812.cpp:68
cell_asic
Cell variable structure.
Definition: LTC681x.h:170
LTC6812_set_cfgrb_dcc_b
void LTC6812_set_cfgrb_dcc_b(uint8_t nIC, cell_asic *ic, bool dccbits[])
Helper function to turn the DCC bit HIGH or LOW.
Definition: LTC6812.cpp:744
LTC6812_wrcfgb
void LTC6812_wrcfgb(uint8_t total_ic, cell_asic *ic)
Write the LTC6812 configuration register B.
Definition: LTC6812.cpp:100
LTC6812_set_cfgr
void LTC6812_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: LTC6812.cpp:641
LTC6812_run_openwire_single
void LTC6812_run_openwire_single(uint8_t total_ic, cell_asic *ic)
Runs the data sheet algorithm for open wire for single cell detection.
Definition: LTC6812.cpp:387
LTC6812_unmute
void LTC6812_unmute()
Clears the LTC6812 Mute Discharge.
Definition: LTC6812.cpp:614
LTC6812_adax
void LTC6812_adax(uint8_t MD, uint8_t CHG)
Start a GPIO and Vref2 Conversion.
Definition: LTC6812.cpp:137
LTC6812_clear_discharge
void LTC6812_clear_discharge(uint8_t total_ic, cell_asic *ic)
Clears all of the DCC bits in the configuration registers.
Definition: LTC6812.cpp:435
LTC6812_reset_crc_count
void LTC6812_reset_crc_count(uint8_t total_ic, cell_asic *ic)
Helper Function that resets the PEC error counters.
Definition: LTC6812.cpp:630
LTC6812_rdpwm
int8_t LTC6812_rdpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
Reads pwm registers of a LTC6811 daisy chain.
Definition: LTC6812.cpp:453
LTC6812_adcv
void LTC6812_adcv(uint8_t MD, uint8_t DCP, uint8_t CH)
Starts cell voltage conversion.
Definition: LTC6812.cpp:128
LTC6812_run_adc_overlap
uint16_t LTC6812_run_adc_overlap(uint8_t total_ic, cell_asic *ic)
Helper Function that runs the ADC Overlap test.
Definition: LTC6812.cpp:323
LTC6812_set_cfgr_ov
void LTC6812_set_cfgr_ov(uint8_t nIC, cell_asic *ic, uint16_t ov)
Helper function to set OV field in CFGRA register.
Definition: LTC6812.cpp:682
LTC6812_cvst
void LTC6812_cvst(uint8_t MD, uint8_t ST)
Starts cell voltage self test conversion.
Definition: LTC6812.cpp:262
LTC6812_check_pec
void LTC6812_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: LTC6812.cpp:624
LTC6812_set_cfgr_dcto
void LTC6812_set_cfgr_dcto(uint8_t nIC, cell_asic *ic, bool dcto[4])
Helper Function to set dcto value in CFG register.
Definition: LTC6812.cpp:672
LTC6812_rdcv
uint8_t LTC6812_rdcv(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6812 cell voltage registers.
Definition: LTC6812.cpp:172
LTC6812_adstat
void LTC6812_adstat(uint8_t MD, uint8_t CHST)
Start a Status ADC Conversion.
Definition: LTC6812.cpp:145
LTC6812_wrpwm
void LTC6812_wrpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
Write the LTC6812 PWM register.
Definition: LTC6812.cpp:444
LTC6812_mute
void LTC6812_mute()
Mutes the LTC6812 discharge transistors.
Definition: LTC6812.cpp:604
LTC6812_rdcomm
int8_t LTC6812_rdcomm(uint8_t total_ic, cell_asic *ic)
Reads comm registers of a LTC6812 daisy chain.
Definition: LTC6812.cpp:588
LTC6812_set_cfgrb_ps
void LTC6812_set_cfgrb_ps(uint8_t nIC, cell_asic *ic, bool ps[])
Helper function to turn the Path Select bit HIGH or LOW.
Definition: LTC6812.cpp:724
LTC6812_rdsctrl
int8_t LTC6812_rdsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Reads sctrl registers of a LTC6812 daisy chain.
Definition: LTC6812.cpp:473
LTC6812_clrsctrl
void LTC6812_clrsctrl()
Clears the LTC6812 Sctrl registers.
Definition: LTC6812.cpp:494
LTC6812_set_cfgr_gpio
void LTC6812_set_cfgr_gpio(uint8_t nIC, cell_asic *ic, bool gpio[])
Helper function to turn the GPIO bits HIGH or LOW.
LTC6812_adaxd
void LTC6812_adaxd(uint8_t MD, uint8_t CHG)
Start an GPIO Redundancy test.
Definition: LTC6812.cpp:294
LTC6812_set_cfgr_adcopt
void LTC6812_set_cfgr_adcopt(uint8_t nIC, cell_asic *ic, bool adcopt)
Helper function to turn the ADCOPT bit HIGH or LOW.
Definition: LTC6812.cpp:657
LTC6812_init_cfg
void LTC6812_init_cfg(uint8_t total_ic, cell_asic *ic)
Helper Function to initialize the CFGR data structures.
Definition: LTC6812.cpp:636
LTC6812_set_cfgr_uv
void LTC6812_set_cfgr_uv(uint8_t nIC, cell_asic *ic, uint16_t uv)
Helper function to set uv field in CFGRA register.
Definition: LTC6812.cpp:677
LTC6812_rdcfg
int8_t LTC6812_rdcfg(uint8_t total_ic, cell_asic *ic)
Reads configuration registers of a LTC6812 daisy chain.
Definition: LTC6812.cpp:108
LTC6812_wrcfg
void LTC6812_wrcfg(uint8_t total_ic, cell_asic *ic)
Write the LTC6812 configuration register.
Definition: LTC6812.cpp:88
LTC6812_wrsctrl
void LTC6812_wrsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Write the LTC6812 Sctrl register.
Definition: LTC6812.cpp:464
LTC6812_set_cfgrb_gpio_b
void LTC6812_set_cfgrb_gpio_b(uint8_t nIC, cell_asic *ic, bool gpiobits[])
Helper function to turn the GPIO bit HIGH or LOW.
Definition: LTC6812.cpp:734
LTC6812_wrpsb
void LTC6812_wrpsb(uint8_t total_ic, cell_asic *ic)
Write the 6812 PWM/Sctrl Register B.
Definition: LTC6812.cpp:500
LTC6812_set_cfgr_refon
void LTC6812_set_cfgr_refon(uint8_t nIC, cell_asic *ic, bool refon)
Helper function to turn the refon bit HIGH or LOW.
Definition: LTC6812.cpp:652
LTC6812_adow
void LTC6812_adow(uint8_t MD, uint8_t PUP, uint8_t CH, uint8_t DCP)
Start an open wire Conversion.
Definition: LTC6812.cpp:369
LTC6812_run_cell_adc_st
int16_t LTC6812_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: LTC6812.cpp:310
LTC6812_set_discharge
void LTC6812_set_discharge(int Cell, uint8_t total_ic, cell_asic *ic)
Helper function to set discharge bit in CFG register.
Definition: LTC6812.cpp:407
LTC6812_set_cfgrb_dtmen
void LTC6812_set_cfgrb_dtmen(uint8_t nIC, cell_asic *ic, bool dtmen)
Helper function to turn the DTMEN bit HIGH or LOW.
Definition: LTC6812.cpp:717
LTC6812_set_cfgr_dis
void LTC6812_set_cfgr_dis(uint8_t nIC, cell_asic *ic, bool dcc[])
Helper function to turn the DCC bits HIGH or LOW.
LTC6812_pladc
uint8_t LTC6812_pladc()
Sends the poll ADC command.
Definition: LTC6812.cpp:213
LTC6812_clraux
void LTC6812_clraux()
Clears the LTC6812 Auxiliary registers.
Definition: LTC6812.cpp:239
LTC6812_adol
void LTC6812_adol(uint8_t MD, uint8_t DCP)
Starts Cell voltage overlap conversion.
Definition: LTC6812.cpp:286
LTC6812_stcomm
void LTC6812_stcomm(uint8_t len)
Issues a stcomm command and clocks data out of the COMM register.
Definition: LTC6812.cpp:598
LTC6812_statst
void LTC6812_statst(uint8_t MD, uint8_t ST)
Start a Status Register Self Test Conversion.
Definition: LTC6812.cpp:278
LTC6812_rdaux
int8_t LTC6812_rdaux(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6812 auxiliary registers.
Definition: LTC6812.cpp:186
LTC6812_clrstat
void LTC6812_clrstat()
Clears the LTC6812 Stat registers.
Definition: LTC6812.cpp:250
LTC6812_set_cfgrb
void LTC6812_set_cfgrb(uint8_t nIC, cell_asic *ic, bool fdrf, bool dtmen, bool ps[2], bool gpiobits[4], bool dccbits[4])
Helper function to set appropriate bits in CFGR register based on bit function.
Definition: LTC6812.cpp:700
LTC6812_stsctrl
void LTC6812_stsctrl()
Start Sctrl data communication This command will start the sctrl pulse communication over the spins...
Definition: LTC6812.cpp:484
LTC6812_set_cfgrb_fdrf
void LTC6812_set_cfgrb_fdrf(uint8_t nIC, cell_asic *ic, bool fdrf)
Helper function to turn the FDRF bit HIGH or LOW.
Definition: LTC6812.cpp:710
LTC6812_run_adc_redundancy_st
int16_t LTC6812_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: LTC6812.cpp:357
LTC6812_run_openwire_multi
void LTC6812_run_openwire_multi(uint8_t total_ic, cell_asic *ic)
Runs the data sheet algorithm for open wire for multiple cell and two consecutive cells detection...
Definition: LTC6812.cpp:393
LTC6812_axst
void LTC6812_axst(uint8_t MD, uint8_t ST)
Start an Auxiliary Register Self Test Conversion.
Definition: LTC6812.cpp:270
LTC6812_adcvax
void LTC6812_adcvax(uint8_t MD, uint8_t DCP)
Starts cell voltage and GPIO 1&2 conversion.
Definition: LTC6812.cpp:161