The foxBMS secondary mcu API documentation
ltc.c File Reference

Driver for the LTC monitoring chip. More...

#include "ltc.h"
#include "database.h"
#include "diag.h"
#include "ltc_pec.h"
#include "os.h"
#include "slaveplausibility.h"
Include dependency graph for ltc.c:

Macros

#define LTC_PORT_EXPANDER_TI_INPUT_REG_ADR   0x00
 
#define LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR   0x01
 
#define LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR   0x03
 
#define LTC_ICOM_START   0x60
 
#define LTC_ICOM_STOP   0x10
 
#define LTC_ICOM_BLANK   0x00
 
#define LTC_ICOM_NO_TRANSMIT   0x70
 
#define LTC_FCOM_MASTER_ACK   0x00
 
#define LTC_FCOM_MASTER_NACK   0x08
 
#define LTC_FCOM_MASTER_NACK_STOP   0x09
 
#define LTC_MAX_SUPPORTED_CELLS   12
 
#define LTC_SAVELASTSTATES()
 

Functions

static STD_RETURN_TYPE_e LTC_Init (void)
 
static void LTC_Initialize_Database (void)
 in the database, initializes the fields related to the LTC drivers. More...
 
static STD_RETURN_TYPE_e LTC_CheckConfiguration (void)
 function to check configuration of config struct ltc_voltage_input_used More...
 
static void LTC_SaveBalancingFeedback (uint8_t *DataBufferSPI_RX)
 stores the measured balancing feedback values in the database. More...
 
static void LTC_Get_BalancingControlValues (void)
 gets the balancing orders from the database. More...
 
static void LTC_StateTransition (LTC_STATEMACH_e state, uint8_t substate, uint16_t timer_ms)
 function for setting LTC_Trigger state transitions More...
 
static void LTC_CondBasedStateTransition (STD_RETURN_TYPE_e retVal, DIAG_CH_ID_e diagCode, uint8_t state_ok, uint8_t substate_ok, uint16_t timer_ms_ok, uint8_t state_nok, uint8_t substate_nok, uint16_t timer_ms_nok)
 condition-based state transition depending on retVal More...
 
static STD_RETURN_TYPE_e LTC_BalanceControl (uint8_t registerSet)
 
static void LTC_ResetErrorTable (void)
 
static STD_RETURN_TYPE_e LTC_StartVoltageMeasurement (LTC_ADCMODE_e adcMode, LTC_ADCMEAS_CHAN_e adcMeasCh)
 tells the LTC daisy-chain to start measuring the voltage on all cells. More...
 
static STD_RETURN_TYPE_e LTC_StartGPIOMeasurement (LTC_ADCMODE_e adcMode, LTC_ADCMEAS_CHAN_e adcMeasCh)
 tells LTC daisy-chain to start measuring the voltage on GPIOS. More...
 
static STD_RETURN_TYPE_e LTC_StartOpenWireMeasurement (LTC_ADCMODE_e adcMode, uint8_t PUP)
 tells LTC daisy-chain to start measuring the voltage on GPIOS. More...
 
static uint16_t LTC_Get_MeasurementTCycle (LTC_ADCMODE_e adcMode, LTC_ADCMEAS_CHAN_e adcMeasCh)
 brief missing More...
 
static void LTC_SaveRXtoVoltagebuffer (uint8_t registerSet, uint8_t *rxBuffer)
 saves the voltage values read from the LTC daisy-chain. More...
 
static void LTC_SaveRXtoGPIOBuffer (uint8_t registerSet, uint8_t *rxBuffer)
 saves the GPIO voltage values read from the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_RX_PECCheck (uint8_t *DataBufferSPI_RX_with_PEC)
 checks if the data received from the daisy-chain is not corrupt. More...
 
static STD_RETURN_TYPE_e LTC_RX (uint8_t *Command, uint8_t *DataBufferSPI_RX_with_PEC)
 send command to the LTC daisy-chain and receives data from the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_TX (uint8_t *Command, uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC)
 sends command and data to the LTC daisy-chain. More...
 
static void LTC_SetMUXChCommand (uint8_t *DataBufferSPI_TX, uint8_t mux, uint8_t channel)
 configures the data that will be sent to the LTC daisy-chain to configure multiplexer channels. More...
 
static uint8_t LTC_SendEEPROMReadCommand (uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC, uint8_t step)
 sends data to the LTC daisy-chain to read EEPROM on slaves. More...
 
static void LTC_SetEEPROMReadCommand (uint8_t step, uint8_t *DataBufferSPI_TX)
 configures the data that will be sent to the LTC daisy-chain to read EEPROM on slaves. More...
 
static void LTC_EEPROMSaveReadValue (uint8_t *rxBuffer)
 saves the read values of the external EEPROMs read from the LTC daisy-chain. More...
 
static uint8_t LTC_SendEEPROMWriteCommand (uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC, uint8_t step)
 sends data to the LTC daisy-chain to write EEPROM on slaves. More...
 
static void LTC_SetEEPROMWriteCommand (uint8_t step, uint8_t *DataBufferSPI_TX)
 configures the data that will be sent to the LTC daisy-chain to write EEPROM on slaves. More...
 
static uint8_t LTC_SetMuxChannel (uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC, uint8_t mux, uint8_t channel)
 sends data to the LTC daisy-chain to configure multiplexer channels. More...
 
static uint8_t LTC_SetPortExpander (uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC)
 sends data to the LTC daisy-chain to control the user port expander More...
 
static void LTC_PortExpanderSaveValues (uint8_t *rxBuffer)
 saves the received values of the external port expander read from the LTC daisy-chain. More...
 
static void LTC_TempSensSaveTemp (uint8_t *rxBuffer)
 saves the temperature value of the external temperature sensors read from the LTC daisy-chain. More...
 
static uint8_t LTC_SetPortExpanderDirection_TI (LTC_PORT_EXPANDER_TI_DIRECTION_e direction, uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC)
 sends data to the LTC daisy-chain to control the user port expander from TI More...
 
static uint8_t LTC_SetPortExpander_Output_TI (uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC)
 sends data to the LTC daisy-chain to control the user port expander from TI More...
 
static uint8_t LTC_GetPortExpander_Input_TI (uint8_t step, uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC)
 sends data to the LTC daisy-chain to control the user port expander from TI More...
 
static void LTC_PortExpanderSaveValues_TI (uint8_t *rxBuffer)
 saves the received values of the external port expander from TI read from the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_I2CClock (uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC)
 sends 72 clock pulses to the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_Send_I2C_Command (uint8_t *DataBufferSPI_TX, uint8_t *DataBufferSPI_TX_with_PEC, uint8_t *cmd_data)
 sends data to the LTC daisy-chain to communicate via I2C More...
 
static uint8_t LTC_I2CCheckACK (uint8_t *DataBufferSPI_RX, int mux)
 checks if the multiplexers acknowledged transmission. More...
 
static void LTC_SaveMuxMeasurement (uint8_t *rxBuffer, LTC_MUX_CH_CFG_s *muxseqptr)
 saves the multiplexer values read from the LTC daisy-chain. More...
 
static uint32_t LTC_GetSPIClock (void)
 gets the frequency of the SPI clock. More...
 
static void LTC_SetTransferTimes (void)
 sets the transfer time needed to receive/send data with the LTC daisy-chain. More...
 
static LTC_RETURN_TYPE_e LTC_CheckStateRequest (LTC_STATE_REQUEST_e statereq)
 checks the state requests that are made. More...
 
static STD_RETURN_TYPE_e LTC_TimerElapsedAndSPITransmitOngoing (uint16_t timer)
 
void LTC_SaveVoltages (void)
 stores the measured voltages in the database. More...
 
void LTC_SaveTemperatures (void)
 stores the measured temperatures and the measured multiplexer feedbacks in the database. More...
 
void LTC_SaveAllGPIOMeasurement (void)
 stores the measured GPIOs in the database. More...
 
uint8_t LTC_CheckReEntrance (void)
 re-entrance check of LTC state machine trigger function More...
 
LTC_STATE_REQUEST_e LTC_GetStateRequest (void)
 gets the current state request. More...
 
LTC_STATEMACH_e LTC_GetState (void)
 gets the current state. More...
 
LTC_STATE_REQUEST_e LTC_TransferStateRequest (uint8_t *busIDptr, LTC_ADCMODE_e *adcModeptr, LTC_ADCMEAS_CHAN_e *adcMeasChptr)
 transfers the current state request to the state machine. More...
 
LTC_RETURN_TYPE_e LTC_SetStateRequest (LTC_STATE_REQUEST_e statereq)
 sets the current state request of the state variable ltc_state. More...
 
void LTC_Trigger (void)
 trigger function for the LTC driver state machine. More...
 
uint8_t LTC_IsFirstMeasurementCycleFinished (void)
 gets the measurement initialization status. More...
 
void LTC_SetFirstMeasurementCycleFinished (void)
 sets the measurement initialization status. More...
 
STD_RETURN_TYPE_e LTC_GetMuxSequenceState (void)
 gets the measurement initialization status. More...
 

Variables

static uint8_t ltc_used_cells_index = 0
 
static DATA_BLOCK_CELLVOLTAGE_s ltc_cellvoltage
 
static DATA_BLOCK_CELLTEMPERATURE_s ltc_celltemperature
 
static DATA_BLOCK_MINMAX_s ltc_minmax
 
static DATA_BLOCK_BALANCING_FEEDBACK_s ltc_balancing_feedback
 
static DATA_BLOCK_USER_MUX_s ltc_user_mux
 
static DATA_BLOCK_BALANCING_CONTROL_s ltc_balancing_control
 
static DATA_BLOCK_SLAVE_CONTROL_s ltc_slave_control
 
static DATA_BLOCK_ALLGPIOVOLTAGE_s ltc_allgpiovoltage
 
static DATA_BLOCK_OPENWIRE_s ltc_openwire
 
static uint16_t ltc_openwire_pup_buffer [BS_NR_OF_BAT_CELLS]
 
static uint16_t ltc_openwire_pdown_buffer [BS_NR_OF_BAT_CELLS]
 
static int32_t ltc_openwire_delta [BS_NR_OF_BAT_CELLS]
 
static LTC_ERRORTABLE_s LTC_ErrorTable [LTC_N_LTC]
 
static LTC_STATE_s ltc_state
 
static const uint8_t ltc_cmdDummy [1] ={0x00}
 
static const uint8_t ltc_cmdWRCFG [4] ={0x00, 0x01, 0x3D, 0x6E}
 
static const uint8_t ltc_cmdWRCFG2 [4] ={0x00, 0x24, 0xB1, 0x9E}
 
static const uint8_t ltc_cmdRDCVA [4] = {0x00, 0x04, 0x07, 0xC2}
 
static const uint8_t ltc_cmdRDCVB [4] = {0x00, 0x06, 0x9A, 0x94}
 
static const uint8_t ltc_cmdRDCVC [4] = {0x00, 0x08, 0x5E, 0x52}
 
static const uint8_t ltc_cmdRDCVD [4] = {0x00, 0x0A, 0xC3, 0x04}
 
static const uint8_t ltc_cmdRDCVE [4] = {0x00, 0x09, 0xD5, 0x60}
 
static const uint8_t ltc_cmdRDCVF [4] = {0x00, 0x0B, 0x48, 0x36}
 
static const uint8_t ltc_cmdWRCOMM [4] = {0x07, 0x21, 0x24, 0xB2}
 
static const uint8_t ltc_cmdSTCOMM [4] = {0x07, 0x23, 0xB9, 0xE4}
 
static const uint8_t ltc_cmdRDCOMM [4] = {0x07, 0x22, 0x32, 0xD6}
 
static const uint8_t ltc_cmdRDAUXA [4] = {0x00, 0x0C, 0xEF, 0xCC}
 
static const uint8_t ltc_cmdRDAUXB [4] = {0x00, 0x0E, 0x72, 0x9A}
 
static const uint8_t ltc_cmdRDAUXC [4] = {0x00, 0x0D, 0x64, 0xFE}
 
static const uint8_t ltc_cmdRDAUXD [4] = {0x00, 0x0F, 0xF9, 0xA8}
 
static const uint8_t ltc_I2CcmdTempSens0 [6] = {0x69, 0x08, 0x00, 0x09, 0x7F, 0xF9}
 
static const uint8_t ltc_I2CcmdTempSens1 [6] = {0x69, 0x18, 0x0F, 0xF0, 0x0F, 0xF9}
 
static const uint8_t ltc_I2CcmdPortExpander1 [6] = {0x64, 0x18, 0x0F, 0xF9, 0x7F, 0xF9}
 
static const uint8_t ltc_cmdADCV_normal_DCP0 [4] = {0x03, 0x60, 0xF4, 0x6C}
 
static const uint8_t ltc_cmdADCV_normal_DCP1 [4] = {0x03, 0x70, 0xAF, 0x42}
 
static const uint8_t ltc_cmdADCV_filtered_DCP0 [4] = {0x03, 0xE0, 0xB0, 0x4A}
 
static const uint8_t ltc_cmdADCV_filtered_DCP1 [4] = {0x03, 0xF0, 0xEB, 0x64}
 
static const uint8_t ltc_cmdADCV_fast_DCP0 [4] = {0x02, 0xE0, 0x38, 0x06}
 
static const uint8_t ltc_cmdADCV_fast_DCP1 [4] = {0x02, 0xF0, 0x63, 0x28}
 
static const uint8_t ltc_cmdADCV_fast_DCP0_twocells [4] = {0x02, 0xE1, 0xb3, 0x34}
 
static const uint8_t ltc_cmdADAX_normal_GPIO1 [4] = {0x05, 0x61, 0x58, 0x92}
 
static const uint8_t ltc_cmdADAX_filtered_GPIO1 [4] = {0x05, 0xE1, 0x1C, 0xB4}
 
static const uint8_t ltc_cmdADAX_fast_GPIO1 [4] = {0x04, 0xE1, 0x94, 0xF8}
 
static const uint8_t ltc_cmdADAX_normal_GPIO2 [4] = {0x05, 0x62, 0x4E, 0xF6}
 
static const uint8_t ltc_cmdADAX_filtered_GPIO2 [4] = {0x05, 0xE2, 0x0A, 0xD0}
 
static const uint8_t ltc_cmdADAX_fast_GPIO2 [4] = {0x04, 0xE2, 0x82, 0x9C}
 
static const uint8_t ltc_cmdADAX_normal_GPIO3 [4] = {0x05, 0x63, 0xC5, 0xC4}
 
static const uint8_t ltc_cmdADAX_filtered_GPIO3 [4] = {0x05, 0xE3, 0x81, 0xE2}
 
static const uint8_t ltc_cmdADAX_fast_GPIO3 [4] = {0x04, 0xE3, 0x09, 0xAE}
 
static const uint8_t ltc_cmdADAX_normal_ALLGPIOS [4] = {0x05, 0x60, 0xD3, 0xA0}
 
static const uint8_t ltc_cmdADAX_filtered_ALLGPIOS [4] = {0x05, 0xE0, 0x97, 0x86}
 
static const uint8_t ltc_cmdADAX_fast_ALLGPIOS [4] = {0x04, 0xE0, 0x1F, 0xCA}
 
static const uint8_t ltc2_BC_cmdADOW_PUP_normal_DCP0 [4] = {0x03, 0x68, 0x1C, 0x62}
 
static const uint8_t ltc2_BC_cmdADOW_PDOWN_normal_DCP0 [4] = {0x03, 0x28, 0xFB, 0xE8}
 
static const uint8_t ltc2_BC_cmdADOW_PUP_filtered_DCP0 [4] = {0x03, 0xE8, 0x58, 0x44}
 
static const uint8_t ltc2_BC_cmdADOW_PDOWN_filtered_DCP0 [4] = {0x03, 0xA8, 0xBF, 0xCE}
 
static uint8_t ltc_RXPECbuffer [LTC_N_BYTES_FOR_DATA_TRANSMISSION]
 
static uint8_t ltc_TXPECbuffer [LTC_N_BYTES_FOR_DATA_TRANSMISSION]
 
static uint8_t ltc_TXBuffer [LTC_N_BYTES_FOR_DATA_TRANSMISSION_DATA_ONLY]
 
static uint8_t ltc_TXBufferClock [4+9]
 
static uint8_t ltc_TXPECBufferClock [4+9]
 

Detailed Description

Driver for the LTC monitoring chip.

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

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. 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.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

″This product uses parts of foxBMS®″

″This product includes parts of foxBMS®″

″This product is derived from foxBMS®″

Author
foxBMS Team
Date
01.09.2015 (date of creation)
Module-prefix LTC

Macro Definition Documentation

◆ LTC_FCOM_MASTER_ACK

#define LTC_FCOM_MASTER_ACK   0x00

◆ LTC_FCOM_MASTER_NACK

#define LTC_FCOM_MASTER_NACK   0x08

◆ LTC_FCOM_MASTER_NACK_STOP

#define LTC_FCOM_MASTER_NACK_STOP   0x09

◆ LTC_ICOM_BLANK

#define LTC_ICOM_BLANK   0x00

◆ LTC_ICOM_NO_TRANSMIT

#define LTC_ICOM_NO_TRANSMIT   0x70

◆ LTC_ICOM_START

#define LTC_ICOM_START   0x60

LTC COMM definitions

◆ LTC_ICOM_STOP

#define LTC_ICOM_STOP   0x10

◆ LTC_MAX_SUPPORTED_CELLS

#define LTC_MAX_SUPPORTED_CELLS   12

◆ LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR

#define LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR   0x03

◆ LTC_PORT_EXPANDER_TI_INPUT_REG_ADR

#define LTC_PORT_EXPANDER_TI_INPUT_REG_ADR   0x00

TI port expander register addresses

◆ LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR

#define LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR   0x01

◆ LTC_SAVELASTSTATES

#define LTC_SAVELASTSTATES ( )
Value:
ltc_state.lastsubstate = ltc_state.substate
LTC_STATEMACH_e laststate
Definition: ltc_defs.h:536
uint8_t substate
Definition: ltc_defs.h:535
LTC_STATEMACH_e state
Definition: ltc_defs.h:534
static LTC_STATE_s ltc_state
Definition: ltc.c:113

Saves the last state and the last substate

Function Documentation

◆ LTC_BalanceControl()

static STD_RETURN_TYPE_e LTC_BalanceControl ( uint8_t  registerSet)
static
Here is the call graph for this function:

◆ LTC_CheckConfiguration()

STD_RETURN_TYPE_e LTC_CheckConfiguration ( void  )
static

function to check configuration of config struct ltc_voltage_input_used

Returns
E_OK if valid configuration detected, otherwise E_NOT_OK

◆ LTC_CheckReEntrance()

uint8_t LTC_CheckReEntrance ( void  )

re-entrance check of LTC state machine trigger function

This function is not re-entrant and should only be called time- or event-triggered. It increments the triggerentry counter from the state variable ltc_state. It should never be called by two different processes, so if it is the case, triggerentry should never be higher than 0 when this function is called.

Returns
retval 0 if no further instance of the function is active, 0xff else
Here is the call graph for this function:

◆ LTC_CheckStateRequest()

static LTC_RETURN_TYPE_e LTC_CheckStateRequest ( LTC_STATE_REQUEST_e  statereq)
static

checks the state requests that are made.

This function checks the validity of the state requests. The resuls of the checked is returned immediately.

Parameters
statereqstate request to be checked
Returns
result of the state request that was made, taken from LTC_RETURN_TYPE_e

◆ LTC_CondBasedStateTransition()

static void LTC_CondBasedStateTransition ( STD_RETURN_TYPE_e  retVal,
DIAG_CH_ID_e  diagCode,
uint8_t  state_ok,
uint8_t  substate_ok,
uint16_t  timer_ms_ok,
uint8_t  state_nok,
uint8_t  substate_nok,
uint16_t  timer_ms_nok 
)
static

condition-based state transition depending on retVal

If retVal is E_OK, after timer_ms_ok is elapsed the LTC statemachine will transition into state_ok and substate_ok, otherwise after timer_ms_nok the statemachine will transition to state_nok and substate_nok. Depending on value of retVal the corresponding diagnosis entry will be called.

Parameters
retValcondition to determine if statemachine will transition into ok or nok states
diagCodesymbolic IDs for diagnosis entry, called with DIAG_EVENT_OK if retVal is E_OK, DIAG_EVENT_NOK otherwise
state_okstate to transition into if retVal is E_OK
substate_oksubstate to transition into if retVal is E_OK
timer_ms_oktransition into state_ok, substate_ok after timer_ms_ok elapsed
state_nokstate to transition into if retVal is E_NOT_OK
substate_noksubstate to transition into if retVal is E_NOT_OK
timer_ms_noktransition into state_nok, substate_nok after timer_ms_nok elapsed
Here is the call graph for this function:

◆ LTC_EEPROMSaveReadValue()

static void LTC_EEPROMSaveReadValue ( uint8_t *  rxBuffer)
static

saves the read values of the external EEPROMs read from the LTC daisy-chain.

Parameters
*rxBufferbuffer containing the data obtained from the SPI transmission
Here is the call graph for this function:

◆ LTC_Get_BalancingControlValues()

static void LTC_Get_BalancingControlValues ( void  )
static

gets the balancing orders from the database.

This function gets the balancing control from the database. Balancing control is set by the BMS. The LTC driver only executes the balancing orders.

Here is the call graph for this function:

◆ LTC_Get_MeasurementTCycle()

static uint16_t LTC_Get_MeasurementTCycle ( LTC_ADCMODE_e  adcMode,
LTC_ADCMEAS_CHAN_e  adcMeasCh 
)
static

brief missing

Gets the measurement time needed by the LTC chip, depending on the measurement mode and the number of channels. For all cell voltages or all 5 GPIOS, the measurement time is the same. For 2 cell voltages or 1 GPIO, the measurement time is the same. As a consequence, this function is used for cell voltage and for GPIO measurement.

Parameters
adcModeLTC ADCmeasurement mode (fast, normal or filtered)
adcMeasChnumber of channels measured for GPIOS (one at a time for multiplexers or all five GPIOs) or number of cell voltage measured (2 cells or all cells)
Returns
retVal measurement time in ms

◆ LTC_GetMuxSequenceState()

STD_RETURN_TYPE_e LTC_GetMuxSequenceState ( void  )

gets the measurement initialization status.

Returns
retval TRUE if a first measurement cycle was made, FALSE otherwise

◆ LTC_GetPortExpander_Input_TI()

static uint8_t LTC_GetPortExpander_Input_TI ( uint8_t  step,
uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC 
)
static

sends data to the LTC daisy-chain to control the user port expander from TI

This function sends a control byte to the register of the user port expander from TI

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the multiplexer channels, with PEC (calculated by the function)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_GetSPIClock()

static uint32_t LTC_GetSPIClock ( void  )
static

gets the frequency of the SPI clock.

This function reads the configuration from the SPI handle directly.

Returns
frequency of the SPI clock

◆ LTC_GetState()

LTC_STATEMACH_e LTC_GetState ( void  )

gets the current state.

This function is used in the functioning of the LTC state machine.

Returns
current state, taken from LTC_STATEMACH_e

◆ LTC_GetStateRequest()

LTC_STATE_REQUEST_e LTC_GetStateRequest ( void  )

gets the current state request.

This function is used in the functioning of the LTC state machine.

Returns
retval current state request, taken from LTC_STATE_REQUEST_e
Here is the call graph for this function:

◆ LTC_I2CCheckACK()

static uint8_t LTC_I2CCheckACK ( uint8_t *  DataBufferSPI_RX,
int  mux 
)
static

checks if the multiplexers acknowledged transmission.

The RDCOMM command can be used to read the answer of the multiplexers to a I2C transmission. This function determines if the communication with the multiplexers was successful or not. The array LTC_ErrorTable is updated to locate the multiplexers that did not acknowledge transmission.

Parameters
*DataBufferSPI_RXdata obtained from the SPI transmission
muxmultiplexer to be addressed (multiplexer ID)
Returns
mux_error 0 is there was no error, 1 if there was errors

◆ LTC_I2CClock()

static STD_RETURN_TYPE_e LTC_I2CClock ( uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC 
)
static

sends 72 clock pulses to the LTC daisy-chain.

This function is used for the communication with the multiplexers via I2C on the GPIOs. It send the command STCOMM to the LTC daisy-chain.

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain, set to 0xFF
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain with PEC (calculated by the function)
Returns
statusSPI E_OK if clock pulses were sent correctly by SPI, E_NOT_OK otherwise

◆ LTC_Init()

static STD_RETURN_TYPE_e LTC_Init ( void  )
static
Here is the call graph for this function:

◆ LTC_Initialize_Database()

static void LTC_Initialize_Database ( void  )
static

in the database, initializes the fields related to the LTC drivers.

This function loops through all the LTC-related data fields in the database and sets them to 0. It should be called in the initialization or re-initialization routine of the LTC driver.

Here is the call graph for this function:

◆ LTC_IsFirstMeasurementCycleFinished()

uint8_t LTC_IsFirstMeasurementCycleFinished ( void  )

gets the measurement initialization status.

Returns
retval TRUE if a first measurement cycle was made, FALSE otherwise
Here is the call graph for this function:

◆ LTC_PortExpanderSaveValues()

static void LTC_PortExpanderSaveValues ( uint8_t *  rxBuffer)
static

saves the received values of the external port expander read from the LTC daisy-chain.

This function saves the received data byte from the external port expander

Parameters
*rxBufferbuffer containing the data obtained from the SPI transmission
Here is the call graph for this function:

◆ LTC_PortExpanderSaveValues_TI()

static void LTC_PortExpanderSaveValues_TI ( uint8_t *  rxBuffer)
static

saves the received values of the external port expander from TI read from the LTC daisy-chain.

This function saves the received data byte from the external port expander from TI

Parameters
*rxBufferbuffer containing the data obtained from the SPI transmission
Here is the call graph for this function:

◆ LTC_ResetErrorTable()

static void LTC_ResetErrorTable ( void  )
static

◆ LTC_RX()

static STD_RETURN_TYPE_e LTC_RX ( uint8_t *  Command,
uint8_t *  DataBufferSPI_RX_with_PEC 
)
static

send command to the LTC daisy-chain and receives data from the LTC daisy-chain.

This is the core function to receive data from the LTC6804 daisy-chain. A 2 byte command is sent with the corresponding PEC. Example: read configuration register (RDCFG). Only command has to be set, the function calculates the PEC automatically. The data send is: 2 bytes (COMMAND) 2 bytes (PEC) The data received is: 6 bytes (LTC1) 2 bytes (PEC) + 6 bytes (LTC2) 2 bytes (PEC) + 6 bytes (LTC3) 2 bytes (PEC) + ... + 6 bytes (LTC{LTC_N_LTC}) 2 bytes (PEC)

The function does not check the PECs. This has to be done elsewhere.

Parameters
*Commandcommand sent to the daisy-chain
*DataBufferSPI_RX_with_PECdata to sent to the daisy-chain, i.e. data to be sent + PEC
Returns
statusSPI E_OK if SPI transmission is OK, E_NOT_OK otherwise

◆ LTC_RX_PECCheck()

static STD_RETURN_TYPE_e LTC_RX_PECCheck ( uint8_t *  DataBufferSPI_RX_with_PEC)
static

checks if the data received from the daisy-chain is not corrupt.

This function computes the PEC (CRC) from the data received by the daisy-chain. It compares it with the PEC sent by the LTCs. If there are errors, the array LTC_ErrorTable is updated to locate the LTCs in daisy-chain that transmitted corrupt data.

Parameters
*DataBufferSPI_RX_with_PECdata obtained from the SPI transmission
Returns
retVal E_OK if PEC check is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SaveAllGPIOMeasurement()

void LTC_SaveAllGPIOMeasurement ( void  )

stores the measured GPIOs in the database.

This function loops through the data of all modules in the LTC daisy-chain that are stored in the ltc_allgpiovoltage buffer and writes them in the database. At each write iteration, the variable named "state" and related to voltages in the database is incremented.

Here is the call graph for this function:

◆ LTC_SaveBalancingFeedback()

static void LTC_SaveBalancingFeedback ( uint8_t *  DataBufferSPI_RX)
static

stores the measured balancing feedback values in the database.

This function stores the global balancing feedback value measured on GPIO3 of the LTC into the database

Here is the call graph for this function:

◆ LTC_SaveMuxMeasurement()

static void LTC_SaveMuxMeasurement ( uint8_t *  rxBuffer,
LTC_MUX_CH_CFG_s muxseqptr 
)
static

saves the multiplexer values read from the LTC daisy-chain.

After a voltage measurement was initiated on GPIO 1 to read the currently selected multiplexer voltage, the results is read via SPI from the daisy-chain. This function is called to store the result from the transmission in a buffer.

Parameters
*DataBufferSPI_RXbuffer containing the data obtained from the SPI transmission
muxseqptrpointer to the multiplexer sequence, which configures the currently selected multiplexer ID and channel
Here is the call graph for this function:

◆ LTC_SaveRXtoGPIOBuffer()

static void LTC_SaveRXtoGPIOBuffer ( uint8_t  registerSet,
uint8_t *  rxBuffer 
)
static

saves the GPIO voltage values read from the LTC daisy-chain.

After a voltage measurement was initiated to measure the voltages on all GPIOs, the result is read via SPI from the daisy-chain. In order to read the result of all GPIO measurements, it is necessary to read auxiliary register A and B. Only one register can be read at a time. This function is called to store the result from the transmission in a buffer.

Parameters
registerSetvoltage register that was read (auxiliary register A, B, C or D)
*rxBufferbuffer containing the data obtained from the SPI transmission

◆ LTC_SaveRXtoVoltagebuffer()

static void LTC_SaveRXtoVoltagebuffer ( uint8_t  registerSet,
uint8_t *  rxBuffer 
)
static

saves the voltage values read from the LTC daisy-chain.

After a voltage measurement was initiated to measure the voltages of the cells, the result is read via SPI from the daisy-chain. There are 6 register to read _(A,B,C,D,E,F) to get all cell voltages. Only one register can be read at a time. This function is called to store the result from the transmission in a buffer.

Parameters
registerSetvoltage register that was read (voltage register A,B,C,D,E or F)
*rxBufferbuffer containing the data obtained from the SPI transmission
PEC_validtells the functions if the PEC is valid or not, if not, manage indices but do not store

◆ LTC_SaveTemperatures()

void LTC_SaveTemperatures ( void  )

stores the measured temperatures and the measured multiplexer feedbacks in the database.

This function loops through the temperature and multiplexer feedback data of all modules in the LTC daisy-chain that are stored in the LTC_MultiplexerVoltages buffer and writes them in the database. At each write iteration, the variables named "state" and related to temperatures and multiplexer feedbacks in the database are incremented.

Here is the call graph for this function:

◆ LTC_SaveVoltages()

void LTC_SaveVoltages ( void  )

stores the measured voltages in the database.

This function loops through the data of all modules in the LTC daisy-chain that are stored in the LTC_CellVoltages buffer and writes them in the database. At each write iteration, the variable named "state" and related to voltages in the database is incremented.

Here is the call graph for this function:

◆ LTC_Send_I2C_Command()

static STD_RETURN_TYPE_e LTC_Send_I2C_Command ( uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC,
uint8_t *  cmd_data 
)
static

sends data to the LTC daisy-chain to communicate via I2C

This function initiates an I2C signal sent by the LTC6804 on the slave boards

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the EEPROM
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the EEPROM, with PEC (calculated by the function)
cmd_daacommand data to be sent
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SendEEPROMReadCommand()

static uint8_t LTC_SendEEPROMReadCommand ( uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC,
uint8_t  step 
)
static

sends data to the LTC daisy-chain to read EEPROM on slaves.

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the multiplexer channels, with PEC (calculated by the function)
stepfirst or second stage of read process (0 or 1)
addressread address (18 bits)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SendEEPROMWriteCommand()

static uint8_t LTC_SendEEPROMWriteCommand ( uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC,
uint8_t  step 
)
static

sends data to the LTC daisy-chain to write EEPROM on slaves.

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the multiplexer channels, with PEC (calculated by the function)
stepfirst or second stage of read process (0 or 1)
addressread address (18 bits)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SetEEPROMReadCommand()

static void LTC_SetEEPROMReadCommand ( uint8_t  step,
uint8_t *  DataBufferSPI_TX 
)
static

configures the data that will be sent to the LTC daisy-chain to read EEPROM on slaves.

Parameters
stepfirst or second stage of read process (0 or 1)
*DataBufferSPI_TXdata to be sent to the daisy-chain
addressread address (18 bits)
Here is the call graph for this function:

◆ LTC_SetEEPROMWriteCommand()

static void LTC_SetEEPROMWriteCommand ( uint8_t  step,
uint8_t *  DataBufferSPI_TX 
)
static

configures the data that will be sent to the LTC daisy-chain to write EEPROM on slaves.

Parameters
stepfirst or second stage of read process (0 or 1)
*DataBufferSPI_TXdata to be sent to the daisy-chain
addressread address (18 bits)
Here is the call graph for this function:

◆ LTC_SetFirstMeasurementCycleFinished()

void LTC_SetFirstMeasurementCycleFinished ( void  )

sets the measurement initialization status.

Returns
none
Here is the call graph for this function:

◆ LTC_SetMuxChannel()

static uint8_t LTC_SetMuxChannel ( uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC,
uint8_t  mux,
uint8_t  channel 
)
static

sends data to the LTC daisy-chain to configure multiplexer channels.

This function calls the function LTC_SetMUXChCommand() to set the data.

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the multiplexer channels, with PEC (calculated by the function)
muxmultiplexer ID to be configured (0,1,2 or 3)
channelmultiplexer channel to be configured (0 to 7)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SetMUXChCommand()

static void LTC_SetMUXChCommand ( uint8_t *  DataBufferSPI_TX,
uint8_t  mux,
uint8_t  channel 
)
static

configures the data that will be sent to the LTC daisy-chain to configure multiplexer channels.

This function does not sent the data to the multiplexer daisy-chain. This is done by the function LTC_SetMuxChannel(), which calls LTC_SetMUXChCommand()..

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
muxmultiplexer ID to be configured (0,1,2 or 3)
channelmultiplexer channel to be configured (0 to 7)

◆ LTC_SetPortExpander()

static uint8_t LTC_SetPortExpander ( uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC 
)
static

sends data to the LTC daisy-chain to control the user port expander

This function sends a control byte to the register of the user port expander

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the multiplexer channels, with PEC (calculated by the function)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SetPortExpander_Output_TI()

static uint8_t LTC_SetPortExpander_Output_TI ( uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC 
)
static

sends data to the LTC daisy-chain to control the user port expander from TI

This function sends a control byte to the register of the user port expander from TI

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the multiplexer channels, with PEC (calculated by the function)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SetPortExpanderDirection_TI()

static uint8_t LTC_SetPortExpanderDirection_TI ( LTC_PORT_EXPANDER_TI_DIRECTION_e  direction,
uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC 
)
static

sends data to the LTC daisy-chain to control the user port expander from TI

This function sends a control byte to the register of the user port expander from TI

Parameters
*DataBufferSPI_TXdata to be sent to the daisy-chain to configure the multiplexer channels
*DataBufferSPI_TX_with_PECdata to be sent to the daisy-chain to configure the multiplexer channels, with PEC (calculated by the function)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

◆ LTC_SetStateRequest()

LTC_RETURN_TYPE_e LTC_SetStateRequest ( LTC_STATE_REQUEST_e  statereq)

sets the current state request of the state variable ltc_state.

This function is used to make a state request to the state machine,e.g, start voltage measurement, read result of voltage measurement, re-initialization It calls LTC_CheckStateRequest() to check if the request is valid. The state request is rejected if is not valid. The result of the check is returned immediately, so that the requester can act in case it made a non-valid state request.

Parameters
statereqstate request to set
adcModereqLTC ADCmeasurement mode (fast, normal or filtered)
adcMeasChreqnumber of channels measured for GPIOS (one at a time for multiplexers or all five GPIOs)
numberOfMeasuredMuxnumber of multiplexer inputs measured between two cell voltage measurements
Returns
retVal current state request, taken from LTC_STATE_REQUEST_e
Here is the call graph for this function:

◆ LTC_SetTransferTimes()

static void LTC_SetTransferTimes ( void  )
static

sets the transfer time needed to receive/send data with the LTC daisy-chain.

This function gets the clock frequency and uses the number of LTCs in the daisy-chain.

Here is the call graph for this function:

◆ LTC_StartGPIOMeasurement()

static STD_RETURN_TYPE_e LTC_StartGPIOMeasurement ( LTC_ADCMODE_e  adcMode,
LTC_ADCMEAS_CHAN_e  adcMeasCh 
)
static

tells LTC daisy-chain to start measuring the voltage on GPIOS.

This function sends an instruction to the daisy-chain via SPI to start the measurement.

Parameters
adcModeLTC ADCmeasurement mode (fast, normal or filtered)
adcMeasChnumber of channels measured for GPIOS (one at a time, typically when multiplexers are used, or all five GPIOs)
Returns
retVal E_OK if dummy byte was sent correctly by SPI, E_NOT_OK otherwise

◆ LTC_StartOpenWireMeasurement()

static STD_RETURN_TYPE_e LTC_StartOpenWireMeasurement ( LTC_ADCMODE_e  adcMode,
uint8_t  PUP 
)
static

tells LTC daisy-chain to start measuring the voltage on GPIOS.

This function sends an instruction to the daisy-chain via SPI to start the measurement.

Parameters
adcModeLTC ADCmeasurement mode (fast, normal or filtered)
PUPpull-up bit for pull-up or pull-down current (0: pull-down, 1: pull-up)
Returns
retVal E_OK if command was sent correctly by SPI, E_NOT_OK otherwise

◆ LTC_StartVoltageMeasurement()

static STD_RETURN_TYPE_e LTC_StartVoltageMeasurement ( LTC_ADCMODE_e  adcMode,
LTC_ADCMEAS_CHAN_e  adcMeasCh 
)
static

tells the LTC daisy-chain to start measuring the voltage on all cells.

This function sends an instruction to the daisy-chain via SPI, in order to start voltage measurement for all cells.

Parameters
adcModeLTC ADCmeasurement mode (fast, normal or filtered)
adcMeasChnumber of cell voltage measured (2 cells or all cells)
Returns
retVal E_OK if dummy byte was sent correctly by SPI, E_NOT_OK otherwise

◆ LTC_StateTransition()

static void LTC_StateTransition ( LTC_STATEMACH_e  state,
uint8_t  substate,
uint16_t  timer_ms 
)
static

function for setting LTC_Trigger state transitions

Parameters
statestate to transition into
substatesubstate to transition into
timer_mstransition into state, substate after timer elapsed

◆ LTC_TempSensSaveTemp()

static void LTC_TempSensSaveTemp ( uint8_t *  rxBuffer)
static

saves the temperature value of the external temperature sensors read from the LTC daisy-chain.

This function saves the temperature value received from the external temperature sensors

Parameters
*rxBufferbuffer containing the data obtained from the SPI transmission
Here is the call graph for this function:

◆ LTC_TimerElapsedAndSPITransmitOngoing()

static STD_RETURN_TYPE_e LTC_TimerElapsedAndSPITransmitOngoing ( uint16_t  timer)
static
Here is the call graph for this function:

◆ LTC_TransferStateRequest()

LTC_STATE_REQUEST_e LTC_TransferStateRequest ( uint8_t *  busIDptr,
LTC_ADCMODE_e adcModeptr,
LTC_ADCMEAS_CHAN_e adcMeasChptr 
)

transfers the current state request to the state machine.

This function takes the current state request from ltc_state and transfers it to the state machine. It resets the value from ltc_state to LTC_STATE_NO_REQUEST

Parameters
*busIDptrbus ID, main or backup (deprecated)
*adcModeptrLTC ADCmeasurement mode (fast, normal or filtered)
*adcMeasChptrnumber of channels measured for GPIOS (one at a time for multiplexers or all five GPIOs)
Returns
retVal current state request, taken from LTC_STATE_REQUEST_e
Here is the call graph for this function:

◆ LTC_Trigger()

void LTC_Trigger ( void  )

trigger function for the LTC driver state machine.

This function contains the sequence of events in the LTC state machine. It must be called time-triggered, every 1ms.

Here is the call graph for this function:

◆ LTC_TX()

static STD_RETURN_TYPE_e LTC_TX ( uint8_t *  Command,
uint8_t *  DataBufferSPI_TX,
uint8_t *  DataBufferSPI_TX_with_PEC 
)
static

sends command and data to the LTC daisy-chain.

This is the core function to transmit data to the LTC6804 daisy-chain. The data sent is: COMMAND + 6 bytes (LTC1) + 6 bytes (LTC2) + 6 bytes (LTC3) + ... + 6 bytes (LTC{LTC_N_LTC}) A 2 byte command is sent with the corresponding PEC. Example: write configuration register (WRCFG). THe command has to be set and then the function calculates the PEC automatically. The function calculates the needed PEC to send the data to the daisy-chain. The sent data has the format: 2 byte-COMMAND (2 bytes PEC) + 6 bytes (LTC1) (2 bytes PEC) + 6 bytes (LTC2) (2 bytes PEC) + 6 bytes (LTC3) (2 bytes PEC) + ... + 6 bytes (LTC{LTC_N_LTC}) (2 bytes PEC)

The function returns 0. The only way to check if the transmission was successful is to read the results of the write operation. (example: read configuration register after writing to it)

Parameters
*Commandcommand sent to the daisy-chain
*DataBufferSPI_TXdata to be sent to the daisy-chain
*DataBufferSPI_TX_with_PECdata to sent to the daisy-chain, i.e. data to be sent + PEC (calculated by the function)
Returns
E_OK if SPI transmission is OK, E_NOT_OK otherwise
Here is the call graph for this function:

Variable Documentation

◆ ltc2_BC_cmdADOW_PDOWN_filtered_DCP0

const uint8_t ltc2_BC_cmdADOW_PDOWN_filtered_DCP0[4] = {0x03, 0xA8, 0xBF, 0xCE}
static

Broadcast, Pull-down current, All cells, filtered mode, discharge not permitted (DCP=0)

◆ ltc2_BC_cmdADOW_PDOWN_normal_DCP0

const uint8_t ltc2_BC_cmdADOW_PDOWN_normal_DCP0[4] = {0x03, 0x28, 0xFB, 0xE8}
static

Broadcast, Pull-down current, All cells, normal mode, discharge not permitted (DCP=0)

◆ ltc2_BC_cmdADOW_PUP_filtered_DCP0

const uint8_t ltc2_BC_cmdADOW_PUP_filtered_DCP0[4] = {0x03, 0xE8, 0x58, 0x44}
static

Broadcast, Pull-up current, All cells, filtered mode, discharge not permitted (DCP=0)

◆ ltc2_BC_cmdADOW_PUP_normal_DCP0

const uint8_t ltc2_BC_cmdADOW_PUP_normal_DCP0[4] = {0x03, 0x68, 0x1C, 0x62}
static

Broadcast, Pull-up current, All cells, normal mode, discharge not permitted (DCP=0)

◆ ltc_allgpiovoltage

DATA_BLOCK_ALLGPIOVOLTAGE_s ltc_allgpiovoltage
static

◆ ltc_balancing_control

DATA_BLOCK_BALANCING_CONTROL_s ltc_balancing_control
static

◆ ltc_balancing_feedback

DATA_BLOCK_BALANCING_FEEDBACK_s ltc_balancing_feedback
static

◆ ltc_celltemperature

DATA_BLOCK_CELLTEMPERATURE_s ltc_celltemperature
static

◆ ltc_cellvoltage

DATA_BLOCK_CELLVOLTAGE_s ltc_cellvoltage
static

◆ ltc_cmdADAX_fast_ALLGPIOS

const uint8_t ltc_cmdADAX_fast_ALLGPIOS[4] = {0x04, 0xE0, 0x1F, 0xCA}
static

All channels, fast mode

◆ ltc_cmdADAX_fast_GPIO1

const uint8_t ltc_cmdADAX_fast_GPIO1[4] = {0x04, 0xE1, 0x94, 0xF8}
static

Single channel, GPIO 1, fast mode

◆ ltc_cmdADAX_fast_GPIO2

const uint8_t ltc_cmdADAX_fast_GPIO2[4] = {0x04, 0xE2, 0x82, 0x9C}
static

Single channel, GPIO 2, fast mode

◆ ltc_cmdADAX_fast_GPIO3

const uint8_t ltc_cmdADAX_fast_GPIO3[4] = {0x04, 0xE3, 0x09, 0xAE}
static

Single channel, GPIO 3, fast mode

◆ ltc_cmdADAX_filtered_ALLGPIOS

const uint8_t ltc_cmdADAX_filtered_ALLGPIOS[4] = {0x05, 0xE0, 0x97, 0x86}
static

All channels, filtered mode

◆ ltc_cmdADAX_filtered_GPIO1

const uint8_t ltc_cmdADAX_filtered_GPIO1[4] = {0x05, 0xE1, 0x1C, 0xB4}
static

Single channel, GPIO 1, filtered mode

◆ ltc_cmdADAX_filtered_GPIO2

const uint8_t ltc_cmdADAX_filtered_GPIO2[4] = {0x05, 0xE2, 0x0A, 0xD0}
static

Single channel, GPIO 2, filtered mode

◆ ltc_cmdADAX_filtered_GPIO3

const uint8_t ltc_cmdADAX_filtered_GPIO3[4] = {0x05, 0xE3, 0x81, 0xE2}
static

Single channel, GPIO 3, filtered mode

◆ ltc_cmdADAX_normal_ALLGPIOS

const uint8_t ltc_cmdADAX_normal_ALLGPIOS[4] = {0x05, 0x60, 0xD3, 0xA0}
static

All channels, normal mode

◆ ltc_cmdADAX_normal_GPIO1

const uint8_t ltc_cmdADAX_normal_GPIO1[4] = {0x05, 0x61, 0x58, 0x92}
static

Single channel, GPIO 1, normal mode

◆ ltc_cmdADAX_normal_GPIO2

const uint8_t ltc_cmdADAX_normal_GPIO2[4] = {0x05, 0x62, 0x4E, 0xF6}
static

Single channel, GPIO 2, normal mode

◆ ltc_cmdADAX_normal_GPIO3

const uint8_t ltc_cmdADAX_normal_GPIO3[4] = {0x05, 0x63, 0xC5, 0xC4}
static

Single channel, GPIO 3, normal mode

◆ ltc_cmdADCV_fast_DCP0

const uint8_t ltc_cmdADCV_fast_DCP0[4] = {0x02, 0xE0, 0x38, 0x06}
static

All cells, fast mode, discharge not permitted (DCP=0)

◆ ltc_cmdADCV_fast_DCP0_twocells

const uint8_t ltc_cmdADCV_fast_DCP0_twocells[4] = {0x02, 0xE1, 0xb3, 0x34}
static

Two cells (1 and 7), fast mode, discharge not permitted (DCP=0)

◆ ltc_cmdADCV_fast_DCP1

const uint8_t ltc_cmdADCV_fast_DCP1[4] = {0x02, 0xF0, 0x63, 0x28}
static

All cells, fast mode, discharge permitted (DCP=1)

◆ ltc_cmdADCV_filtered_DCP0

const uint8_t ltc_cmdADCV_filtered_DCP0[4] = {0x03, 0xE0, 0xB0, 0x4A}
static

All cells, filtered mode, discharge not permitted (DCP=0)

◆ ltc_cmdADCV_filtered_DCP1

const uint8_t ltc_cmdADCV_filtered_DCP1[4] = {0x03, 0xF0, 0xEB, 0x64}
static

All cells, filtered mode, discharge permitted (DCP=1)

◆ ltc_cmdADCV_normal_DCP0

const uint8_t ltc_cmdADCV_normal_DCP0[4] = {0x03, 0x60, 0xF4, 0x6C}
static

All cells, normal mode, discharge not permitted (DCP=0)

◆ ltc_cmdADCV_normal_DCP1

const uint8_t ltc_cmdADCV_normal_DCP1[4] = {0x03, 0x70, 0xAF, 0x42}
static

All cells, normal mode, discharge permitted (DCP=1)

◆ ltc_cmdDummy

const uint8_t ltc_cmdDummy[1] ={0x00}
static

◆ ltc_cmdRDAUXA

const uint8_t ltc_cmdRDAUXA[4] = {0x00, 0x0C, 0xEF, 0xCC}
static

◆ ltc_cmdRDAUXB

const uint8_t ltc_cmdRDAUXB[4] = {0x00, 0x0E, 0x72, 0x9A}
static

◆ ltc_cmdRDAUXC

const uint8_t ltc_cmdRDAUXC[4] = {0x00, 0x0D, 0x64, 0xFE}
static

◆ ltc_cmdRDAUXD

const uint8_t ltc_cmdRDAUXD[4] = {0x00, 0x0F, 0xF9, 0xA8}
static

◆ ltc_cmdRDCOMM

const uint8_t ltc_cmdRDCOMM[4] = {0x07, 0x22, 0x32, 0xD6}
static

◆ ltc_cmdRDCVA

const uint8_t ltc_cmdRDCVA[4] = {0x00, 0x04, 0x07, 0xC2}
static

◆ ltc_cmdRDCVB

const uint8_t ltc_cmdRDCVB[4] = {0x00, 0x06, 0x9A, 0x94}
static

◆ ltc_cmdRDCVC

const uint8_t ltc_cmdRDCVC[4] = {0x00, 0x08, 0x5E, 0x52}
static

◆ ltc_cmdRDCVD

const uint8_t ltc_cmdRDCVD[4] = {0x00, 0x0A, 0xC3, 0x04}
static

◆ ltc_cmdRDCVE

const uint8_t ltc_cmdRDCVE[4] = {0x00, 0x09, 0xD5, 0x60}
static

◆ ltc_cmdRDCVF

const uint8_t ltc_cmdRDCVF[4] = {0x00, 0x0B, 0x48, 0x36}
static

◆ ltc_cmdSTCOMM

const uint8_t ltc_cmdSTCOMM[4] = {0x07, 0x23, 0xB9, 0xE4}
static

◆ ltc_cmdWRCFG

const uint8_t ltc_cmdWRCFG[4] ={0x00, 0x01, 0x3D, 0x6E}
static

◆ ltc_cmdWRCFG2

const uint8_t ltc_cmdWRCFG2[4] ={0x00, 0x24, 0xB1, 0x9E}
static

◆ ltc_cmdWRCOMM

const uint8_t ltc_cmdWRCOMM[4] = {0x07, 0x21, 0x24, 0xB2}
static

◆ LTC_ErrorTable

LTC_ERRORTABLE_s LTC_ErrorTable[LTC_N_LTC]
static

◆ ltc_I2CcmdPortExpander1

const uint8_t ltc_I2CcmdPortExpander1[6] = {0x64, 0x18, 0x0F, 0xF9, 0x7F, 0xF9}
static

reads one data byte from the port expander

◆ ltc_I2CcmdTempSens0

const uint8_t ltc_I2CcmdTempSens0[6] = {0x69, 0x08, 0x00, 0x09, 0x7F, 0xF9}
static

sets the internal data pointer of the temperature sensor (address 0x48) to 0x00

◆ ltc_I2CcmdTempSens1

const uint8_t ltc_I2CcmdTempSens1[6] = {0x69, 0x18, 0x0F, 0xF0, 0x0F, 0xF9}
static

reads two data bytes from the temperature sensor

◆ ltc_minmax

DATA_BLOCK_MINMAX_s ltc_minmax
static

◆ ltc_openwire

DATA_BLOCK_OPENWIRE_s ltc_openwire
static

◆ ltc_openwire_delta

int32_t ltc_openwire_delta[BS_NR_OF_BAT_CELLS]
static

◆ ltc_openwire_pdown_buffer

uint16_t ltc_openwire_pdown_buffer[BS_NR_OF_BAT_CELLS]
static

◆ ltc_openwire_pup_buffer

uint16_t ltc_openwire_pup_buffer[BS_NR_OF_BAT_CELLS]
static

◆ ltc_RXPECbuffer

uint8_t ltc_RXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION]
static

◆ ltc_slave_control

DATA_BLOCK_SLAVE_CONTROL_s ltc_slave_control
static

◆ ltc_state

LTC_STATE_s ltc_state
static
Initial value:
= {
.timer = 0,
.statereq = LTC_STATE_NO_REQUEST,
.substate = 0,
.lastsubstate = 0,
.adcModereq = LTC_ADCMODE_FAST_DCP0,
.adcMeasChreq = LTC_ADCMEAS_UNDEFINED,
.adcMeasCh = LTC_ADCMEAS_UNDEFINED,
.numberOfMeasuredMux = 32,
.triggerentry = 0,
.ErrRetryCounter = 0,
.ErrRequestCounter = 0,
.VoltageSampleTime = 0,
.muxSampleTime = 0,
.commandDataTransferTime = 3,
.commandTransferTime = 3,
.gpioClocksTransferTime = 3,
.muxmeas_seqptr = NULL_PTR,
.muxmeas_seqendptr = NULL_PTR,
.muxmeas_nr_end = 0,
.first_measurement_made = FALSE,
.ltc_muxcycle_finished = E_NOT_OK,
.check_spi_flag = FALSE,
.balance_control_done = FALSE,
}
Definition: ltc_defs.h:408
Definition: std_types.h:78
Definition: ltc_defs.h:74
Definition: ltc_defs.h:86
#define NULL_PTR
Definition: std_types.h:62
#define FALSE
Definition: std_types.h:65
Definition: ltc_defs.h:102

◆ ltc_TXBuffer

uint8_t ltc_TXBuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION_DATA_ONLY]
static

◆ ltc_TXBufferClock

uint8_t ltc_TXBufferClock[4+9]
static

◆ ltc_TXPECbuffer

uint8_t ltc_TXPECbuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION]
static

◆ ltc_TXPECBufferClock

uint8_t ltc_TXPECBufferClock[4+9]
static

◆ ltc_used_cells_index

uint8_t ltc_used_cells_index = 0
static

◆ ltc_user_mux

DATA_BLOCK_USER_MUX_s ltc_user_mux
static