56 #ifndef FOXBMS__LTC_6813_1_CFG_H_
57 #define FOXBMS__LTC_6813_1_CFG_H_
76 #define SLAVE_BOARD_VERSION (2)
78 #if SLAVE_BOARD_VERSION == 1
79 #elif SLAVE_BOARD_VERSION == 2
81 #error Please select the slave board version you want to use. Configuration file: \src\module\config\ltc_cfg.h
88 #define LTC_PORTEXPANDER_VERSION (1u)
91 #define LTC_PORTEXPANDER_ADR_TI (0u)
94 #define LTC_DISCARD_PEC (false)
97 #define LTC_GOTO_MUX_CHECK (true)
100 #define LTC_DISCARD_MUX_CHECK (false)
103 #define LTC_N_MUX_PER_LTC (3u)
106 #define LTC_N_MUX_CHANNELS_PER_MUX (8u)
109 #define LTC_NUMBER_OF_MUX_MEASUREMENTS_PER_CYCLE (8u)
112 #define LTC_N_MUX_CHANNELS_PER_LTC (LTC_N_MUX_PER_LTC * LTC_N_MUX_CHANNELS_PER_MUX)
115 #define LTC_NUMBER_OF_LTC_PER_MODULE (1u)
118 #define LTC_ADOW_THRESHOLD (-400)
126 #define LTC_VOLTAGE_MEASUREMENT_MODE (LTC_ADCMODE_NORMAL_DCP0)
134 #define LTC_GPIO_MEASUREMENT_MODE (LTC_ADCMODE_NORMAL_DCP0)
141 #define LTC_OW_MEASUREMENT_MODE (LTC_ADCMODE_NORMAL_DCP0)
147 #define LTC_TRANSMISSION_TIMEOUT (10)
153 #define LTC_SPI_HANDLE (&spi_devices[0])
154 #define LTC_SPI_INSTANCE (*LTC_SPI_HANDLE.Instance)
155 #define LTC_SPI_PRESCALER (*LTC_SPI_HANDLE.Init.BaudRatePrescaler)
159 #define LTC_TWAKE_US (300)
161 #define LTC_TREADY_US (10)
163 #define LTC_TIDLE_US (6700)
166 #define LTC_SPI_WAKEUP_WAIT_TIME_US (30u)
169 #define LTC_STATEMACH_SHORTTIME (1)
175 #define LTC_STATEMACH_DAISY_CHAIN_FIRST_INITIALIZATION_TIME ((LTC_TWAKE_US * LTC_N_LTC) / 1000)
180 #define LTC_STATEMACH_DAISY_CHAIN_SECOND_INITIALIZATION_TIME ((LTC_TREADY_US * LTC_N_LTC) / 1000)
190 #define LTC_STATEMACH_MEAS_ALL_CELLS_FAST_TCYCLE (2)
196 #define LTC_STATEMACH_MEAS_ALL_CELLS_NORMAL_TCYCLE (3)
202 #define LTC_STATEMACH_MEAS_ALL_CELLS_FILTERED_TCYCLE (202)
208 #define LTC_STATEMACH_MEAS_TWO_CELLS_FAST_TCYCLE (1)
214 #define LTC_STATEMACH_MEAS_TWO_CELLS_NORMAL_TCYCLE (1)
220 #define LTC_STATEMACH_MEAS_TWO_CELLS_FILTERED_TCYCLE (35)
230 #define LTC_STATEMACH_MEAS_ALL_GPIOS_FAST_TCYCLE (2)
236 #define LTC_STATEMACH_MEAS_ALL_GPIOS_NORMAL_TCYCLE (4)
242 #define LTC_STATEMACH_MEAS_ALL_GPIOS_FILTERED_TCYCLE (336)
248 #define LTC_STATEMACH_MEAS_SINGLE_GPIO_FAST_TCYCLE (1)
254 #define LTC_STATEMACH_MEAS_SINGLE_GPIO_NORMAL_TCYCLE (1)
260 #define LTC_STATEMACH_MEAS_SINGLE_GPIO_FILTERED_TCYCLE (68)
263 #define LTC_STATEMACH_SEQERRTTIME (5)
265 #define LTC_STATEMACH_PECERRTIME (1)
271 #define LTC_TRANSMIT_PECERRLIMIT (10)
277 #define LTC_TRANSMIT_SPIERRLIMIT (3)
280 #define LTC_READCOM (0)
296 #define LTC_NMBR_REQ_ADOW_COMMANDS (2)
302 #define LTC_TRANSMIT_WAKE_UP(spi_ltcInterface) SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US)
303 #define LTC_TRANSMIT_I2C_COMMAND(spi_ltcInterface, txbuf) \
304 SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \
305 SPI_TransmitData(spi_ltcInterface, txbuf, 4 + 9)
306 #define LTC_TRANSMIT_COMMAND(spi_ltcInterface, command) \
307 SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \
308 SPI_TransmitData(spi_ltcInterface, command, 4)
309 #define LTC_TRANSMIT_RECEIVE_DATA(spi_ltcInterface, txbuf, rxbuf, length) \
310 SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \
311 SPI_TransmitReceiveDataDma(spi_ltcInterface, txbuf, rxbuf, length)
Configuration of the battery system (e.g., number of battery modules, battery cells,...
#define BS_MAX_SUPPORTED_CELLS
Defines the maximal number of supported cells per module.
#define BS_NR_OF_TEMP_SENSORS_PER_MODULE
number of temperature sensors per battery module
const uint8_t ltc_muxsensortemperatur_cfg[BS_NR_OF_TEMP_SENSORS_PER_MODULE]
const uint8_t ltc_voltage_input_used[BS_MAX_SUPPORTED_CELLS]
LTC_MUX_SEQUENCE_s ltc_mux_seq
int16_t LTC_ConvertMuxVoltagesToTemperatures(uint16_t adcVoltage_mV)
converts a raw voltage from multiplexer to a temperature value in deci °C.
Headers for the driver for the DMA module for the LTC.
Headers for the configuration for the LTC monitoring chip.
Headers for the driver for the LTC monitoring chip.
Headers for the driver for the SPI module.