70 for (uint8_t cic=0; cic<total_ic; cic++)
154 int8_t pec_error = 0;
169 int8_t pec_error = 0;
185 int8_t pec_error = 0;
350 for (
int i=0;
i<total_ic;
i++)
352 if ((Cell<9)&& (Cell!=0) )
446 int8_t pec_error = 0;
void LTC6811_reset_crc_count(uint8_t total_ic, cell_asic *ic)
Helper Function that resets the PEC error counters.
void LTC6811_clrsctrl()
Clears the LTC6811 Sctrl registers.
void LTC681x_adaxd(uint8_t MD, uint8_t CHG)
Start an GPIO Redundancy test.
int8_t LTC6811_rdsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Reads sctrl registers of a LTC6811 daisy chain.
void LTC681x_adcvax(uint8_t MD, uint8_t DCP)
Starts cell voltage and GPIO 1&2 conversion.
void LTC6811_set_cfgr_dcto(uint8_t nIC, cell_asic *ic, bool dcto[4])
void LTC681x_stcomm(uint8_t len)
Issues a stcomm command and clocks data out of the COMM register.
void LTC681x_adow(uint8_t MD, uint8_t PUP, uint8_t CH, uint8_t DCP)
Start an open wire Conversion.
void LTC681x_set_cfgr_gpio(uint8_t nIC, cell_asic *ic, bool gpio[5])
void LTC681x_diagn()
Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnosti...
void LTC6811_clraux()
Clears the LTC6811 Auxiliary registers.
int8_t LTC681x_rdstat(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC681x stat registers.
uint8_t tx_data[6]
Stores data to be transmitted.
int8_t LTC6811_rdstat(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6811 stat registers.
void LTC681x_wrpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic ic[])
void LTC6811_clrcell()
Clears the LTC6811 cell voltage registers.
void LTC681x_set_cfgr(uint8_t nIC, cell_asic *ic, bool refon, bool adcopt, bool gpio[5], bool dcc[12], bool dcto[4], uint16_t uv, uint16_t ov)
Helper function to set appropriate bits in CFGR register based on bit function.
void LTC6811_set_cfgr_uv(uint8_t nIC, cell_asic *ic, uint16_t uv)
Helper function to set uv field in CFGRA register.
void LTC681x_set_cfgr_uv(uint8_t nIC, cell_asic *ic, uint16_t uv)
Helper function to set uv field in CFGRA register.
uint16_t LTC681x_run_adc_overlap(uint8_t total_ic, cell_asic *ic)
Helper Function that runs the ADC Overlap test.
void LTC681x_clrcell()
Clears the LTC681x Cell voltage registers The command clears the cell voltage registers and initializ...
void LTC6811_set_cfgr_dis(uint8_t nIC, cell_asic *ic, bool dcc[12])
void LTC6811_axst(uint8_t MD, uint8_t ST)
Start an Auxiliary Register Self Test Conversion.
void LTC681x_statst(uint8_t MD, uint8_t ST)
Start a Status Register Self Test Conversion.
void LTC6811_clrstat()
Clears the LTC6811 Stat registers.
void LTC6811_statst(uint8_t MD, uint8_t ST)
Start a Status Register Self Test Conversion.
void LTC681x_adstat(uint8_t MD, uint8_t CHST)
Start a Status ADC Conversion.
int8_t LTC6811_rdcomm(uint8_t total_ic, cell_asic *ic)
Reads comm registers of a LTC6811 daisy chain.
void LTC6811_cvst(uint8_t MD, uint8_t ST)
Starts cell voltage self test conversion.
void LTC681x_clrsctrl()
Clears the LTC681x SCTRL registers The command clears the SCTRL registers and initializes all values ...
uint32_t LTC6811_pollAdc()
This function will block operation until the ADC has finished it's conversion.
void LTC681x_wrcfg(uint8_t total_ic, cell_asic ic[])
void LTC681x_set_cfgr_ov(uint8_t nIC, cell_asic *ic, uint16_t ov)
Helper function to set ov field in CFGRA register.
uint8_t num_cv_reg
Number of Cell voltage register.
uint8_t num_gpio_reg
Number of Aux register.
void LTC681x_wrsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Write the LTC681x Sctrl register.
void LTC681x_adax(uint8_t MD, uint8_t CHG)
Start a GPIO and Vref2 Conversion.
uint8_t LTC6811_pladc()
Sends the poll ADC command.
void LTC681x_set_cfgr_refon(uint8_t nIC, cell_asic *ic, bool refon)
Helper function to turn the REFON bit HIGH or LOW.
int8_t LTC6811_rdaux(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6811 auxiliary registers.
void LTC6811_adax(uint8_t MD, uint8_t CHG)
Start a GPIO and Vref2 Conversion.
uint8_t LTC681x_rdcv(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC681x cell voltage registers.
void LTC6811_wrcfg(uint8_t total_ic, cell_asic *ic)
Write the LTC6811 configuration register.
uint8_t LTC6811_rdcv(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC6811 cell voltage registers.
void LTC6811_set_cfgr(uint8_t nIC, cell_asic *ic, bool refon, bool adcopt, bool gpio[5], bool dcc[12], bool dcto[4], uint16_t uv, uint16_t ov)
Helper function to set appropriate bits in CFGR register based on bit function.
void LTC6811_run_openwire_multi(uint8_t total_ic, cell_asic *ic)
Helper function that runs open wire for multiple cell and two consecutive cells detection.
void LTC6811_adcvsc(uint8_t MD, uint8_t DCP)
Starts cell voltage and SOC conversion.
void LTC681x_cvst(uint8_t MD, uint8_t ST)
Starts cell voltage self test conversion.
void LTC681x_adcvsc(uint8_t MD, uint8_t DCP)
Starts cell voltage and SOC conversion.
void LTC681x_wrcomm(uint8_t total_ic, cell_asic ic[])
void LTC681x_stsctrl()
Start Sctrl data communication This command will start the sctrl pulse communication over the spins...
void LTC6811_adow(uint8_t MD, uint8_t PUP, uint8_t CH, uint8_t DCP)
Start an open wire Conversion.
int8_t LTC681x_rdsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Reads sctrl registers of a LTC681x daisy chain.
void LTC681x_reset_crc_count(uint8_t total_ic, cell_asic *ic)
Helper Function that resets the PEC error counters.
int16_t LTC6811_run_cell_adc_st(uint8_t adc_reg, uint8_t total_ic, cell_asic *ic, uint8_t md, bool adcopt)
Helper function that runs the ADC Self Tests.
void LTC6811_diagn()
Starts the Mux Decoder diagnostic self test Running this command will start the Mux Decoder Diagnosti...
void LTC681x_clear_discharge(uint8_t total_ic, cell_asic *ic)
Helper Function to clear DCC bits in the CFGR Registers.
void LTC6811_adstatd(uint8_t MD, uint8_t CHST)
Start a Status register redundancy test Conversion.
void LTC6811_adaxd(uint8_t MD, uint8_t CHG)
Start an GPIO Redundancy test.
void LTC6811_run_openwire_single(uint8_t total_ic, cell_asic *ic)
Helper function that runs the data sheet open wire algorithm for single cell detection.
int8_t LTC681x_rdaux(uint8_t reg, uint8_t total_ic, cell_asic *ic)
Reads and parses the LTC681x auxiliary registers.
uint8_t stat_channels
Number of Stat channels.
void LTC681x_adstatd(uint8_t MD, uint8_t CHST)
Start a Status register redundancy test Conversion.
void LTC681x_clrstat()
Clears the LTC681x Stat registers The command clears the Stat registers and initializes all values to...
uint32_t LTC681x_pollAdc()
This function will block operation until the ADC has finished it's conversion.
void LTC6811_adcv(uint8_t MD, uint8_t DCP, uint8_t CH)
Starts cell voltage conversion.
void LTC6811_adol(uint8_t MD, uint8_t DCP)
Starts cell voltage overlap conversion.
void LTC681x_axst(uint8_t MD, uint8_t ST)
Start an Auxiliary Register Self Test Conversion.
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.
int8_t LTC6811_rdcfg(uint8_t total_ic, cell_asic *ic)
Reads configuration registers of a LTC6811.
uint8_t LTC681x_pladc()
Sends the poll ADC command.
uint8_t cell_channels
Number of Cell channels.
uint8_t num_stat_reg
Number of Status register.
void LTC6811_init_reg_limits(uint8_t total_ic, cell_asic *ic)
Initialize the Register limits.
void LTC6811_wrpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
Write the LTC6811 PWM register.
void LTC6811_stcomm(uint8_t len)
Issues a stcomm command and clocks data out of the COMM register.
void LTC6811_adstat(uint8_t MD, uint8_t CHST)
Start a Status ADC Conversion.
void LTC681x_set_cfgr_dcto(uint8_t nIC, cell_asic *ic, bool dcto[4])
int8_t LTC681x_rdpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic ic[])
void LTC6811_stsctrl()
Start Sctrl data communication This command will start the sctrl pulse communication over the spins...
void LTC6811_init_cfg(uint8_t total_ic, cell_asic *ic)
Helper Function to initialize the CFGR data structures.
void LTC6811_wrsctrl(uint8_t total_ic, uint8_t sctrl_reg, cell_asic *ic)
Write the LTC6811 Sctrl register.
void LTC6811_set_cfgr_ov(uint8_t nIC, cell_asic *ic, uint16_t ov)
Helper function to set ov field in CFGRA register.
int8_t LTC681x_rdcomm(uint8_t total_ic, cell_asic ic[])
int16_t LTC6811_run_adc_redundancy_st(uint8_t adc_mode, uint8_t adc_reg, uint8_t total_ic, cell_asic *ic)
Helper function that runs the ADC Digital Redundancy commands and checks output for errors...
void LTC6811_check_pec(uint8_t total_ic, uint8_t reg, cell_asic *ic)
Helper Function that counts overall PEC errors and register/IC PEC errors.
uint16_t LTC6811_run_adc_overlap(uint8_t total_ic, cell_asic *ic)
Helper Function that runs the ADC Overlap test.
void LTC6811_wrcomm(uint8_t total_ic, cell_asic *ic)
Writes to the LTC6811 COMM register.
void LTC6811_set_cfgr_adcopt(uint8_t nIC, cell_asic *ic, bool adcopt)
Helper function to turn the ADCOPT bit HIGH or LOW.
int8_t LTC6811_rdpwm(uint8_t total_ic, uint8_t pwmReg, cell_asic *ic)
Reads pwm registers of a LTC6811 daisy chain.
void LTC6811_set_cfgr_gpio(uint8_t nIC, cell_asic *ic, bool gpio[5])
void LTC681x_init_cfg(uint8_t total_ic, cell_asic *ic)
Helper Function to initialize the CFGR data structures.
int8_t LTC681x_rdcfg(uint8_t total_ic, cell_asic ic[])
LTC6811: Multicell Battery Monitors.
void LTC681x_clraux()
Clears the LTC681x Auxiliary registers The command clears the Auxiliary registers and initializes all...
void LTC681x_adcv(uint8_t MD, uint8_t DCP, uint8_t CH)
Starts cell voltage conversion Starts ADC conversions of the LTC681x Cpin inputs. ...
void LTC6811_adcvax(uint8_t MD, uint8_t DCP)
Starts cell voltage and GPIO 1&2 conversion.
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...
void LTC681x_set_cfgr_adcopt(uint8_t nIC, cell_asic *ic, bool adcopt)
Helper function to turn the ADCOPT bit HIGH or LOW.
void LTC6811_set_discharge(int Cell, uint8_t total_ic, cell_asic *ic)
Helper function to set discharge bit in CFG register.
void LTC681x_run_openwire_multi(uint8_t total_ic, cell_asic ic[])
void LTC681x_run_openwire_single(uint8_t total_ic, cell_asic ic[])
void LTC681x_set_cfgr_dis(uint8_t nIC, cell_asic *ic, bool dcc[12])
uint8_t aux_channels
Number of Aux channels.
void LTC681x_adol(uint8_t MD, uint8_t DCP)
Starts cell voltage overlap conversion.
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.
void LTC6811_clear_discharge(uint8_t total_ic, cell_asic *ic)
Clears all of the DCC bits in the configuration registers.
void LTC6811_set_cfgr_refon(uint8_t nIC, cell_asic *ic, bool refon)
Helper function to turn the refon bit HIGH or LOW.