| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC6812.cpp
Go to the documentation of this file.
1 /*! LTC6812: Multicell Battery Monitors
2 *
3 *@verbatim
4 *The LTC6812 is multi-cell 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 //! @ingroup BMS
54 //! @{
55 //! @defgroup LTC6812-1 LTC6812-1: Multicell Battery Monitor
56 //! @}
57
58 /*! @file
59 @ingroup LTC6812-1
60 Library for LTC6812-1 Multicell Battery Monitor
61 */
62
63 #include "stdint.h"
64 #include "LTC681x.h"
65 #include "LTC6812.h"
66
67 /* Helper function to initialize register limits. */
68 void LTC6812_init_reg_limits(uint8_t total_ic, //Number of ICs in the system
69 cell_asic *ic //A two dimensional array that the function stores data
70 )
71 {
72 for(uint8_t cic=0; cic<total_ic; cic++)
73 {
74 ic[cic].ic_reg.cell_channels=15;
75 ic[cic].ic_reg.stat_channels=4;
76 ic[cic].ic_reg.aux_channels=9;
77 ic[cic].ic_reg.num_cv_reg=5;
78 ic[cic].ic_reg.num_gpio_reg=4;
79 ic[cic].ic_reg.num_stat_reg=2;
80 }
81 }
82
83 /*
84 This command will write the configuration registers of the LTC6812-1s
85 connected in a daisy chain stack. The configuration is written in descending
86 order so the last device's configuration is written first.
87 */
88 void LTC6812_wrcfg(uint8_t total_ic, //The number of ICs being written to
89 cell_asic *ic //A two dimensional array of the configuration data that will be written
90 )
91 {
92 LTC681x_wrcfg(total_ic,ic);
93 }
94
95 /*
96 This command will write the configuration b registers of the LTC6812-1s
97 connected in a daisy chain stack. The configuration is written in descending
98 order so the last device's configuration is written first.
99 */
100 void LTC6812_wrcfgb(uint8_t total_ic, //The number of ICs being written to
101 cell_asic *ic //A two dimensional array of the configuration data that will be written
102 )
103 {
104 LTC681x_wrcfgb(total_ic,ic);
105 }
106
107 /* Reads configuration registers of a LTC6812 daisy chain */
108 int8_t LTC6812_rdcfg(uint8_t total_ic, //Number of ICs in the system
109 cell_asic *ic //A two dimensional array that the function stores the read configuration data.
110 )
111 {
112 int8_t pec_error = 0;
113 pec_error = LTC681x_rdcfg(total_ic,ic);
114 return(pec_error);
115 }
116
117 /* Reads configuration registers B of a LTC6812 daisy chain */
118 int8_t LTC6812_rdcfgb(uint8_t total_ic, //Number of ICs in the system
119 cell_asic *ic //A two dimensional array that the function stores the read configuration data.
120 )
121 {
122 int8_t pec_error = 0;
123 pec_error = LTC681x_rdcfgb(total_ic,ic);
124 return(pec_error);
125 }
126
127 /* Starts cell voltage conversion */
128 void LTC6812_adcv(uint8_t MD, //ADC Mode
129 uint8_t DCP, //Discharge Permit
130 uint8_t CH //Cell Channels to be measured
131 )
132 {
133 LTC681x_adcv(MD,DCP,CH);
134 }
135
136 /* Start a GPIO and Vref2 Conversion */
137 void LTC6812_adax(uint8_t MD, //ADC Mode
138 uint8_t CHG //GPIO Channels to be measured)
139 )
140 {
141 LTC681x_adax(MD,CHG);
142 }
143
144 /* Start a Status ADC Conversion */
145 void LTC6812_adstat(uint8_t MD, //ADC Mode
146 uint8_t CHST //Stat Channels to be measured
147 )
148 {
149 LTC681x_adstat(MD,CHST);
150 }
151
152 /* Starts cell voltage and SOC conversion */
153 void LTC6812_adcvsc(uint8_t MD, //ADC Mode
154 uint8_t DCP //Discharge Permit
155 )
156 {
157 LTC681x_adcvsc(MD,DCP);
158 }
159
160 /* Starts cell voltage and GPIO 1 & 2 conversion */
161 void LTC6812_adcvax(uint8_t MD, //ADC Mode
162 uint8_t DCP //Discharge Permit
163 )
164 {
165 LTC681x_adcvax(MD,DCP);
166 }
167
168 /*
169 Reads and parses the LTC6812 cell voltage registers of the LTC6812. This function will send the requested
170 read commands parse the data and store the cell voltages in c_codes variable.
171 */
172 uint8_t LTC6812_rdcv(uint8_t reg, // Controls which cell voltage register is read back.
173 uint8_t total_ic, // the number of ICs in the system
174 cell_asic *ic // Array of the parsed cell codes
175 )
176 {
177 int8_t pec_error = 0;
178 pec_error = LTC681x_rdcv(reg,total_ic,ic);
179 return(pec_error);
180 }
181
182 /*
183 The function is used to read the parsed GPIO codes of the LTC6812. This function will send the requested
184 read commands parse the data and store the gpio voltages in a_codes variable
185 */
186 int8_t LTC6812_rdaux(uint8_t reg, //Determines which GPIO voltage register is read back.
187 uint8_t total_ic,//The number of ICs in the system
188 cell_asic *ic//A two dimensional array of the gpio voltage codes.
189 )
190 {
191 int8_t pec_error = 0;
192 LTC681x_rdaux(reg,total_ic,ic);
193 return (pec_error);
194 }
195
196 /*
197 Reads and parses the LTC6812 stat registers.
198 The function is used to read the parsed stat codes of the LTC6812.
199 This function will send the requested read commands parse the data
200 and store the stat voltages in stat_codes variable
201 */
202 int8_t LTC6812_rdstat(uint8_t reg, //Determines which Stat register is read back.
203 uint8_t total_ic,//The number of ICs in the system
204 cell_asic *ic //A two dimensional array of the stat codes.
205 )
206 {
207 int8_t pec_error = 0;
208 pec_error = LTC681x_rdstat(reg,total_ic,ic);
209 return (pec_error);
210 }
211
212 /* Sends the poll ADC command */
213 uint8_t LTC6812_pladc()
214 {
215 return(LTC681x_pladc());
216 }
217
218 /* This function will block operation until the ADC has finished it's conversion */
219 uint32_t LTC6812_pollAdc()
220 {
221 return(LTC681x_pollAdc());
222 }
223
224 /*
225 The command clears the cell voltage registers and initializes
226 all values to 1. The register will read back hexadecimal 0xFF
227 after the command is sent.
228 */
229 void LTC6812_clrcell()
230 {
231 LTC681x_clrcell();
232 }
233
234 /*
235 The command clears the Auxiliary registers and initializes
236 all values to 1. The register will read back hexadecimal 0xFF
237 after the command is sent.
238 */
239 void LTC6812_clraux()
240 {
241 LTC681x_clraux();
242 }
243
244 /*
245 The command clears the Stat registers and initializes
246 all values to 1. The register will read back hexadecimal 0xFF
247 after the command is sent.
248
249 */
250 void LTC6812_clrstat()
251 {
252 LTC681x_clrstat();
253 }
254
255 /* Starts the Mux Decoder diagnostic self test */
256 void LTC6812_diagn()
257 {
258 LTC681x_diagn();
259 }
260
261 /* Starts cell voltage self test conversion */
262 void LTC6812_cvst(uint8_t MD, //ADC Mode
263 uint8_t ST //Self Test
264 )
265 {
266 LTC681x_cvst(MD,ST);
267 }
268
269 /* Start an Auxiliary Register Self Test Conversion */
270 void LTC6812_axst(uint8_t MD, //ADC Mode
271 uint8_t ST //Self Test
272 )
273 {
274 LTC681x_axst(MD,ST);
275 }
276
277 /* Start a Status Register Self Test Conversion */
278 void LTC6812_statst(uint8_t MD, //ADC Mode
279 uint8_t ST //Self Test
280 )
281 {
282 LTC681x_statst(MD,ST);
283 }
284
285 /* Starts cell voltage overlap conversion */
286 void LTC6812_adol(uint8_t MD, //ADC Mode
287 uint8_t DCP //Discharge Permit
288 )
289 {
290 LTC681x_adol(MD,DCP);
291 }
292
293 /* Start an GPIO Redundancy test */
294 void LTC6812_adaxd(uint8_t MD, //ADC Mode
295 uint8_t CHG //GPIO Channels to be measured
296 )
297 {
298 LTC681x_adaxd(MD,CHG);
299 }
300
301 /* Start a Status register redundancy test Conversion */
302 void LTC6812_adstatd(uint8_t MD, //ADC Mode
303 uint8_t CHST //Stat Channels to be measured
304 )
305 {
306 LTC681x_adstatd(MD,CHST);
307 }
308
309 /* Runs the Digital Filter Self Test */
310 int16_t LTC6812_run_cell_adc_st(uint8_t adc_reg, // Type of register
311 uint8_t total_ic, // Number of ICs in the daisy chain
312 cell_asic *ic, // A two dimensional array that will store the data
313 uint8_t md, //ADC Mode
314 bool adcopt // The ADCOPT bit in the configuration register
315 )
316 {
317 int16_t error = 0;
318 error = LTC681x_run_cell_adc_st(adc_reg,total_ic,ic,md,adcopt);
319 return(error);
320 }
321
322 /* Runs the ADC overlap test for the IC */
323 uint16_t LTC6812_run_adc_overlap(uint8_t total_ic, // Number of ICs in the daisy chain
324 cell_asic *ic // A two dimensional array that will store the data
325 )
326 {
327 uint16_t error = 0;
328 int32_t measure_delta =0;
329 int16_t failure_pos_limit = 20;
330 int16_t failure_neg_limit = -20;
331 uint32_t conv_time=0;
332 wakeup_idle(total_ic);
333 LTC681x_adol(MD_7KHZ_3KHZ,DCP_DISABLED);
334 conv_time = LTC681x_pollAdc();
335
336 wakeup_idle(total_ic);
337 error = LTC681x_rdcv(0, total_ic,ic);
338 for (int cic = 0; cic<total_ic; cic++)
339 {
340
341
342 measure_delta = (int32_t)ic[cic].cells.c_codes[6]-(int32_t)ic[cic].cells.c_codes[7];
343 if ((measure_delta>failure_pos_limit) || (measure_delta<failure_neg_limit))
344 {
345 error = error | (1<<(cic-1));
346 }
347 measure_delta = (int32_t)ic[cic].cells.c_codes[12]-(int32_t)ic[cic].cells.c_codes[13];
348 if ((measure_delta>failure_pos_limit) || (measure_delta<failure_neg_limit))
349 {
350 error = error | (1<<(cic-1));
351 }
352 }
353 return(error);
354 }
355
356 /* Runs the redundancy self test */
357 int16_t LTC6812_run_adc_redundancy_st(uint8_t adc_mode, //ADC Mode
358 uint8_t adc_reg, // Type of register
359 uint8_t total_ic, // Number of ICs in the daisy chain
360 cell_asic *ic // A two dimensional array that will store the data
361 )
362 {
363 int16_t error = 0;
364 LTC681x_run_adc_redundancy_st(adc_mode,adc_reg,total_ic,ic);
365 return(error);
366 }
367
368 /* Start an open wire Conversion */
369 void LTC6812_adow(uint8_t MD, // ADC Conversion Mode
370 uint8_t PUP, //Pull up/Pull down current
371 uint8_t CH, // Sets which Cell channels are converted
372 uint8_t DCP // Discharge permitted during conversion
373 )
374 {
375 LTC681x_adow(MD,PUP,CH,DCP);
376 }
377
378 /* Start GPIOs open wire ADC conversion */
379 void LTC6812_axow( uint8_t MD, //ADC Mode
380 uint8_t PUP //Pull up/Pull down current
381 )
382 {
383 LTC681x_axow(MD, PUP);
384 }
385
386 /* Runs the data sheet algorithm for open wire for single cell detection */
387 void LTC6812_run_openwire_single(uint8_t total_ic, cell_asic *ic)
388 {
389 LTC681x_run_openwire_single(total_ic, ic);
390 }
391
392 /* Runs the data sheet algorithm for open wire for multiple cell and two consecutive cells detection */
393 void LTC6812_run_openwire_multi(uint8_t total_ic, cell_asic *ic)
394 {
395 LTC681x_run_openwire_multi(total_ic, ic);
396 }
397
398 /* Runs open wire for GPIOs */
399 void LTC6812_run_gpio_openwire(uint8_t total_ic,
400 cell_asic *ic
401 )
402 {
403 LTC681x_run_gpio_openwire(total_ic, ic);
404 }
405
406 /* Helper function to set discharge bit in CFG register */
407 void LTC6812_set_discharge(int Cell, uint8_t total_ic, cell_asic *ic)
408 {
409 for (int i=0; i<total_ic; i++)
410 {
411 if (Cell==0)
412 {
413 ic[i].configb.tx_data[1] = ic[i].configb.tx_data[1] |(0x04);
414 }
415 else if (Cell<9)
416 {
417 ic[i].config.tx_data[4] = ic[i].config.tx_data[4] | (1<<(Cell-1));
418 }
419 else if (Cell < 13)
420 {
421 ic[i].config.tx_data[5] = ic[i].config.tx_data[5] | (1<<(Cell-9));
422 }
423 else if (Cell<16)
424 {
425 ic[i].configb.tx_data[0] = ic[i].configb.tx_data[0] | (1<<(Cell-9));
426 }
427 else
428 {
429 break;
430 }
431 }
432 }
433
434 /* Clears all of the DCC bits in the configuration registers */
435 void LTC6812_clear_discharge(uint8_t total_ic, //Number of ICs in the system
436 cell_asic *ic //A two dimensional array of the data
437 )
438 {
439 LTC681x_clear_discharge(total_ic,ic);
440
441 }
442
443 /* Writes the pwm registers of a LTC6812 daisy chain */
444 void LTC6812_wrpwm(uint8_t total_ic, //The number of ICs being written to
445 uint8_t pwmReg, // Register Select
446 cell_asic *ic //A two dimensional array of the data that will be written
447 )
448 {
449 LTC681x_wrpwm(total_ic,pwmReg,ic);
450 }
451
452 /* Reads pwm registers of a LTC6812 daisy chain */
453 int8_t LTC6812_rdpwm(uint8_t total_ic, //Number of ICs in the system
454 uint8_t pwmReg, //Register Select
455 cell_asic *ic //A two dimensional array that the function stores the read data.
456 )
457 {
458 int8_t pec_error =0;
459 pec_error = LTC681x_rdpwm(total_ic,pwmReg,ic);
460 return(pec_error);
461 }
462
463 /* Writes data in S control register the LTC6812-1s connected in a daisy chain stack. */
464 void LTC6812_wrsctrl(uint8_t total_ic, //Number of ICs in the daisy chain
465 uint8_t sctrl_reg, //Register Select
466 cell_asic *ic //A two dimensional array of the data that will be written
467 )
468 {
469 LTC681x_wrsctrl(total_ic, sctrl_reg, ic);
470 }
471
472 /* Reads sctrl registers of a LTC6812 daisy chain */
473 int8_t LTC6812_rdsctrl(uint8_t total_ic, //Number of ICs in the daisy chain
474 uint8_t sctrl_reg, //Register Select
475 cell_asic *ic //A two dimensional array that the function stores the read data
476 )
477 {
478 LTC681x_rdsctrl( total_ic, sctrl_reg,ic ) ;
479 }
480
481 /* Start Sctrl data communication
482 This command will start the sctrl pulse communication over the spins
483 */
484 void LTC6812_stsctrl()
485 {
486 LTC681x_stsctrl();
487 }
488
489 /*
490 The command clears the Sctrl registers and initializes
491 all values to 0. The register will read back hexadecimal 0x00
492 after the command is sent.
493 */
494 void LTC6812_clrsctrl()
495 {
496 LTC681x_clrsctrl();
497 }
498
499 /* Write the 6812 PWM/Sctrl Register B */
500 void LTC6812_wrpsb(uint8_t total_ic, //Number of ICs in the daisy chain
501 cell_asic *ic //A two dimensional array of the data that will be written
502 )
503 {
504 uint8_t cmd[2];
505 uint8_t write_buffer[256];
506 uint8_t c_ic = 0;
507
508 cmd[0] = 0x00;
509 cmd[1] = 0x1C;
510 for(uint8_t current_ic = 0; current_ic<total_ic;current_ic++)
511 {
512 if(ic->isospi_reverse == true){c_ic = current_ic;}
513 else{c_ic = total_ic - current_ic - 1;}
514
515 write_buffer[0] = ic[c_ic].pwmb.tx_data[0];
516 write_buffer[1] = ic[c_ic].pwmb.tx_data[1]&(0x0F);
517 write_buffer[2]= 0x00;
518 write_buffer[3] = ic[c_ic].sctrlb.tx_data[3];
519 write_buffer[4] = ic[c_ic].sctrlb.tx_data[4]&(0x0F);
520 write_buffer[5]= 0x00;
521 }
522 write_68(total_ic, cmd, write_buffer);
523 }
524
525 /* Reading 6812 PWM/Sctrl Register B */
526 int8_t LTC6812_rdpsb(uint8_t total_ic, //Number of ICs in the daisy chain
527 cell_asic *ic //A two dimensional array that the function stores the read data
528 )
529 {
530 uint8_t cmd[4];
531 uint8_t read_buffer[256];
532 int8_t pec_error = 0;
533 uint16_t data_pec;
534 uint16_t calc_pec;
535 uint8_t c_ic = 0;
536
537
538 cmd[0] = 0x00;
539 cmd[1] = 0x1E;
540
541
542 pec_error = read_68(total_ic, cmd, read_buffer);
543
544 for(uint8_t current_ic =0; current_ic<total_ic; current_ic++)
545 {
546 if(ic->isospi_reverse == false){c_ic = current_ic;}
547 else{c_ic = total_ic - current_ic - 1;}
548
549 for(int byte=0; byte<3;byte++)
550 {
551 ic[c_ic].pwmb.rx_data[byte] = read_buffer[byte+(8*current_ic)];
552 }
553 for(int byte=3; byte<6;byte++)
554 {
555 ic[c_ic].sctrlb.rx_data[byte] = read_buffer[byte+(8*current_ic)];
556 }
557 for(int byte=6; byte<8;byte++)
558 {
559 ic[c_ic].pwmb.rx_data[byte] = read_buffer[byte+(8*current_ic)];
560 ic[c_ic].sctrlb.rx_data[byte] = read_buffer[byte+(8*current_ic)];
561 }
562
563 calc_pec = pec15_calc(6,&read_buffer[8*current_ic]);
564 data_pec = read_buffer[7+(8*current_ic)] | (read_buffer[6+(8*current_ic)]<<8);
565 if(calc_pec != data_pec )
566 {
567 ic[c_ic].pwmb.rx_pec_match = 1;
568 ic[c_ic].sctrlb.rx_pec_match = 1;
569 }
570 else
571 {
572 ic[c_ic].pwmb.rx_pec_match = 0;
573 ic[c_ic].sctrlb.rx_pec_match = 0;
574 }
575 }
576 return(pec_error);
577 }
578
579 /* Writes the COMM registers of a LTC6812 daisy chain */
580 void LTC6812_wrcomm(uint8_t total_ic, //The number of ICs being written to
581 cell_asic *ic //A two dimensional array of the comm data that will be written
582 )
583 {
584 LTC681x_wrcomm(total_ic,ic);
585 }
586
587 /* Reads COMM registers of a LTC6812 daisy chain */
588 int8_t LTC6812_rdcomm(uint8_t total_ic, //Number of ICs in the system
589 cell_asic *ic //A two dimensional array that the function stores the read data.
590 )
591 {
592 int8_t pec_error = 0;
593 LTC681x_rdcomm(total_ic, ic);
594 return(pec_error);
595 }
596
597 /* Shifts data in COMM register out over LTC6812 SPI/I2C port */
598 void LTC6812_stcomm(uint8_t len) //Length of data to be transmitted
599 {
600 LTC681x_stcomm(len);
601 }
602
603 /* Mutes the LTC6812 discharge transistors */
604 void LTC6812_mute()
605 {
606 uint8_t cmd[2];
607
608 cmd[0] = 0x00;
609 cmd[1] = 0x28;
610 cmd_68(cmd);
611 }
612
613 /* Clears the LTC6812 Mute Discharge */
614 void LTC6812_unmute()
615 {
616 uint8_t cmd[2];
617
618 cmd[0] = 0x00;
619 cmd[1] = 0x29;
620 cmd_68(cmd);
621 }
622
623 /* Helper function that increments PEC counters */
624 void LTC6812_check_pec(uint8_t total_ic,uint8_t reg, cell_asic *ic)
625 {
626 LTC681x_check_pec(total_ic,reg,ic);
627 }
628
629 /* Helper Function to reset PEC counters */
630 void LTC6812_reset_crc_count(uint8_t total_ic, cell_asic *ic)
631 {
632 LTC681x_reset_crc_count(total_ic,ic);
633 }
634
635 /* Helper function to initialize CFG variables */
636 void LTC6812_init_cfg(uint8_t total_ic, cell_asic *ic)
637 {
638 LTC681x_init_cfg(total_ic,ic);
639 }
640 /* Helper function to set CFGR variable */
641 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)
642 {
643 LTC681x_set_cfgr_refon(nIC,ic,refon);
644 LTC681x_set_cfgr_adcopt(nIC,ic,adcopt);
645 LTC681x_set_cfgr_gpio(nIC,ic,gpio);
646 LTC681x_set_cfgr_dis(nIC,ic,dcc);
647 LTC681x_set_cfgr_dcto(nIC,ic,dcto);
648 LTC681x_set_cfgr_uv(nIC, ic, uv);
649 LTC681x_set_cfgr_ov(nIC, ic, ov);
650 }
651 /* Helper function to set the REFON bit */
652 void LTC6812_set_cfgr_refon(uint8_t nIC, cell_asic *ic, bool refon)
653 {
654 LTC681x_set_cfgr_refon(nIC,ic,refon);
655 }
656 /* Helper function to set the adcopt bit */
657 void LTC6812_set_cfgr_adcopt(uint8_t nIC, cell_asic *ic, bool adcopt)
658 {
659 LTC681x_set_cfgr_adcopt(nIC,ic,adcopt);
660 }
661 /* Helper function to set GPIO bits */
662 void LTC6812_set_cfgr_gpio(uint8_t nIC, cell_asic *ic,bool gpio[5])
663 {
664 LTC681x_set_cfgr_gpio(nIC,ic,gpio);
665 }
666 /* Helper function to control discharge */
667 void LTC6812_set_cfgr_dis(uint8_t nIC, cell_asic *ic,bool dcc[12])
668 {
669 LTC681x_set_cfgr_dis(nIC,ic,dcc);
670 }
671 /* Helper Function to set dcto value in CFG register */
672 void LTC6812_set_cfgr_dcto(uint8_t nIC, cell_asic *ic,bool dcto[4])
673 {
674 LTC681x_set_cfgr_dcto(nIC, ic, dcto);
675 }
676 /* Helper Function to set uv value in CFG register */
677 void LTC6812_set_cfgr_uv(uint8_t nIC, cell_asic *ic,uint16_t uv)
678 {
679 LTC681x_set_cfgr_uv(nIC, ic, uv);
680 }
681 /* Helper function to set OV value in CFG register */
682 void LTC6812_set_cfgr_ov(uint8_t nIC, cell_asic *ic,uint16_t ov)
683 {
684 LTC681x_set_cfgr_ov( nIC, ic, ov);
685 }
686
687 /* Helper Function to initialize the CFGRB data structures */
688 void LTC6812_init_cfgb(uint8_t total_ic, cell_asic *ic)
689 {
690 for (uint8_t current_ic = 0; current_ic<total_ic;current_ic++)
691 {
692 for(int j =0; j<6;j++)
693 {
694 ic[current_ic].configb.tx_data[j] = 0;
695 }
696 }
697 }
698
699 /* Helper Function to set the configuration register B */
700 void LTC6812_set_cfgrb(uint8_t nIC, cell_asic *ic,bool fdrf,bool dtmen,bool ps[2],bool gpiobits[4],bool dccbits[4])
701 {
702 LTC6812_set_cfgrb_fdrf(nIC,ic,fdrf);
703 LTC6812_set_cfgrb_dtmen(nIC,ic,dtmen);
704 LTC6812_set_cfgrb_ps(nIC,ic,ps);
705 LTC6812_set_cfgrb_gpio_b(nIC,ic,gpiobits);
706 LTC6812_set_cfgrb_dcc_b(nIC,ic,dccbits);
707 }
708
709 /* Helper function to set the FDRF bit */
710 void LTC6812_set_cfgrb_fdrf(uint8_t nIC, cell_asic *ic, bool fdrf)
711 {
712 if(fdrf) ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]|0x40;
713 else ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]&0xBF;
714 }
715
716 /* Helper function to set the DTMEN bit */
717 void LTC6812_set_cfgrb_dtmen(uint8_t nIC, cell_asic *ic, bool dtmen)
718 {
719 if(dtmen) ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]|0x08;
720 else ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]&0xF7;
721 }
722
723 /* Helper function to set the PATH SELECT bit */
724 void LTC6812_set_cfgrb_ps(uint8_t nIC, cell_asic *ic, bool ps[])
725 {
726 for(int i =0;i<2;i++)
727 {
728 if(ps[i])ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]|(0x01<<(i+4));
729 else ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]&(~(0x01<<(i+4)));
730 }
731 }
732
733 /* Helper function to set the gpio bits in config b register */
734 void LTC6812_set_cfgrb_gpio_b(uint8_t nIC, cell_asic *ic, bool gpiobits[])
735 {
736 for(int i =0;i<4;i++)
737 {
738 if(gpiobits[i])ic[nIC].configb.tx_data[0] = ic[nIC].configb.tx_data[0]|(0x01<<i);
739 else ic[nIC].configb.tx_data[0] = ic[nIC].configb.tx_data[0]&(~(0x01<<i));
740 }
741 }
742
743 /* Helper function to set the dcc bits in config b register */
744 void LTC6812_set_cfgrb_dcc_b(uint8_t nIC, cell_asic *ic, bool dccbits[])
745 {
746
747 for(int i =0;i<4;i++)
748 {
749 if(i==0)
750 {
751 if(dccbits[i])ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]|0x04;
752 else ic[nIC].configb.tx_data[1] = ic[nIC].configb.tx_data[1]&0xFB;
753 }
754 else
755 {
756 if(dccbits[i])ic[nIC].configb.tx_data[0] = ic[nIC].configb.tx_data[0]|(0x01<<(i+3));
757 else ic[nIC].configb.tx_data[0] = ic[nIC].configb.tx_data[0]&(~(0x01<<(i+3)));
758 }
759
760 }
761 }
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_adstatd
void LTC6812_adstatd(uint8_t MD, uint8_t CHST)
Start a Status register redundancy test Conversion.
Definition: LTC6812.cpp:302
LTC6812_wrcfg
void LTC6812_wrcfg(uint8_t total_ic, cell_asic *ic)
Write the LTC6812 configuration register.
Definition: LTC6812.cpp:88
LTC681x_adaxd
void LTC681x_adaxd(uint8_t MD, uint8_t CHG)
Start an GPIO Redundancy test.
Definition: LTC681x.cpp:1038
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.
LTC6812_adstat
void LTC6812_adstat(uint8_t MD, uint8_t CHST)
Start a Status ADC Conversion.
Definition: LTC6812.cpp:145
cell_asic::configb
ic_register configb
Definition: LTC681x.h:173
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
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
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
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_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_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.h
LTC6812: Multicell Battery Monitors.
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_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
LTC681x_wrpwm
void LTC681x_wrpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic ic[])
Definition: LTC681x.cpp:1696
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
cell_asic::sctrlb
ic_register sctrlb
Definition: LTC681x.h:181
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
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
ic_register::rx_data
uint8_t rx_data[8]
Stores received data.
Definition: LTC681x.h:144
LTC681x_axow
void LTC681x_axow(uint8_t MD, uint8_t PUP)
Start GPIOs open wire ADC conversion.
Definition: LTC681x.cpp:1310
LTC681x_clrcell
void LTC681x_clrcell()
Clears the LTC681x Cell voltage registers The command clears the cell voltage registers and initializ...
Definition: LTC681x.cpp:937
LTC681x_statst
void LTC681x_statst(uint8_t MD, uint8_t ST)
Start a Status Register Self Test Conversion.
Definition: LTC681x.cpp:1006
LTC681x_rdcfgb
int8_t LTC681x_rdcfgb(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:307
LTC6812_pladc
uint8_t LTC6812_pladc()
Sends the poll ADC command.
Definition: LTC6812.cpp:213
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
LTC6812_unmute
void LTC6812_unmute()
Clears the LTC6812 Mute Discharge.
Definition: LTC6812.cpp:614
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_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_axow
void LTC6812_axow(uint8_t MD, uint8_t PUP)
Start GPIOs open wire ADC conversion.
Definition: LTC6812.cpp:379
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
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
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
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
LTC6812_set_cfgr_dis
void LTC6812_set_cfgr_dis(uint8_t nIC, cell_asic *ic, bool dcc[12])
Definition: LTC6812.cpp:667
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_adcvsc
void LTC6812_adcvsc(uint8_t MD, uint8_t DCP)
Starts cell voltage and SOC conversion.
Definition: LTC6812.cpp:153
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_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
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
LTC681x_run_gpio_openwire
void LTC681x_run_gpio_openwire(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1590
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
LTC6812_init_reg_limits
void LTC6812_init_reg_limits(uint8_t total_ic, cell_asic *ic)
Initialize the Register limits.
Definition: LTC6812.cpp:68
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
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
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_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_clrsctrl
void LTC6812_clrsctrl()
Clears the LTC6812 Sctrl registers.
Definition: LTC6812.cpp:494
LTC6812_pollAdc
uint32_t LTC6812_pollAdc()
This function will block operation until the ADC has finished it&#39;s conversion.
Definition: LTC6812.cpp:219
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
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_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_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
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
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
wakeup_idle
void wakeup_idle()
Definition: LTC68041.cpp:957
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
LTC6812_wrpwm
void LTC6812_wrpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
Write the LTC6812 PWM register.
Definition: LTC6812.cpp:444
LTC681x_pladc
uint8_t LTC681x_pladc()
Sends the poll ADC command.
Definition: LTC681x.cpp:878
read_68
int8_t read_68(uint8_t total_ic, uint8_t tx_cmd[2], uint8_t *rx_data)
Issues a command onto the daisy chain and reads back 6*total_ic data in the rx_data array...
Definition: LTC681x.cpp:140
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
register_cfg::cell_channels
uint8_t cell_channels
Number of Cell channels.
Definition: LTC681x.h:161
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
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
LTC6812_clrcell
void LTC6812_clrcell()
Clears the LTC6812 cell voltage registers.
Definition: LTC6812.cpp:229
LTC6812_adcvax
void LTC6812_adcvax(uint8_t MD, uint8_t DCP)
Starts cell voltage and GPIO 1&2 conversion.
Definition: LTC6812.cpp:161
LTC6812_adax
void LTC6812_adax(uint8_t MD, uint8_t CHG)
Start a GPIO and Vref2 Conversion.
Definition: LTC6812.cpp:137
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
LTC681x_set_cfgr_dcto
void LTC681x_set_cfgr_dcto(uint8_t nIC, cell_asic *ic, bool dcto[4])
Definition: LTC681x.cpp:2158
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_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
cmd_68
void cmd_68(uint8_t tx_cmd[2])
Sends a command to the BMS IC.
Definition: LTC681x.cpp:77
pec15_calc
uint16_t pec15_calc(uint8_t len, uint8_t *data)
Definition: LTC68041.cpp:985
LTC681x_rdpwm
int8_t LTC681x_rdpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic ic[])
Definition: LTC681x.cpp:1738
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_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
ic_register::rx_pec_match
uint8_t rx_pec_match
If a PEC error was detected during most recent read cmd.
Definition: LTC681x.h:145
LTC6812_cvst
void LTC6812_cvst(uint8_t MD, uint8_t ST)
Starts cell voltage self test conversion.
Definition: LTC6812.cpp:262
LTC6812_set_cfgr_gpio
void LTC6812_set_cfgr_gpio(uint8_t nIC, cell_asic *ic, bool gpio[5])
Definition: LTC6812.cpp:662
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_adol
void LTC6812_adol(uint8_t MD, uint8_t DCP)
Starts Cell voltage overlap conversion.
Definition: LTC6812.cpp:286
cell_asic::config
ic_register config
Definition: LTC681x.h:172
LTC681x_rdcomm
int8_t LTC681x_rdcomm(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1936
MD_7KHZ_3KHZ
#define MD_7KHZ_3KHZ
Definition: LTC681x.h:63
LTC6812_mute
void LTC6812_mute()
Mutes the LTC6812 discharge transistors.
Definition: LTC6812.cpp:604
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_rdpsb
int8_t LTC6812_rdpsb(uint8_t total_ic, cell_asic *ic)
Reading pwm/s control register b.
Definition: LTC6812.cpp:526
cv::c_codes
uint16_t c_codes[18]
Cell Voltage Codes.
Definition: LTC681x.h:119
LTC6812_axst
void LTC6812_axst(uint8_t MD, uint8_t ST)
Start an Auxiliary Register Self Test Conversion.
Definition: LTC6812.cpp:270
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
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
LTC681x_rdcfg
int8_t LTC681x_rdcfg(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:264
LTC6812_wrcfgb
void LTC6812_wrcfgb(uint8_t total_ic, cell_asic *ic)
Write the LTC6812 configuration register B.
Definition: LTC6812.cpp:100
LTC6812_clraux
void LTC6812_clraux()
Clears the LTC6812 Auxiliary registers.
Definition: LTC6812.cpp:239
DCP_DISABLED
#define DCP_DISABLED
Definition: LTC68041.h:183
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
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
LTC6812_adaxd
void LTC6812_adaxd(uint8_t MD, uint8_t CHG)
Start an GPIO Redundancy test.
Definition: LTC6812.cpp:294
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
LTC6812_clrstat
void LTC6812_clrstat()
Clears the LTC6812 Stat registers.
Definition: LTC6812.cpp:250
i
static int i
Definition: DC2430A.ino:184
LTC6812_wrcomm
void LTC6812_wrcomm(uint8_t total_ic, cell_asic *ic)
Write the LTC6812 COMM register.
Definition: LTC6812.cpp:580
LTC681x_run_openwire_multi
void LTC681x_run_openwire_multi(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1416
cell_asic::cells
cv cells
Definition: LTC681x.h:174
LTC681x_run_openwire_single
void LTC681x_run_openwire_single(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:1326
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_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
LTC681x_set_cfgr_dis
void LTC681x_set_cfgr_dis(uint8_t nIC, cell_asic *ic, bool dcc[12])
Definition: LTC681x.cpp:2143
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
register_cfg::aux_channels
uint8_t aux_channels
Number of Aux channels.
Definition: LTC681x.h:163
LTC6812_adcv
void LTC6812_adcv(uint8_t MD, uint8_t DCP, uint8_t CH)
Starts cell voltage conversion.
Definition: LTC6812.cpp:128
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
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
LTC6812_statst
void LTC6812_statst(uint8_t MD, uint8_t ST)
Start a Status Register Self Test Conversion.
Definition: LTC6812.cpp:278
LTC6812_wrpsb
void LTC6812_wrpsb(uint8_t total_ic, cell_asic *ic)
Write the 6812 PWM/Sctrl Register B.
Definition: LTC6812.cpp:500
cell_asic::pwmb
ic_register pwmb
Definition: LTC681x.h:179
cell_asic::isospi_reverse
bool isospi_reverse
Definition: LTC681x.h:183
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
LTC681x_wrcfgb
void LTC681x_wrcfgb(uint8_t total_ic, cell_asic ic[])
Definition: LTC681x.cpp:234
write_68
void write_68(uint8_t total_ic, uint8_t tx_cmd[2], uint8_t data[])
Writes an array of data to the daisy chain.
Definition: LTC681x.cpp:98