Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board

LTC6812: Multicell Battery Monitors. More...

Detailed Description

LTC6812: Multicell Battery Monitors.

*The LTC6812 is multicell battery stack monitor that measures up to 15 series 
*connected battery cells with a total measurement error of less than 2.2mV. 
*The cell measurement range of 0V to 5V makes the LTC6812 suitable for most 
*battery chemistries. All 15 cell voltages can be captured in 245uS, and lower 
*data acquisition rates can be selected for high noise reduction.
*Using the LTC6812-1, multiple devices are connected in a daisy-chain with one 
*host processor connection for all devices, permitting simultaneous cell monitoring 
*of long, high voltage battery strings.
*

https://www.analog.com/en/products/ltc6812-1.html The schematic of DC2350A : https://www.analog.com/media/en/technical-documentation/eval-board-schematic/DC2350A-4-SCH.PDF ( Ensure that you modify the DC2350A board as mentioned on the schematic to work for LTC6812 (DC2350A-A) )

Copyright 2019(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  • The use of this software may or may not infringe the patent rights of one or more patent holders. This license does not release you from the requirement that you obtain separate licenses from these patent holders to use this software.
  • Use of the software either in source or binary form, must be run on or directly connected to an Analog Devices Inc. component.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Library Header for LTC6812-1 Multicell Battery Monitor

Definition in file LTC6812.h.

Go to the source code of this file.

Functions

void LTC6812_init_reg_limits (uint8_t total_ic, cell_asic *ic)
 Initialize the Register limits. More...
 
void LTC6812_wrcfg (uint8_t total_ic, cell_asic *ic)
 Write the LTC6812 configuration register. More...
 
void LTC6812_wrcfgb (uint8_t total_ic, cell_asic *ic)
 Write the LTC6812 configuration register B. More...
 
int8_t LTC6812_rdcfg (uint8_t total_ic, cell_asic *ic)
 Reads configuration registers of a LTC6812 daisy chain. More...
 
int8_t LTC6812_rdcfgb (uint8_t total_ic, cell_asic *ic)
 Reads configuration registers of a LTC6812 daisy chain. More...
 
void LTC6812_adcv (uint8_t MD, uint8_t DCP, uint8_t CH)
 Starts cell voltage conversion. More...
 
void LTC6812_adax (uint8_t MD, uint8_t CHG)
 Start a GPIO and Vref2 Conversion. More...
 
void LTC6812_adstat (uint8_t MD, uint8_t CHST)
 Start a Status ADC Conversion. More...
 
void LTC6812_adcvax (uint8_t MD, uint8_t DCP)
 Starts cell voltage and GPIO 1&2 conversion. More...
 
void LTC6812_adcvsc (uint8_t MD, uint8_t DCP)
 Starts cell voltage and SOC conversion. More...
 
uint8_t LTC6812_rdcv (uint8_t reg, uint8_t total_ic, cell_asic *ic)
 Reads and parses the LTC6812 cell voltage registers. More...
 
int8_t LTC6812_rdaux (uint8_t reg, uint8_t total_ic, cell_asic *ic)
 Reads and parses the LTC6812 auxiliary registers. More...
 
int8_t LTC6812_rdstat (uint8_t reg, uint8_t total_ic, cell_asic *ic)
 Reads and parses the LTC6812 stat registers. More...
 
uint8_t LTC6812_pladc ()
 Sends the poll ADC command. More...
 
uint32_t LTC6812_pollAdc ()
 This function will block operation until the ADC has finished it's conversion. More...
 
void LTC6812_clrcell ()
 Clears the LTC6812 cell voltage registers. More...
 
void LTC6812_clraux ()
 Clears the LTC6812 Auxiliary registers. More...
 
void LTC6812_clrstat ()
 Clears the LTC6812 Stat registers. More...
 
void LTC6812_diagn ()
 Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnostic Self Test. More...
 
void LTC6812_cvst (uint8_t MD, uint8_t ST)
 Starts cell voltage self test conversion. More...
 
void LTC6812_axst (uint8_t MD, uint8_t ST)
 Start an Auxiliary Register Self Test Conversion. More...
 
void LTC6812_statst (uint8_t MD, uint8_t ST)
 Start a Status Register Self Test Conversion. More...
 
void LTC6812_adol (uint8_t MD, uint8_t DCP)
 Starts Cell voltage overlap conversion. More...
 
void LTC6812_adaxd (uint8_t MD, uint8_t CHG)
 Start an GPIO Redundancy test. More...
 
void LTC6812_adstatd (uint8_t MD, uint8_t CHST)
 Start a Status register redundancy test Conversion. More...
 
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. More...
 
uint16_t LTC6812_run_adc_overlap (uint8_t total_ic, cell_asic *ic)
 Helper Function that runs the ADC Overlap test. More...
 
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. More...
 
void LTC6812_adow (uint8_t MD, uint8_t PUP, uint8_t CH, uint8_t DCP)
 Start an open wire Conversion. More...
 
void LTC6812_axow (uint8_t MD, uint8_t PUP)
 Start GPIOs open wire ADC conversion. More...
 
void LTC6812_run_openwire_single (uint8_t total_ic, cell_asic *ic)
 Runs the data sheet algorithm for open wire for single cell detection. More...
 
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. More...
 
void LTC6812_run_gpio_openwire (uint8_t total_ic, cell_asic *ic)
 Runs open wire for GPIOs. More...
 
void LTC6812_set_discharge (int Cell, uint8_t total_ic, cell_asic *ic)
 Helper function to set discharge bit in CFG register. More...
 
void LTC6812_clear_discharge (uint8_t total_ic, cell_asic *ic)
 Clears all of the DCC bits in the configuration registers. More...
 
void LTC6812_wrpwm (uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
 Write the LTC6812 PWM register. More...
 
int8_t LTC6812_rdpwm (uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
 Reads pwm registers of a LTC6811 daisy chain. More...
 
void LTC6812_wrsctrl (uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
 Write the LTC6812 Sctrl register. More...
 
int8_t LTC6812_rdsctrl (uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
 Reads sctrl registers of a LTC6812 daisy chain. More...
 
void LTC6812_stsctrl ()
 Start Sctrl data communication This command will start the sctrl pulse communication over the spins. More...
 
void LTC6812_clrsctrl ()
 Clears the LTC6812 Sctrl registers. More...
 
void LTC6812_wrpsb (uint8_t total_ic, cell_asic *ic)
 Write the 6812 PWM/Sctrl Register B. More...
 
int8_t LTC6812_rdpsb (uint8_t total_ic, cell_asic *ic)
 Reading pwm/s control register b. More...
 
void LTC6812_wrcomm (uint8_t total_ic, cell_asic *ic)
 Write the LTC6812 COMM register. More...
 
int8_t LTC6812_rdcomm (uint8_t total_ic, cell_asic *ic)
 Reads comm registers of a LTC6812 daisy chain. More...
 
void LTC6812_stcomm (uint8_t len)
 Issues a stcomm command and clocks data out of the COMM register. More...
 
void LTC6812_mute ()
 Mutes the LTC6812 discharge transistors. More...
 
void LTC6812_unmute ()
 Clears the LTC6812 Mute Discharge. More...
 
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. More...
 
void LTC6812_reset_crc_count (uint8_t total_ic, cell_asic *ic)
 Helper Function that resets the PEC error counters. More...
 
void LTC6812_init_cfg (uint8_t total_ic, cell_asic *ic)
 Helper Function to initialize the CFGR data structures. More...
 
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. More...
 
void LTC6812_set_cfgr_refon (uint8_t nIC, cell_asic *ic, bool refon)
 Helper function to turn the refon bit HIGH or LOW. More...
 
void LTC6812_set_cfgr_adcopt (uint8_t nIC, cell_asic *ic, bool adcopt)
 Helper function to turn the ADCOPT bit HIGH or LOW. More...
 
void LTC6812_set_cfgr_gpio (uint8_t nIC, cell_asic *ic, bool gpio[])
 Helper function to turn the GPIO bits HIGH or LOW. More...
 
void LTC6812_set_cfgr_dis (uint8_t nIC, cell_asic *ic, bool dcc[])
 Helper function to turn the DCC bits HIGH or LOW. More...
 
void LTC6812_set_cfgr_dcto (uint8_t nIC, cell_asic *ic, bool dcto[4])
 Helper Function to set dcto value in CFG register. More...
 
void LTC6812_set_cfgr_uv (uint8_t nIC, cell_asic *ic, uint16_t uv)
 Helper function to set uv field in CFGRA register. More...
 
void LTC6812_set_cfgr_ov (uint8_t nIC, cell_asic *ic, uint16_t ov)
 Helper function to set OV field in CFGRA register. More...
 
void LTC6812_init_cfgb (uint8_t total_ic, cell_asic *ic)
 Helper Function to initialize the CFGR B data structures. More...
 
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. More...
 
void LTC6812_set_cfgrb_fdrf (uint8_t nIC, cell_asic *ic, bool fdrf)
 Helper function to turn the FDRF bit HIGH or LOW. More...
 
void LTC6812_set_cfgrb_dtmen (uint8_t nIC, cell_asic *ic, bool dtmen)
 Helper function to turn the DTMEN bit HIGH or LOW. More...
 
void LTC6812_set_cfgrb_ps (uint8_t nIC, cell_asic *ic, bool ps[])
 Helper function to turn the Path Select bit HIGH or LOW. More...
 
void LTC6812_set_cfgrb_gpio_b (uint8_t nIC, cell_asic *ic, bool gpiobits[])
 Helper function to turn the GPIO bit HIGH or LOW. More...
 
void LTC6812_set_cfgrb_dcc_b (uint8_t nIC, cell_asic *ic, bool dccbits[])
 Helper function to turn the DCC bit HIGH or LOW. More...
 

Macros

#define CELL   1
 
#define AUX   2
 
#define STAT   3
 

Function Documentation

◆ LTC6812_adax()

void LTC6812_adax ( uint8_t  MD,
uint8_t  CHG 
)

Start a GPIO and Vref2 Conversion.

Returns
void
Parameters
MDADC Conversion Mode
CHGSets which GPIO channels are converted

Definition at line 137 of file LTC6812.cpp.

◆ LTC6812_adaxd()

void LTC6812_adaxd ( uint8_t  MD,
uint8_t  CHG 
)

Start an GPIO Redundancy test.

Returns
void
Parameters
MDADC Conversion Mode
CHGSets which GPIO channels are converted

Definition at line 294 of file LTC6812.cpp.

◆ LTC6812_adcv()

void LTC6812_adcv ( uint8_t  MD,
uint8_t  DCP,
uint8_t  CH 
)

Starts cell voltage conversion.

Returns
void
Parameters
MDADC Conversion Mode
DCPControls if Discharge is permitted during conversion
CHSets which Cell channels are converted

Definition at line 128 of file LTC6812.cpp.

◆ LTC6812_adcvax()

void LTC6812_adcvax ( uint8_t  MD,
uint8_t  DCP 
)

Starts cell voltage and GPIO 1&2 conversion.

Returns
void
Parameters
MDADC Conversion Mode
DCPControls if Discharge is permitted during conversion

Definition at line 161 of file LTC6812.cpp.

◆ LTC6812_adcvsc()

void LTC6812_adcvsc ( uint8_t  MD,
uint8_t  DCP 
)

Starts cell voltage and SOC conversion.

Returns
void
Parameters
MDADC Conversion Mode
DCPControls if Discharge is permitted during conversion

Definition at line 153 of file LTC6812.cpp.

◆ LTC6812_adol()

void LTC6812_adol ( uint8_t  MD,
uint8_t  DCP 
)

Starts Cell voltage overlap conversion.

Returns
void
Parameters
MDADC Conversion Mode
DCPDischarge permitted during conversion

Definition at line 286 of file LTC6812.cpp.

◆ LTC6812_adow()

void LTC6812_adow ( uint8_t  MD,
uint8_t  PUP,
uint8_t  CH,
uint8_t  DCP 
)

Start an open wire Conversion.

Returns
void
Parameters
MDADC Conversion Mode
PUPPull up/Pull down current
CHSets which Cell channels are converted
DCPDischarge permitted during conversion

Definition at line 369 of file LTC6812.cpp.

◆ LTC6812_adstat()

void LTC6812_adstat ( uint8_t  MD,
uint8_t  CHST 
)

Start a Status ADC Conversion.

Returns
void
Parameters
MDADC Conversion Mode
CHSTSets which Stat channels are converted

Definition at line 145 of file LTC6812.cpp.

◆ LTC6812_adstatd()

void LTC6812_adstatd ( uint8_t  MD,
uint8_t  CHST 
)

Start a Status register redundancy test Conversion.

Returns
void
Parameters
MDADC Mode
CHSTSets which Status channels are converted

Definition at line 302 of file LTC6812.cpp.

◆ LTC6812_axow()

void LTC6812_axow ( uint8_t  MD,
uint8_t  PUP 
)

Start GPIOs open wire ADC conversion.

Returns
void
Parameters
MDADC Mode
PUPPull up/Pull down current

Definition at line 379 of file LTC6812.cpp.

◆ LTC6812_axst()

void LTC6812_axst ( uint8_t  MD,
uint8_t  ST 
)

Start an Auxiliary Register Self Test Conversion.

Returns
void
Parameters
MDADC Conversion Mode
STSets if self test 1 or 2 is run

Definition at line 270 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
regType of register
icA two dimensional array that will store the data

Definition at line 624 of file LTC6812.cpp.

◆ LTC6812_clear_discharge()

void LTC6812_clear_discharge ( uint8_t  total_ic,
cell_asic ic 
)

Clears all of the DCC bits in the configuration registers.

Returns
void
Parameters
total_icNumber of ICs in the system
icA two dimensional array that will store the data

Definition at line 435 of file LTC6812.cpp.

◆ LTC6812_clraux()

void LTC6812_clraux ( )

Clears the LTC6812 Auxiliary registers.

Returns
void

Definition at line 239 of file LTC6812.cpp.

◆ LTC6812_clrcell()

void LTC6812_clrcell ( )

Clears the LTC6812 cell voltage registers.

Returns
void

Definition at line 229 of file LTC6812.cpp.

◆ LTC6812_clrsctrl()

void LTC6812_clrsctrl ( )

Clears the LTC6812 Sctrl registers.

Returns
void

Definition at line 494 of file LTC6812.cpp.

◆ LTC6812_clrstat()

void LTC6812_clrstat ( )

Clears the LTC6812 Stat registers.

Returns
void

Definition at line 250 of file LTC6812.cpp.

◆ LTC6812_cvst()

void LTC6812_cvst ( uint8_t  MD,
uint8_t  ST 
)

Starts cell voltage self test conversion.

Returns
void
Parameters
MDADC Conversion Mode
STSets if self test 1 or 2 is run

Definition at line 262 of file LTC6812.cpp.

◆ LTC6812_diagn()

void LTC6812_diagn ( )

Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnostic Self Test.

This test takes roughly 1ms to complete. The MUXFAIL bit will be updated. The bit will be set to 1 for a failure and 0 if the test has been passed.

Returns
void

Definition at line 256 of file LTC6812.cpp.

◆ LTC6812_init_cfg()

void LTC6812_init_cfg ( uint8_t  total_ic,
cell_asic ic 
)

Helper Function to initialize the CFGR data structures.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 636 of file LTC6812.cpp.

◆ LTC6812_init_cfgb()

void LTC6812_init_cfgb ( uint8_t  total_ic,
cell_asic ic 
)

Helper Function to initialize the CFGR B data structures.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 688 of file LTC6812.cpp.

◆ LTC6812_init_reg_limits()

void LTC6812_init_reg_limits ( uint8_t  total_ic,
cell_asic ic 
)

Initialize the Register limits.

Returns
void
Parameters
total_icNumber of ICs in the system
icA two dimensional array that will store the data

Definition at line 68 of file LTC6812.cpp.

◆ LTC6812_mute()

void LTC6812_mute ( )

Mutes the LTC6812 discharge transistors.

Returns
void

Definition at line 604 of file LTC6812.cpp.

◆ LTC6812_pladc()

uint8_t LTC6812_pladc ( )

Sends the poll ADC command.

Returns
1 byte read back after a pladc command. If the byte is not 0xFF ADC conversion has completed

Definition at line 213 of file LTC6812.cpp.

◆ LTC6812_pollAdc()

uint32_t LTC6812_pollAdc ( )

This function will block operation until the ADC has finished it's conversion.

Returns
uint32_t, counter The approximate time it took for the ADC function to complete

Definition at line 219 of file LTC6812.cpp.

◆ LTC6812_rdaux()

int8_t LTC6812_rdaux ( uint8_t  reg,
uint8_t  total_ic,
cell_asic ic 
)

Reads and parses the LTC6812 auxiliary registers.

Returns
int8_t, pec_error PEC Status 0: No PEC error detected -1: PEC error detected, retry read
Parameters
regControls which GPIO voltage register is read back
total_icThe number of ICs in the daisy chain
icA two dimensional array of the parsed gpio voltage codes

Definition at line 186 of file LTC6812.cpp.

◆ LTC6812_rdcfg()

int8_t LTC6812_rdcfg ( uint8_t  total_ic,
cell_asic ic 
)

Reads configuration registers of a LTC6812 daisy chain.

Returns
int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that the function stores the read configuration data

Definition at line 108 of file LTC6812.cpp.

◆ LTC6812_rdcfgb()

int8_t LTC6812_rdcfgb ( uint8_t  total_ic,
cell_asic ic 
)

Reads configuration registers of a LTC6812 daisy chain.

Returns
int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that the function stores the read configuration data

Definition at line 118 of file LTC6812.cpp.

◆ LTC6812_rdcomm()

int8_t LTC6812_rdcomm ( uint8_t  total_ic,
cell_asic ic 
)

Reads comm registers of a LTC6812 daisy chain.

Returns
int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC
Parameters
total_icNumber of ICs in the daisy chain
icTwo dimensional array that the function stores the read comm data

Definition at line 588 of file LTC6812.cpp.

◆ LTC6812_rdcv()

uint8_t LTC6812_rdcv ( uint8_t  reg,
uint8_t  total_ic,
cell_asic ic 
)

Reads and parses the LTC6812 cell voltage registers.

Returns
uint8_t, pec_error PEC Status. 0: No PEC error detected -1: PEC error detected, retry read
Parameters
regControls which cell voltage register is read back
total_icThe number of ICs in the daisy chain
icArray of the parsed cell codes from lowest to highest

Definition at line 172 of file LTC6812.cpp.

◆ LTC6812_rdpsb()

int8_t LTC6812_rdpsb ( uint8_t  total_ic,
cell_asic ic 
)

Reading pwm/s control register b.

Returns
int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that the function stores the read data

Definition at line 526 of file LTC6812.cpp.

◆ LTC6812_rdpwm()

int8_t LTC6812_rdpwm ( uint8_t  total_ic,
uint8_t  pwmReg,
cell_asic ic 
)

Reads pwm registers of a LTC6811 daisy chain.

Returns
int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC
Parameters
total_icNumber of ICs in the daisy chain
pwmRegSelect register
icA two dimensional array that the function stores the read pwm data

Definition at line 453 of file LTC6812.cpp.

◆ 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.

Returns
int8_t, pec_error PEC Status. 0: Data read back has matching PEC -1: Data read back has incorrect PEC
Parameters
total_icNumber of ICs in the daisy chain
sctrl_regSelect register
icA two dimensional array that the function stores the read data

Definition at line 473 of file LTC6812.cpp.

◆ LTC6812_rdstat()

int8_t LTC6812_rdstat ( uint8_t  reg,
uint8_t  total_ic,
cell_asic ic 
)

Reads and parses the LTC6812 stat registers.

Returns
int8_t, pec_error PEC Status 0: No PEC error detected -1: PEC error detected, retry read
Parameters
regDetermines which Stat register is read back
total_icThe number of ICs in the system
icA two dimensional array that will store the data

Definition at line 202 of file LTC6812.cpp.

◆ LTC6812_reset_crc_count()

void LTC6812_reset_crc_count ( uint8_t  total_ic,
cell_asic ic 
)

Helper Function that resets the PEC error counters.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 630 of file LTC6812.cpp.

◆ 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.

Returns
uint16_t, error 0: Pass -1: False, Error detected
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 323 of file LTC6812.cpp.

◆ 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.

Returns
int16_t, error Number of errors detected.
Parameters
adc_modeADC Mode
adc_regType of register
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 357 of file LTC6812.cpp.

◆ 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.

Returns
int16_t, error Number of errors detected.
Parameters
adc_regType of register
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data
mdADC Mode
adcoptThe ADCOPT bit in the configuration register

Definition at line 310 of file LTC6812.cpp.

◆ LTC6812_run_gpio_openwire()

void LTC6812_run_gpio_openwire ( uint8_t  total_ic,
cell_asic ic 
)

Runs open wire for GPIOs.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 399 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 393 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 387 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
refonThe REFON bit
adcoptThe ADCOPT bit
gpioThe GPIO bits
dccThe DCC bits
dctoThe Dcto bits
uvThe UV value
ovThe OV value

Definition at line 641 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
adcoptThe ADCOPT bit

Definition at line 657 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
dctoThe Dcto bits

Definition at line 672 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
dccThe DCC bits

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
gpioThe GPIO bits

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
ovThe OV value

Definition at line 682 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
refonThe REFON bit

Definition at line 652 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
uvThe UV value

Definition at line 677 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
fdrfThe FDRF bit
dtmenThe DTMEN bit
psPath selection bits
gpiobitsThe GPIO bits
dccbitsThe DCC bits

Definition at line 700 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
dccbitsThe DCC bits

Definition at line 744 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
dtmenThe DTMEN bit

Definition at line 717 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
fdrfThe FDRF bit

Definition at line 710 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
gpiobitsThe GPIO bits

Definition at line 734 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
nICCurrent IC
icA two dimensional array that will store the data
psPath selection bits

Definition at line 724 of file LTC6812.cpp.

◆ 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.

Returns
void
Parameters
CellThe cell to be discharged
total_icNumber of ICs in the system
icA two dimensional array that will store the data

Definition at line 407 of file LTC6812.cpp.

◆ LTC6812_statst()

void LTC6812_statst ( uint8_t  MD,
uint8_t  ST 
)

Start a Status Register Self Test Conversion.

Returns
void
Parameters
MDADC Conversion Mode
STSets if self test 1 or 2 is run

Definition at line 278 of file LTC6812.cpp.

◆ LTC6812_stcomm()

void LTC6812_stcomm ( uint8_t  len)

Issues a stcomm command and clocks data out of the COMM register.

Returns
void

Definition at line 598 of file LTC6812.cpp.

◆ LTC6812_stsctrl()

void LTC6812_stsctrl ( )

Start Sctrl data communication This command will start the sctrl pulse communication over the spins.

Returns
void

Definition at line 484 of file LTC6812.cpp.

◆ LTC6812_unmute()

void LTC6812_unmute ( )

Clears the LTC6812 Mute Discharge.

Returns
void

Definition at line 614 of file LTC6812.cpp.

◆ LTC6812_wrcfg()

void LTC6812_wrcfg ( uint8_t  total_ic,
cell_asic ic 
)

Write the LTC6812 configuration register.

Returns
void
Parameters
total_icThe number of ICs being written
icA two dimensional array of the configuration data that will be written

Definition at line 88 of file LTC6812.cpp.

◆ LTC6812_wrcfgb()

void LTC6812_wrcfgb ( uint8_t  total_ic,
cell_asic ic 
)

Write the LTC6812 configuration register B.

Returns
void
Parameters
total_icThe number of ICs being written
icA two dimensional array of the configuration data that will be written

Definition at line 100 of file LTC6812.cpp.

◆ LTC6812_wrcomm()

void LTC6812_wrcomm ( uint8_t  total_ic,
cell_asic ic 
)

Write the LTC6812 COMM register.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array of the comm data that will be written

Definition at line 580 of file LTC6812.cpp.

◆ LTC6812_wrpsb()

void LTC6812_wrpsb ( uint8_t  total_ic,
cell_asic ic 
)

Write the 6812 PWM/Sctrl Register B.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
icA two dimensional array that will store the data

Definition at line 500 of file LTC6812.cpp.

◆ LTC6812_wrpwm()

void LTC6812_wrpwm ( uint8_t  total_ic,
uint8_t  pwmReg,
cell_asic ic 
)

Write the LTC6812 PWM register.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
pwmRegSelect register
ica two dimensional array that will store the data

Definition at line 444 of file LTC6812.cpp.

◆ LTC6812_wrsctrl()

void LTC6812_wrsctrl ( uint8_t  total_ic,
uint8_t  sctrl_reg,
cell_asic ic 
)

Write the LTC6812 Sctrl register.

Returns
void
Parameters
total_icNumber of ICs in the daisy chain
sctrl_regSelect register
icA two dimensional array that will store the data

Definition at line 464 of file LTC6812.cpp.

Macro Definition Documentation

◆ AUX

#define AUX   2

Definition at line 65 of file LTC6812.h.

◆ CELL

#define CELL   1

Definition at line 64 of file LTC6812.h.

◆ STAT

#define STAT   3

Definition at line 66 of file LTC6812.h.