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