foxBMS - Unit Tests  1.2.0
The foxBMS Unit Tests API Documentation
ltc_6813-1.c File Reference

Driver for the LTC monitoring chip. More...

#include "ltc_6813-1_cfg.h"
#include "ltc.h"
#include "HL_spi.h"
#include "HL_system.h"
#include "database.h"
#include "diag.h"
#include "io.h"
#include "ltc_pec.h"
#include "pex.h"
#include "os.h"
#include "afe_plausibility.h"
Include dependency graph for ltc_6813-1.c:

Go to the source code of this file.

Macros

#define LTC_MAX_SUPPORTED_CELLS   (12u)
 
#define TEST_LTC_DEFINE_GET(VARIABLE)
 
#define LTC_PORT_EXPANDER_TI_INPUT_REG_ADR   (0x00u)
 
#define LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR   (0x01u)
 
#define LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR   (0x03u)
 
#define LTC_ICOM_START   (0x60u)
 
#define LTC_ICOM_STOP   (0x10u)
 
#define LTC_ICOM_BLANK   (0x00u)
 
#define LTC_ICOM_NO_TRANSMIT   (0x70u)
 
#define LTC_FCOM_MASTER_ACK   (0x00u)
 
#define LTC_FCOM_MASTER_NACK   (0x08u)
 
#define LTC_FCOM_MASTER_NACK_STOP   (0x09u)
 

Functions

static void LTC_SetFirstMeasurementCycleFinished (LTC_STATE_s *ltc_state)
 sets the measurement initialization status. More...
 
static void LTC_Initialize_Database (LTC_STATE_s *ltc_state)
 in the database, initializes the fields related to the LTC drivers. More...
 
static void LTC_SaveBalancingFeedback (LTC_STATE_s *ltc_state, uint16_t *DataBufferSPI_RX, uint8_t stringNumber)
 stores the measured balancing feedback values in the database. More...
 
static void LTC_Get_BalancingControlValues (LTC_STATE_s *ltc_state)
 gets the balancing orders from the database. More...
 
static void LTC_SaveLastStates (LTC_STATE_s *ltc_state)
 Saves the last state and the last substate. More...
 
static void LTC_StateTransition (LTC_STATE_s *ltc_state, LTC_STATEMACH_e state, uint8_t substate, uint16_t timer_ms)
 function for setting LTC_Trigger state transitions More...
 
static void LTC_CondBasedStateTransition (LTC_STATE_s *ltc_state, STD_RETURN_TYPE_e retVal, DIAG_ID_e diagCode, LTC_STATEMACH_e state_ok, uint8_t substate_ok, uint16_t timer_ms_ok, LTC_STATEMACH_e 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 (LTC_STATE_s *ltc_state, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength, uint8_t registerSet, uint8_t stringNumber)
 sets the balancing according to the control values read in the database. More...
 
static void LTC_ResetErrorTable (LTC_STATE_s *ltc_state)
 resets the error table. More...
 
static STD_RETURN_TYPE_e LTC_Init (SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength)
 initialize the daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_StartVoltageMeasurement (SPI_INTERFACE_CONFIG_s *pSpiInterface, 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 (SPI_INTERFACE_CONFIG_s *pSpiInterface, 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 (SPI_INTERFACE_CONFIG_s *pSpiInterface, 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 (LTC_STATE_s *ltc_state, uint16_t *pRxBuff, uint8_t registerSet, uint8_t stringNumber)
 saves the voltage values read from the LTC daisy-chain. More...
 
static void LTC_SaveRXtoGPIOBuffer (LTC_STATE_s *ltc_state, uint16_t *pRxBuff, uint8_t registerSet, uint8_t stringNumber)
 saves the GPIO voltage values read from the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_RX_PECCheck (LTC_STATE_s *ltc_state, uint16_t *DataBufferSPI_RX_with_PEC, uint8_t stringNumber)
 checks if the data received from the daisy-chain is not corrupt. More...
 
static STD_RETURN_TYPE_e LTC_RX (uint16_t *Command, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength)
 send command to the LTC daisy-chain and receives data from the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_TX (uint16_t *Command, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength)
 sends command and data to the LTC daisy-chain. More...
 
static void LTC_SetMUXChCommand (uint16_t *pTxBuff, uint8_t mux, uint8_t channel)
 configures the data that will be sent to the LTC daisy-chain to configure multiplexer channels. More...
 
static STD_RETURN_TYPE_e LTC_SendEEPROMReadCommand (LTC_STATE_s *ltc_state, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength, uint8_t step)
 sends data to the LTC daisy-chain to read EEPROM on slaves. More...
 
static void LTC_SetEEPROMReadCommand (LTC_STATE_s *ltc_state, uint16_t *pTxBuff, uint8_t step)
 configures the data that will be sent to the LTC daisy-chain to read EEPROM on slaves. More...
 
static void LTC_EEPROMSaveReadValue (LTC_STATE_s *ltc_state, uint16_t *pRxBuff)
 saves the read values of the external EEPROMs read from the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_SendEEPROMWriteCommand (LTC_STATE_s *ltc_state, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength, uint8_t step)
 sends data to the LTC daisy-chain to write EEPROM on slaves. More...
 
static void LTC_SetEEPROMWriteCommand (LTC_STATE_s *ltc_state, uint16_t *pTxBuff, uint8_t step)
 configures the data that will be sent to the LTC daisy-chain to write EEPROM on slaves. More...
 
static STD_RETURN_TYPE_e LTC_SetMuxChannel (SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength, uint8_t mux, uint8_t channel)
 sends data to the LTC daisy-chain to configure multiplexer channels. More...
 
static STD_RETURN_TYPE_e LTC_SetPortExpander (LTC_STATE_s *ltc_state, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength)
 sends data to the LTC daisy-chain to control the user port expander More...
 
static void LTC_PortExpanderSaveValues (LTC_STATE_s *ltc_state, uint16_t *pRxBuff)
 saves the received values of the external port expander read from the LTC daisy-chain. More...
 
static void LTC_TempSensSaveTemp (LTC_STATE_s *ltc_state, uint16_t *pRxBuff)
 saves the temperature value of the external temperature sensors read from the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_SetPortExpanderDirection_TI (LTC_STATE_s *ltc_state, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength, LTC_PORT_EXPANDER_TI_DIRECTION_e direction)
 sends data to the LTC daisy-chain to control the user port expander from TI More...
 
static STD_RETURN_TYPE_e LTC_SetPortExpander_Output_TI (LTC_STATE_s *ltc_state, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength)
 sends data to the LTC daisy-chain to control the user port expander from TI More...
 
static STD_RETURN_TYPE_e LTC_GetPortExpander_Input_TI (LTC_STATE_s *ltc_state, SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength, uint8_t step)
 sends data to the LTC daisy-chain to control the user port expander from TI More...
 
static void LTC_PortExpanderSaveValues_TI (LTC_STATE_s *ltc_state, uint16_t *pTxBuff)
 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 (SPI_INTERFACE_CONFIG_s *pSpiInterface)
 sends 72 clock pulses to the LTC daisy-chain. More...
 
static STD_RETURN_TYPE_e LTC_Send_I2C_Command (SPI_INTERFACE_CONFIG_s *pSpiInterface, uint16_t *pTxBuff, uint16_t *pRxBuff, uint32_t frameLength, uint16_t *cmd_data)
 sends data to the LTC daisy-chain to communicate via I2C More...
 
static STD_RETURN_TYPE_e LTC_I2CCheckACK (LTC_STATE_s *ltc_state, uint16_t *pRxBuff, uint8_t mux, uint8_t stringNumber)
 checks if the multiplexers acknowledged transmission. More...
 
static void LTC_SaveMuxMeasurement (LTC_STATE_s *ltc_state, uint16_t *pRxBuff, LTC_MUX_CH_CFG_s *muxseqptr, uint8_t stringNumber)
 saves the multiplexer values read from the LTC daisy-chain. More...
 
static uint32_t LTC_GetSPIClock (SPI_INTERFACE_CONFIG_s *pSpiInterface)
 gets the frequency of the SPI clock. More...
 
static void LTC_SetTransferTimes (LTC_STATE_s *ltc_state)
 sets the transfer time needed to receive/send data with the LTC daisy-chain. More...
 
static LTC_RETURN_TYPE_e LTC_CheckStateRequest (LTC_STATE_s *ltc_state, LTC_REQUEST_s statereq)
 checks the state requests that are made. More...
 
void LTC_SaveVoltages (LTC_STATE_s *ltc_state, uint8_t stringNumber)
 stores the measured voltages in the database. More...
 
void LTC_SaveTemperatures (LTC_STATE_s *ltc_state, uint8_t stringNumber)
 stores the measured temperatures and the measured multiplexer feedbacks in the database. More...
 
void LTC_SaveAllGPIOMeasurement (LTC_STATE_s *ltc_state)
 stores the measured GPIOs in the database. More...
 
uint8_t LTC_CheckReEntrance (LTC_STATE_s *ltc_state)
 re-entrance check of LTC state machine trigger function More...
 
LTC_REQUEST_s LTC_GetStateRequest (LTC_STATE_s *ltc_state)
 gets the current state request. More...
 
LTC_STATEMACH_e LTC_GetState (LTC_STATE_s *ltc_state)
 gets the current state. More...
 
LTC_REQUEST_s LTC_TransferStateRequest (LTC_STATE_s *ltc_state, uint8_t *pBusIDptr, LTC_ADCMODE_e *pAdcModeptr, LTC_ADCMEAS_CHAN_e *pAdcMeasChptr)
 transfers the current state request to the state machine. More...
 
LTC_RETURN_TYPE_e LTC_SetStateRequest (LTC_STATE_s *ltc_state, LTC_REQUEST_s statereq)
 sets the current state request of the state variable ltc_state. More...
 
void LTC_Trigger (LTC_STATE_s *ltc_state)
 trigger function for the LTC driver state machine. More...
 
bool LTC_IsFirstMeasurementCycleFinished (LTC_STATE_s *ltc_state)
 gets the measurement initialization status. More...
 
void LTC_monitoringPinInit (void)
 Sets the transceiver pins to enable LTC6820 IC. More...
 
uint8_t TEST_LTC_CheckReEntrance (LTC_STATE_s *ltc_state)
 
void TEST_LTC_SetFirstMeasurementCycleFinished (LTC_STATE_s *ltc_state)
 
 TEST_LTC_DEFINE_GET (ltc_cmdWRCFG)
 
 TEST_LTC_DEFINE_GET (ltc_cmdWRCFG2)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCFG)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCVA)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCVB)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCVC)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCVD)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCVE)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCVF)
 
 TEST_LTC_DEFINE_GET (ltc_cmdWRCOMM)
 
 TEST_LTC_DEFINE_GET (ltc_cmdSTCOMM)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDCOMM)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDAUXA)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDAUXB)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDAUXC)
 
 TEST_LTC_DEFINE_GET (ltc_cmdRDAUXD)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADCV_normal_DCP0)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADCV_normal_DCP1)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADCV_filtered_DCP0)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADCV_filtered_DCP1)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADCV_fast_DCP0)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADCV_fast_DCP1)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADCV_fast_DCP0_twocells)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_normal_GPIO1)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_filtered_GPIO1)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_fast_GPIO1)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_normal_GPIO2)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_filtered_GPIO2)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_fast_GPIO2)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_normal_GPIO3)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_filtered_GPIO3)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_fast_GPIO3)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_normal_ALLGPIOS)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_filtered_ALLGPIOS)
 
 TEST_LTC_DEFINE_GET (ltc_cmdADAX_fast_ALLGPIOS)
 
 TEST_LTC_DEFINE_GET (ltc_BC_cmdADOW_PUP_normal_DCP0)
 
 TEST_LTC_DEFINE_GET (ltc_BC_cmdADOW_PDOWN_normal_DCP0)
 
 TEST_LTC_DEFINE_GET (ltc_BC_cmdADOW_PUP_filtered_DCP0)
 
 TEST_LTC_DEFINE_GET (ltc_BC_cmdADOW_PDOWN_filtered_DCP0)
 

Variables

static uint16_t ltc_used_cells_index [BS_NR_OF_STRINGS] = {0}
 
static LTC_OPENWIRE_DETECTION_s ltc_openWireDetection = {0}
 
static LTC_ERRORTABLE_s ltc_errorTable = {0}
 
static const AFE_PLAUSIBILITY_VALUES_s ltc_plausibleCellVoltages681x
 
LTC_STATE_s ltc_stateBase
 
static uint16_t ltc_cmdWRCFG [4] = {0x00, 0x01, 0x3D, 0x6E}
 
static uint16_t ltc_cmdWRCFG2 [4] = {0x00, 0x24, 0xB1, 0x9E}
 
static uint16_t ltc_cmdRDCFG [4] = {0x00, 0x02, 0x2B, 0x0A}
 
static uint16_t ltc_cmdRDCVA [4] = {0x00, 0x04, 0x07, 0xC2}
 
static uint16_t ltc_cmdRDCVB [4] = {0x00, 0x06, 0x9A, 0x94}
 
static uint16_t ltc_cmdRDCVC [4] = {0x00, 0x08, 0x5E, 0x52}
 
static uint16_t ltc_cmdRDCVD [4] = {0x00, 0x0A, 0xC3, 0x04}
 
static uint16_t ltc_cmdRDCVE [4] = {0x00, 0x09, 0xD5, 0x60}
 
static uint16_t ltc_cmdRDCVF [4] = {0x00, 0x0B, 0x48, 0x36}
 
static uint16_t ltc_cmdWRCOMM [4] = {0x07, 0x21, 0x24, 0xB2}
 
static uint16_t ltc_cmdSTCOMM [4] = {0x07, 0x23, 0xB9, 0xE4}
 
static uint16_t ltc_cmdRDCOMM [4] = {0x07, 0x22, 0x32, 0xD6}
 
static uint16_t ltc_cmdRDAUXA [4] = {0x00, 0x0C, 0xEF, 0xCC}
 
static uint16_t ltc_cmdRDAUXB [4] = {0x00, 0x0E, 0x72, 0x9A}
 
static uint16_t ltc_cmdRDAUXC [4] = {0x00, 0x0D, 0x64, 0xFE}
 
static uint16_t ltc_cmdRDAUXD [4] = {0x00, 0x0F, 0xF9, 0xA8}
 
static uint16_t ltc_I2CcmdTempSens0 [6]
 
static uint16_t ltc_I2CcmdTempSens1 [6]
 
static uint16_t ltc_I2CcmdPortExpander1 [6]
 
static uint16_t ltc_cmdADCV_normal_DCP0 [4]
 
static uint16_t ltc_cmdADCV_normal_DCP1 [4]
 
static uint16_t ltc_cmdADCV_filtered_DCP0 [4]
 
static uint16_t ltc_cmdADCV_filtered_DCP1 [4]
 
static uint16_t ltc_cmdADCV_fast_DCP0 [4]
 
static uint16_t ltc_cmdADCV_fast_DCP1 [4]
 
static uint16_t ltc_cmdADCV_fast_DCP0_twocells [4]
 
static uint16_t ltc_cmdADAX_normal_GPIO1 [4] = {0x05, 0x61, 0x58, 0x92}
 
static uint16_t ltc_cmdADAX_filtered_GPIO1 [4] = {0x05, 0xE1, 0x1C, 0xB4}
 
static uint16_t ltc_cmdADAX_fast_GPIO1 [4] = {0x04, 0xE1, 0x94, 0xF8}
 
static uint16_t ltc_cmdADAX_normal_GPIO2 [4] = {0x05, 0x62, 0x4E, 0xF6}
 
static uint16_t ltc_cmdADAX_filtered_GPIO2 [4] = {0x05, 0xE2, 0x0A, 0xD0}
 
static uint16_t ltc_cmdADAX_fast_GPIO2 [4] = {0x04, 0xE2, 0x82, 0x9C}
 
static uint16_t ltc_cmdADAX_normal_GPIO3 [4] = {0x05, 0x63, 0xC5, 0xC4}
 
static uint16_t ltc_cmdADAX_filtered_GPIO3 [4] = {0x05, 0xE3, 0x81, 0xE2}
 
static uint16_t ltc_cmdADAX_fast_GPIO3 [4] = {0x04, 0xE3, 0x09, 0xAE}
 
static uint16_t ltc_cmdADAX_normal_ALLGPIOS [4] = {0x05, 0x60, 0xD3, 0xA0}
 
static uint16_t ltc_cmdADAX_filtered_ALLGPIOS [4]
 
static uint16_t ltc_cmdADAX_fast_ALLGPIOS [4] = {0x04, 0xE0, 0x1F, 0xCA}
 
static uint16_t ltc_BC_cmdADOW_PUP_normal_DCP0 [4]
 
static uint16_t ltc_BC_cmdADOW_PDOWN_normal_DCP0 [4]
 
static uint16_t ltc_BC_cmdADOW_PUP_filtered_DCP0 [4]
 
static uint16_t ltc_BC_cmdADOW_PDOWN_filtered_DCP0 [4]
 
uint16_t ltc_RxPecBuffer [LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}
 
uint16_t ltc_TxPecBuffer [LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}
 
static DATA_BLOCK_CELL_VOLTAGE_s ltc_cellvoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}
 
static DATA_BLOCK_CELL_TEMPERATURE_s ltc_celltemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE}
 
static DATA_BLOCK_BALANCING_FEEDBACK_s ltc_balancing_feedback
 
static DATA_BLOCK_BALANCING_CONTROL_s ltc_balancing_control = {.header.uniqueId = DATA_BLOCK_ID_BALANCING_CONTROL}
 
static DATA_BLOCK_SLAVE_CONTROL_s ltc_slave_control = {.header.uniqueId = DATA_BLOCK_ID_SLAVE_CONTROL}
 
static DATA_BLOCK_ALL_GPIO_VOLTAGES_s ltc_allgpiovoltage = {.header.uniqueId = DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE}
 
static DATA_BLOCK_OPEN_WIRE_s ltc_openwire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}
 

Detailed Description

Driver for the LTC monitoring chip.

SPDX-License-Identifier: BSD-3-Clause

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
2019-09-01 (date of creation)
Updated
2021-09-30 (date of last update)
Prefix
LTC

Definition in file ltc_6813-1.c.

Macro Definition Documentation

◆ LTC_FCOM_MASTER_ACK

#define LTC_FCOM_MASTER_ACK   (0x00u)

LTC COMM definitions

Definition at line 90 of file ltc_6813-1.c.

◆ LTC_FCOM_MASTER_NACK

#define LTC_FCOM_MASTER_NACK   (0x08u)

LTC COMM definitions

Definition at line 91 of file ltc_6813-1.c.

◆ LTC_FCOM_MASTER_NACK_STOP

#define LTC_FCOM_MASTER_NACK_STOP   (0x09u)

LTC COMM definitions

Definition at line 92 of file ltc_6813-1.c.

◆ LTC_ICOM_BLANK

#define LTC_ICOM_BLANK   (0x00u)

LTC COMM definitions

Definition at line 88 of file ltc_6813-1.c.

◆ LTC_ICOM_NO_TRANSMIT

#define LTC_ICOM_NO_TRANSMIT   (0x70u)

LTC COMM definitions

Definition at line 89 of file ltc_6813-1.c.

◆ LTC_ICOM_START

#define LTC_ICOM_START   (0x60u)

LTC COMM definitions

Definition at line 86 of file ltc_6813-1.c.

◆ LTC_ICOM_STOP

#define LTC_ICOM_STOP   (0x10u)

LTC COMM definitions

Definition at line 87 of file ltc_6813-1.c.

◆ LTC_MAX_SUPPORTED_CELLS

#define LTC_MAX_SUPPORTED_CELLS   (12u)

maximum number of supported cells

Definition at line 96 of file ltc_6813-1.c.

◆ LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR

#define LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR   (0x03u)

TI port expander register addresses

Definition at line 79 of file ltc_6813-1.c.

◆ LTC_PORT_EXPANDER_TI_INPUT_REG_ADR

#define LTC_PORT_EXPANDER_TI_INPUT_REG_ADR   (0x00u)

TI port expander register addresses

Definition at line 77 of file ltc_6813-1.c.

◆ LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR

#define LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR   (0x01u)

TI port expander register addresses

Definition at line 78 of file ltc_6813-1.c.

◆ TEST_LTC_DEFINE_GET

#define TEST_LTC_DEFINE_GET (   VARIABLE)
Value:
extern void TEST_LTC_Get_##VARIABLE(uint8_t data[4]) { \
for (uint8_t i = 0u; i < 4u; i++) { \
data[i] = (uint8_t)(VARIABLE)[i]; \
} \
}

this define is used for creating the declaration of a function for variable extraction

Definition at line 4637 of file ltc_6813-1.c.

Function Documentation

◆ LTC_BalanceControl()

static STD_RETURN_TYPE_e LTC_BalanceControl ( LTC_STATE_s ltc_state,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength,
uint8_t  registerSet,
uint8_t  stringNumber 
)
static

sets the balancing according to the control values read in the database.

To set balancing for the cells, the corresponding bits have to be written in the configuration register. The LTC driver only executes the balancing orders written by the BMS in the database.

Parameters
ltc_statestate of the ltc state machine
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
registerSetregister Set, 0: cells 1 to 12 (WRCFG), 1: cells 13 to 15/18 (WRCFG2)
stringNumberstring addressed
Returns
STD_OK if dummy byte was sent correctly by SPI, STD_NOT_OK otherwise

Definition at line 3379 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_CheckReEntrance()

uint8_t LTC_CheckReEntrance ( LTC_STATE_s ltc_state)

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.

Parameters
ltc_statestate of the ltc state machine
Returns
retval 0 if no further instance of the function is active, 0xff else

Definition at line 714 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_CheckStateRequest()

static LTC_RETURN_TYPE_e LTC_CheckStateRequest ( LTC_STATE_s ltc_state,
LTC_REQUEST_s  statereq 
)
static

checks the state requests that are made.

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

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

Definition at line 4565 of file ltc_6813-1.c.

◆ LTC_CondBasedStateTransition()

static void LTC_CondBasedStateTransition ( LTC_STATE_s ltc_state,
STD_RETURN_TYPE_e  retVal,
DIAG_ID_e  diagCode,
LTC_STATEMACH_e  state_ok,
uint8_t  substate_ok,
uint16_t  timer_ms_ok,
LTC_STATEMACH_e  state_nok,
uint8_t  substate_nok,
uint16_t  timer_ms_nok 
)
static

condition-based state transition depending on retVal

If retVal is STD_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
ltc_statestate of the ltc state machine
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 STD_OK, DIAG_EVENT_NOT_OK otherwise
state_okstate to transition into if retVal is STD_OK
substate_oksubstate to transition into if retVal is STD_OK
timer_ms_oktransition into state_ok, substate_ok after timer_ms_ok elapsed
state_nokstate to transition into if retVal is STD_NOT_OK
substate_noksubstate to transition into if retVal is STD_NOT_OK
timer_ms_noktransition into state_nok, substate_nok after timer_ms_nok elapsed

Definition at line 542 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_EEPROMSaveReadValue()

static void LTC_EEPROMSaveReadValue ( LTC_STATE_s ltc_state,
uint16_t *  pRxBuff 
)
static

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

Parameters
ltc_statestate of the ltc state machine
pRxBuffreceive buffer

Definition at line 4026 of file ltc_6813-1.c.

◆ LTC_Get_BalancingControlValues()

static void LTC_Get_BalancingControlValues ( LTC_STATE_s ltc_state)
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.

Parameters
ltc_statestate of the ltc state machine

Definition at line 697 of file ltc_6813-1.c.

◆ 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

Definition at line 3566 of file ltc_6813-1.c.

◆ LTC_GetPortExpander_Input_TI()

static STD_RETURN_TYPE_e LTC_GetPortExpander_Input_TI ( LTC_STATE_s ltc_state,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength,
uint8_t  step 
)
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
ltc_statestate of the ltc state machine
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
stepfirst or second stage of read process (0 or 1)
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 4385 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_GetSPIClock()

static uint32_t LTC_GetSPIClock ( SPI_INTERFACE_CONFIG_s pSpiInterface)
static

gets the frequency of the SPI clock.

This function reads the configuration from the SPI handle directly.

Parameters
pSpiInterfacepointer to SPI configuration
Returns
frequency of the SPI clock

Definition at line 4487 of file ltc_6813-1.c.

◆ LTC_GetState()

LTC_STATEMACH_e LTC_GetState ( LTC_STATE_s ltc_state)

gets the current state.

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

Parameters
ltc_statestate of the ltc state machine
Returns
current state, taken from LTC_STATEMACH_e

Definition at line 739 of file ltc_6813-1.c.

◆ LTC_GetStateRequest()

LTC_REQUEST_s LTC_GetStateRequest ( LTC_STATE_s ltc_state)

gets the current state request.

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

Parameters
ltc_statestate of the ltc state machine
Returns
retval current state request, taken from LTC_STATE_REQUEST_e

Definition at line 728 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_I2CCheckACK()

static STD_RETURN_TYPE_e LTC_I2CCheckACK ( LTC_STATE_s ltc_state,
uint16_t *  pRxBuff,
uint8_t  mux,
uint8_t  stringNumber 
)
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 error table is updated to locate the multiplexers that did not acknowledge transmission.

Parameters
ltc_statestate of the ltc state machine
pRxBuffreceive buffer
muxmultiplexer to be addressed (multiplexer ID)
stringNumberstring addressed
Returns
muxError STD_OK is there was no error, STD_NOT_OK if there was errors

Definition at line 3263 of file ltc_6813-1.c.

◆ LTC_I2CClock()

static STD_RETURN_TYPE_e LTC_I2CClock ( SPI_INTERFACE_CONFIG_s pSpiInterface)
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
pSpiInterfacepointer to SPI configuration
Returns
statusSPI STD_OK if clock pulses were sent correctly by SPI, STD_NOT_OK otherwise

Definition at line 4460 of file ltc_6813-1.c.

◆ LTC_Init()

static STD_RETURN_TYPE_e LTC_Init ( SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength 
)
static

initialize the daisy-chain.

To initialize the LTC6804 daisy-chain, a dummy byte (0x00) is sent.

Parameters
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
Returns
retVal STD_OK if dummy byte was sent correctly by SPI, STD_NOT_OK otherwise

Definition at line 3318 of file ltc_6813-1.c.

◆ LTC_Initialize_Database()

static void LTC_Initialize_Database ( LTC_STATE_s ltc_state)
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.

Parameters
ltc_statestate of the ltc state machine

Definition at line 444 of file ltc_6813-1.c.

◆ LTC_IsFirstMeasurementCycleFinished()

bool LTC_IsFirstMeasurementCycleFinished ( LTC_STATE_s ltc_state)

gets the measurement initialization status.

Parameters
ltc_statestate of the ltc state machine
Returns
true if a first measurement cycle was made, false otherwise

Definition at line 4587 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_monitoringPinInit()

void LTC_monitoringPinInit ( void  )

Sets the transceiver pins to enable LTC6820 IC.

Definition at line 4606 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_PortExpanderSaveValues()

static void LTC_PortExpanderSaveValues ( LTC_STATE_s ltc_state,
uint16_t *  pRxBuff 
)
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
ltc_statestate of the ltc state machine
pRxBuffreceive buffer

Definition at line 4266 of file ltc_6813-1.c.

◆ LTC_PortExpanderSaveValues_TI()

static void LTC_PortExpanderSaveValues_TI ( LTC_STATE_s ltc_state,
uint16_t *  pTxBuff 
)
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
ltc_statestate of the ltc state machine
pTxBufftransmit buffer

Definition at line 4437 of file ltc_6813-1.c.

◆ LTC_ResetErrorTable()

static void LTC_ResetErrorTable ( LTC_STATE_s ltc_state)
static

resets the error table.

This function should be called during initialization or before starting a new measurement cycle

Parameters
ltc_statestate of the ltc state machine

Definition at line 3540 of file ltc_6813-1.c.

◆ LTC_RX()

static STD_RETURN_TYPE_e LTC_RX ( uint16_t *  Command,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength 
)
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
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
Returns
statusSPI STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 3824 of file ltc_6813-1.c.

◆ LTC_RX_PECCheck()

static STD_RETURN_TYPE_e LTC_RX_PECCheck ( LTC_STATE_s ltc_state,
uint16_t *  DataBufferSPI_RX_with_PEC,
uint8_t  stringNumber 
)
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
ltc_statestate of the ltc state machine
DataBufferSPI_RX_with_PECdata obtained from the SPI transmission
stringNumberstring addressed
Returns
retVal STD_OK if PEC check is OK, STD_NOT_OK otherwise

Definition at line 3762 of file ltc_6813-1.c.

◆ LTC_SaveAllGPIOMeasurement()

void LTC_SaveAllGPIOMeasurement ( LTC_STATE_s ltc_state)

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.

Parameters
ltc_statestate of the ltc state machine

Definition at line 661 of file ltc_6813-1.c.

◆ LTC_SaveBalancingFeedback()

static void LTC_SaveBalancingFeedback ( LTC_STATE_s ltc_state,
uint16_t *  DataBufferSPI_RX,
uint8_t  stringNumber 
)
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

Parameters
ltc_statestate of the ltc state machine
DataBufferSPI_RXreceive buffer of the SPI interface
stringNumberstring addressed

Definition at line 676 of file ltc_6813-1.c.

◆ LTC_SaveLastStates()

static void LTC_SaveLastStates ( LTC_STATE_s ltc_state)
static

Saves the last state and the last substate.

Parameters
ltc_statestate of the ltc state machine

Definition at line 505 of file ltc_6813-1.c.

◆ LTC_SaveMuxMeasurement()

static void LTC_SaveMuxMeasurement ( LTC_STATE_s ltc_state,
uint16_t *  pRxBuff,
LTC_MUX_CH_CFG_s muxseqptr,
uint8_t  stringNumber 
)
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
ltc_statestate of the ltc state machine
pRxBuffreceive buffer
muxseqptrpointer to the multiplexer sequence, which configures the currently selected multiplexer ID and channel
stringNumberstring addressed

Definition at line 2931 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SaveRXtoGPIOBuffer()

static void LTC_SaveRXtoGPIOBuffer ( LTC_STATE_s ltc_state,
uint16_t *  pRxBuff,
uint8_t  registerSet,
uint8_t  stringNumber 
)
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
ltc_statestate of the ltc state machine
pRxBuffreceive buffer
registerSetvoltage register that was read (auxiliary register A, B, C or D)
stringNumberstring addressed

Definition at line 3120 of file ltc_6813-1.c.

◆ LTC_SaveRXtoVoltagebuffer()

static void LTC_SaveRXtoVoltagebuffer ( LTC_STATE_s ltc_state,
uint16_t *  pRxBuff,
uint8_t  registerSet,
uint8_t  stringNumber 
)
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
ltc_statestate of the ltc state machine
pRxBuffreceive buffer
registerSetvoltage register that was read (voltage register A,B,C,D,E or F)
stringNumberstring addressed

Definition at line 3010 of file ltc_6813-1.c.

◆ LTC_SaveTemperatures()

void LTC_SaveTemperatures ( LTC_STATE_s ltc_state,
uint8_t  stringNumber 
)

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.

Parameters
ltc_statestate of the ltc state machine
stringNumberstring addressed

Definition at line 623 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SaveVoltages()

void LTC_SaveVoltages ( LTC_STATE_s ltc_state,
uint8_t  stringNumber 
)

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.

Parameters
ltc_statestate of the ltc state machine
stringNumberstring addressed

Definition at line 561 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_Send_I2C_Command()

static STD_RETURN_TYPE_e LTC_Send_I2C_Command ( SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength,
uint16_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
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
cmd_datacommand data to be sent
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 4160 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SendEEPROMReadCommand()

static STD_RETURN_TYPE_e LTC_SendEEPROMReadCommand ( LTC_STATE_s ltc_state,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength,
uint8_t  step 
)
static

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

Parameters
ltc_statestate of the ltc state machine
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
stepfirst or second stage of read process (0 or 1)
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 3963 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SendEEPROMWriteCommand()

static STD_RETURN_TYPE_e LTC_SendEEPROMWriteCommand ( LTC_STATE_s ltc_state,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength,
uint8_t  step 
)
static

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

Parameters
ltc_statestate of the ltc state machine
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
stepfirst or second stage of read process (0 or 1)
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 4053 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SetEEPROMReadCommand()

static void LTC_SetEEPROMReadCommand ( LTC_STATE_s ltc_state,
uint16_t *  pTxBuff,
uint8_t  step 
)
static

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

Parameters
ltc_statestate of the ltc state machine
pTxBufftransmit buffer
stepfirst or second stage of read process (0 or 1)

Definition at line 3987 of file ltc_6813-1.c.

◆ LTC_SetEEPROMWriteCommand()

static void LTC_SetEEPROMWriteCommand ( LTC_STATE_s ltc_state,
uint16_t *  pTxBuff,
uint8_t  step 
)
static

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

Parameters
ltc_statestate of the ltc state machine
pTxBufftransmit buffer
stepfirst or second stage of read process (0 or 1)

Definition at line 4077 of file ltc_6813-1.c.

◆ LTC_SetFirstMeasurementCycleFinished()

static void LTC_SetFirstMeasurementCycleFinished ( LTC_STATE_s ltc_state)
static

sets the measurement initialization status.

Definition at line 4600 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SetMuxChannel()

static STD_RETURN_TYPE_e LTC_SetMuxChannel ( SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength,
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
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
muxmultiplexer ID to be configured (0,1,2 or 3)
channelmultiplexer channel to be configured (0 to 7)
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 4131 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SetMUXChCommand()

static void LTC_SetMUXChCommand ( uint16_t *  pTxBuff,
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
pTxBufftransmit buffer
muxmultiplexer ID to be configured (0,1,2 or 3)
channelmultiplexer channel to be configured (0 to 7)

Definition at line 3919 of file ltc_6813-1.c.

◆ LTC_SetPortExpander()

static STD_RETURN_TYPE_e LTC_SetPortExpander ( LTC_STATE_s ltc_state,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength 
)
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
ltc_statestate of the ltc state machine
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 4222 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SetPortExpander_Output_TI()

static STD_RETURN_TYPE_e LTC_SetPortExpander_Output_TI ( LTC_STATE_s ltc_state,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength 
)
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
ltc_statestate of the ltc state machine
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 4338 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SetPortExpanderDirection_TI()

static STD_RETURN_TYPE_e LTC_SetPortExpanderDirection_TI ( LTC_STATE_s ltc_state,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength,
LTC_PORT_EXPANDER_TI_DIRECTION_e  direction 
)
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
ltc_statestate of the ltc state machine
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
directionuse port expander pin as input or output
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 4292 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SetStateRequest()

LTC_RETURN_TYPE_e LTC_SetStateRequest ( LTC_STATE_s ltc_state,
LTC_REQUEST_s  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
ltc_statestate of the ltc state machine
statereqstate request to set
Returns
current state request, taken from LTC_STATE_REQUEST_e

Definition at line 777 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_SetTransferTimes()

static void LTC_SetTransferTimes ( LTC_STATE_s ltc_state)
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.

Parameters
ltc_statestate of the ltc state machine

Definition at line 4528 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_StartGPIOMeasurement()

static STD_RETURN_TYPE_e LTC_StartGPIOMeasurement ( SPI_INTERFACE_CONFIG_s pSpiInterface,
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
pSpiInterfacepointer to SPI configuration
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 STD_OK if dummy byte was sent correctly by SPI, STD_NOT_OK otherwise

Definition at line 3653 of file ltc_6813-1.c.

◆ LTC_StartOpenWireMeasurement()

static STD_RETURN_TYPE_e LTC_StartOpenWireMeasurement ( SPI_INTERFACE_CONFIG_s pSpiInterface,
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
pSpiInterfacepointer to SPI configuration
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 STD_OK if command was sent correctly by SPI, STD_NOT_OK otherwise

Definition at line 3720 of file ltc_6813-1.c.

◆ LTC_StartVoltageMeasurement()

static STD_RETURN_TYPE_e LTC_StartVoltageMeasurement ( SPI_INTERFACE_CONFIG_s pSpiInterface,
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
pSpiInterfacepointer to SPI configuration
adcModeLTC ADCmeasurement mode (fast, normal or filtered)
adcMeasChnumber of cell voltage measured (2 cells or all cells)
Returns
retVal STD_OK if dummy byte was sent correctly by SPI, STD_NOT_OK otherwise

Definition at line 3607 of file ltc_6813-1.c.

◆ LTC_StateTransition()

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

function for setting LTC_Trigger state transitions

Parameters
ltc_statestate of the ltc state machine
statestate to transition into
substatesubstate to transition into
timer_mstransition into state, substate after timer elapsed

Definition at line 518 of file ltc_6813-1.c.

◆ LTC_TempSensSaveTemp()

static void LTC_TempSensSaveTemp ( LTC_STATE_s ltc_state,
uint16_t *  pRxBuff 
)
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
ltc_statestate of the ltc state machine
pRxBuffreceive buffer

Definition at line 4194 of file ltc_6813-1.c.

◆ LTC_TransferStateRequest()

LTC_REQUEST_s LTC_TransferStateRequest ( LTC_STATE_s ltc_state,
uint8_t *  pBusIDptr,
LTC_ADCMODE_e pAdcModeptr,
LTC_ADCMEAS_CHAN_e pAdcMeasChptr 
)

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
ltc_statestate of the ltc state machine
pBusIDptrbus ID, main or backup (deprecated)
pAdcModeptrLTC ADCmeasurement mode (fast, normal or filtered)
pAdcMeasChptrnumber 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

Definition at line 757 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_Trigger()

void LTC_Trigger ( LTC_STATE_s ltc_state)

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.

Definition at line 791 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ LTC_TX()

static STD_RETURN_TYPE_e LTC_TX ( uint16_t *  Command,
SPI_INTERFACE_CONFIG_s pSpiInterface,
uint16_t *  pTxBuff,
uint16_t *  pRxBuff,
uint32_t  frameLength 
)
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
pSpiInterfacepointer to SPI configuration
pTxBufftransmit buffer
pRxBuffreceive buffer
frameLengthnumber of words to transmit
Returns
STD_OK if SPI transmission is OK, STD_NOT_OK otherwise

Definition at line 3873 of file ltc_6813-1.c.

◆ TEST_LTC_CheckReEntrance()

uint8_t TEST_LTC_CheckReEntrance ( LTC_STATE_s ltc_state)

Definition at line 4628 of file ltc_6813-1.c.

Here is the call graph for this function:

◆ TEST_LTC_DEFINE_GET() [1/39]

TEST_LTC_DEFINE_GET ( ltc_BC_cmdADOW_PDOWN_filtered_DCP0  )

◆ TEST_LTC_DEFINE_GET() [2/39]

TEST_LTC_DEFINE_GET ( ltc_BC_cmdADOW_PDOWN_normal_DCP0  )

◆ TEST_LTC_DEFINE_GET() [3/39]

TEST_LTC_DEFINE_GET ( ltc_BC_cmdADOW_PUP_filtered_DCP0  )

◆ TEST_LTC_DEFINE_GET() [4/39]

TEST_LTC_DEFINE_GET ( ltc_BC_cmdADOW_PUP_normal_DCP0  )

◆ TEST_LTC_DEFINE_GET() [5/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_fast_ALLGPIOS  )

◆ TEST_LTC_DEFINE_GET() [6/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_fast_GPIO1  )

◆ TEST_LTC_DEFINE_GET() [7/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_fast_GPIO2  )

◆ TEST_LTC_DEFINE_GET() [8/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_fast_GPIO3  )

◆ TEST_LTC_DEFINE_GET() [9/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_filtered_ALLGPIOS  )

◆ TEST_LTC_DEFINE_GET() [10/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_filtered_GPIO1  )

◆ TEST_LTC_DEFINE_GET() [11/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_filtered_GPIO2  )

◆ TEST_LTC_DEFINE_GET() [12/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_filtered_GPIO3  )

◆ TEST_LTC_DEFINE_GET() [13/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_normal_ALLGPIOS  )

◆ TEST_LTC_DEFINE_GET() [14/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_normal_GPIO1  )

◆ TEST_LTC_DEFINE_GET() [15/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_normal_GPIO2  )

◆ TEST_LTC_DEFINE_GET() [16/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADAX_normal_GPIO3  )

◆ TEST_LTC_DEFINE_GET() [17/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADCV_fast_DCP0  )

◆ TEST_LTC_DEFINE_GET() [18/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADCV_fast_DCP0_twocells  )

◆ TEST_LTC_DEFINE_GET() [19/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADCV_fast_DCP1  )

◆ TEST_LTC_DEFINE_GET() [20/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADCV_filtered_DCP0  )

◆ TEST_LTC_DEFINE_GET() [21/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADCV_filtered_DCP1  )

◆ TEST_LTC_DEFINE_GET() [22/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADCV_normal_DCP0  )

◆ TEST_LTC_DEFINE_GET() [23/39]

TEST_LTC_DEFINE_GET ( ltc_cmdADCV_normal_DCP1  )

◆ TEST_LTC_DEFINE_GET() [24/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDAUXA  )

◆ TEST_LTC_DEFINE_GET() [25/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDAUXB  )

◆ TEST_LTC_DEFINE_GET() [26/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDAUXC  )

◆ TEST_LTC_DEFINE_GET() [27/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDAUXD  )

◆ TEST_LTC_DEFINE_GET() [28/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCFG  )

◆ TEST_LTC_DEFINE_GET() [29/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCOMM  )

◆ TEST_LTC_DEFINE_GET() [30/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCVA  )

◆ TEST_LTC_DEFINE_GET() [31/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCVB  )

◆ TEST_LTC_DEFINE_GET() [32/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCVC  )

◆ TEST_LTC_DEFINE_GET() [33/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCVD  )

◆ TEST_LTC_DEFINE_GET() [34/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCVE  )

◆ TEST_LTC_DEFINE_GET() [35/39]

TEST_LTC_DEFINE_GET ( ltc_cmdRDCVF  )

◆ TEST_LTC_DEFINE_GET() [36/39]

TEST_LTC_DEFINE_GET ( ltc_cmdSTCOMM  )

◆ TEST_LTC_DEFINE_GET() [37/39]

TEST_LTC_DEFINE_GET ( ltc_cmdWRCFG  )

◆ TEST_LTC_DEFINE_GET() [38/39]

TEST_LTC_DEFINE_GET ( ltc_cmdWRCFG2  )

◆ TEST_LTC_DEFINE_GET() [39/39]

TEST_LTC_DEFINE_GET ( ltc_cmdWRCOMM  )

◆ TEST_LTC_SetFirstMeasurementCycleFinished()

void TEST_LTC_SetFirstMeasurementCycleFinished ( LTC_STATE_s ltc_state)

Definition at line 4632 of file ltc_6813-1.c.

Here is the call graph for this function:

Variable Documentation

◆ ltc_allgpiovoltage

DATA_BLOCK_ALL_GPIO_VOLTAGES_s ltc_allgpiovoltage = {.header.uniqueId = DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE}
static

local copies of database tables

Definition at line 119 of file ltc_6813-1.c.

◆ ltc_balancing_control

DATA_BLOCK_BALANCING_CONTROL_s ltc_balancing_control = {.header.uniqueId = DATA_BLOCK_ID_BALANCING_CONTROL}
static

local copies of database tables

Definition at line 117 of file ltc_6813-1.c.

◆ ltc_balancing_feedback

DATA_BLOCK_BALANCING_FEEDBACK_s ltc_balancing_feedback
static
Initial value:
= {
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE
Definition: database_cfg.h:79

local copies of database tables

Definition at line 115 of file ltc_6813-1.c.

◆ ltc_BC_cmdADOW_PDOWN_filtered_DCP0

uint16_t ltc_BC_cmdADOW_PDOWN_filtered_DCP0[4]
static
Initial value:
= {
0x03,
0xA8,
0xBF,
0xCE}

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

Definition at line 276 of file ltc_6813-1.c.

◆ ltc_BC_cmdADOW_PDOWN_normal_DCP0

uint16_t ltc_BC_cmdADOW_PDOWN_normal_DCP0[4]
static
Initial value:
= {
0x03,
0x28,
0xFB,
0xE8}

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

Definition at line 266 of file ltc_6813-1.c.

◆ ltc_BC_cmdADOW_PUP_filtered_DCP0

uint16_t ltc_BC_cmdADOW_PUP_filtered_DCP0[4]
static
Initial value:
= {
0x03,
0xE8,
0x58,
0x44}

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

Definition at line 271 of file ltc_6813-1.c.

◆ ltc_BC_cmdADOW_PUP_normal_DCP0

uint16_t ltc_BC_cmdADOW_PUP_normal_DCP0[4]
static
Initial value:
= {
0x03,
0x68,
0x1C,
0x62}

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

Definition at line 261 of file ltc_6813-1.c.

◆ ltc_celltemperature

DATA_BLOCK_CELL_TEMPERATURE_s ltc_celltemperature = {.header.uniqueId = DATA_BLOCK_ID_CELL_TEMPERATURE_BASE}
static

local copies of database tables

Definition at line 114 of file ltc_6813-1.c.

◆ ltc_cellvoltage

DATA_BLOCK_CELL_VOLTAGE_s ltc_cellvoltage = {.header.uniqueId = DATA_BLOCK_ID_CELL_VOLTAGE_BASE}
static

local copies of database tables

Definition at line 113 of file ltc_6813-1.c.

◆ ltc_cmdADAX_fast_ALLGPIOS

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

All channels, fast mode

Definition at line 258 of file ltc_6813-1.c.

◆ ltc_cmdADAX_fast_GPIO1

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

Single channel, GPIO 1, fast mode

Definition at line 242 of file ltc_6813-1.c.

◆ ltc_cmdADAX_fast_GPIO2

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

Single channel, GPIO 2, fast mode

Definition at line 245 of file ltc_6813-1.c.

◆ ltc_cmdADAX_fast_GPIO3

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

Single channel, GPIO 3, fast mode

Definition at line 248 of file ltc_6813-1.c.

◆ ltc_cmdADAX_filtered_ALLGPIOS

uint16_t ltc_cmdADAX_filtered_ALLGPIOS[4]
static
Initial value:
=
{0x05, 0xE0, 0x97, 0x86}

All channels, filtered mode

Definition at line 256 of file ltc_6813-1.c.

◆ ltc_cmdADAX_filtered_GPIO1

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

Single channel, GPIO 1, filtered mode

Definition at line 241 of file ltc_6813-1.c.

◆ ltc_cmdADAX_filtered_GPIO2

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

Single channel, GPIO 2, filtered mode

Definition at line 244 of file ltc_6813-1.c.

◆ ltc_cmdADAX_filtered_GPIO3

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

Single channel, GPIO 3, filtered mode

Definition at line 247 of file ltc_6813-1.c.

◆ ltc_cmdADAX_normal_ALLGPIOS

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

All channels, normal mode

Definition at line 255 of file ltc_6813-1.c.

◆ ltc_cmdADAX_normal_GPIO1

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

Single channel, GPIO 1, normal mode

Definition at line 240 of file ltc_6813-1.c.

◆ ltc_cmdADAX_normal_GPIO2

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

Single channel, GPIO 2, normal mode

Definition at line 243 of file ltc_6813-1.c.

◆ ltc_cmdADAX_normal_GPIO3

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

Single channel, GPIO 3, normal mode

Definition at line 246 of file ltc_6813-1.c.

◆ ltc_cmdADCV_fast_DCP0

uint16_t ltc_cmdADCV_fast_DCP0[4]
static
Initial value:
=
{0x02, 0xE0, 0x38, 0x06}

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

Definition at line 232 of file ltc_6813-1.c.

◆ ltc_cmdADCV_fast_DCP0_twocells

uint16_t ltc_cmdADCV_fast_DCP0_twocells[4]
static
Initial value:
=
{0x02, 0xE1, 0xb3, 0x34}

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

Definition at line 236 of file ltc_6813-1.c.

◆ ltc_cmdADCV_fast_DCP1

uint16_t ltc_cmdADCV_fast_DCP1[4]
static
Initial value:
=
{0x02, 0xF0, 0x63, 0x28}

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

Definition at line 234 of file ltc_6813-1.c.

◆ ltc_cmdADCV_filtered_DCP0

uint16_t ltc_cmdADCV_filtered_DCP0[4]
static
Initial value:
=
{0x03, 0xE0, 0xB0, 0x4A}

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

Definition at line 228 of file ltc_6813-1.c.

◆ ltc_cmdADCV_filtered_DCP1

uint16_t ltc_cmdADCV_filtered_DCP1[4]
static
Initial value:
=
{0x03, 0xF0, 0xEB, 0x64}

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

Definition at line 230 of file ltc_6813-1.c.

◆ ltc_cmdADCV_normal_DCP0

uint16_t ltc_cmdADCV_normal_DCP0[4]
static
Initial value:
=
{0x03, 0x60, 0xF4, 0x6C}

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

Definition at line 224 of file ltc_6813-1.c.

◆ ltc_cmdADCV_normal_DCP1

uint16_t ltc_cmdADCV_normal_DCP1[4]
static
Initial value:
=
{0x03, 0x70, 0xAF, 0x42}

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

Definition at line 226 of file ltc_6813-1.c.

◆ ltc_cmdRDAUXA

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

Definition at line 199 of file ltc_6813-1.c.

◆ ltc_cmdRDAUXB

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

Definition at line 200 of file ltc_6813-1.c.

◆ ltc_cmdRDAUXC

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

Definition at line 201 of file ltc_6813-1.c.

◆ ltc_cmdRDAUXD

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

Definition at line 202 of file ltc_6813-1.c.

◆ ltc_cmdRDCFG

uint16_t ltc_cmdRDCFG[4] = {0x00, 0x02, 0x2B, 0x0A}
static

Definition at line 188 of file ltc_6813-1.c.

◆ ltc_cmdRDCOMM

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

Definition at line 198 of file ltc_6813-1.c.

◆ ltc_cmdRDCVA

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

Definition at line 190 of file ltc_6813-1.c.

◆ ltc_cmdRDCVB

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

Definition at line 191 of file ltc_6813-1.c.

◆ ltc_cmdRDCVC

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

Definition at line 192 of file ltc_6813-1.c.

◆ ltc_cmdRDCVD

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

Definition at line 193 of file ltc_6813-1.c.

◆ ltc_cmdRDCVE

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

Definition at line 194 of file ltc_6813-1.c.

◆ ltc_cmdRDCVF

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

Definition at line 195 of file ltc_6813-1.c.

◆ ltc_cmdSTCOMM

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

Definition at line 197 of file ltc_6813-1.c.

◆ ltc_cmdWRCFG

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

Definition at line 186 of file ltc_6813-1.c.

◆ ltc_cmdWRCFG2

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

Definition at line 187 of file ltc_6813-1.c.

◆ ltc_cmdWRCOMM

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

Definition at line 196 of file ltc_6813-1.c.

◆ ltc_errorTable

LTC_ERRORTABLE_s ltc_errorTable = {0}
static

init in LTC_ResetErrorTable-function

Definition at line 124 of file ltc_6813-1.c.

◆ ltc_I2CcmdPortExpander1

uint16_t ltc_I2CcmdPortExpander1[6]
static
Initial value:
=
{0x64, 0x18, 0x0F, 0xF9, 0x7F, 0xF9}

reads one data byte from the port expander

Definition at line 220 of file ltc_6813-1.c.

◆ ltc_I2CcmdTempSens0

uint16_t ltc_I2CcmdTempSens0[6]
static
Initial value:
= {
0x69,
0x08,
0x00,
0x09,
0x7F,
0xF9}

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

Definition at line 210 of file ltc_6813-1.c.

◆ ltc_I2CcmdTempSens1

uint16_t ltc_I2CcmdTempSens1[6]
static
Initial value:
=
{0x69, 0x18, 0x0F, 0xF0, 0x0F, 0xF9}

reads two data bytes from the temperature sensor

Definition at line 217 of file ltc_6813-1.c.

◆ ltc_openwire

DATA_BLOCK_OPEN_WIRE_s ltc_openwire = {.header.uniqueId = DATA_BLOCK_ID_OPEN_WIRE_BASE}
static

local copies of database tables

Definition at line 120 of file ltc_6813-1.c.

◆ ltc_openWireDetection

LTC_OPENWIRE_DETECTION_s ltc_openWireDetection = {0}
static

stores information on the detected open wires locally

Definition at line 123 of file ltc_6813-1.c.

◆ ltc_plausibleCellVoltages681x

const AFE_PLAUSIBILITY_VALUES_s ltc_plausibleCellVoltages681x
static
Initial value:
= {
.maximumPlausibleVoltage_mV = 5000,
.minimumPlausibleVoltage_mV = 0,
}

local definition of plausible cell voltage values for the LTC6813 (and similar)

Definition at line 127 of file ltc_6813-1.c.

◆ ltc_RxPecBuffer

uint16_t ltc_RxPecBuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

PEC buffer for RX and TX

Definition at line 104 of file ltc_6813-1.c.

◆ ltc_slave_control

DATA_BLOCK_SLAVE_CONTROL_s ltc_slave_control = {.header.uniqueId = DATA_BLOCK_ID_SLAVE_CONTROL}
static

local copies of database tables

Definition at line 118 of file ltc_6813-1.c.

◆ ltc_stateBase

LTC_STATE_s ltc_stateBase

This variable contains the internal state of the LTC state machine.

Definition at line 134 of file ltc_6813-1.c.

◆ ltc_TxPecBuffer

uint16_t ltc_TxPecBuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION] = {0}

PEC buffer for RX and TX

Definition at line 105 of file ltc_6813-1.c.

◆ ltc_used_cells_index

uint16_t ltc_used_cells_index[BS_NR_OF_STRINGS] = {0}
static

index of used cells

Definition at line 110 of file ltc_6813-1.c.