55 #ifndef FOXBMS__LTC_6813_1_CFG_H_
56 #define FOXBMS__LTC_6813_1_CFG_H_
75 #define SLAVE_BOARD_VERSION (2)
77 #if SLAVE_BOARD_VERSION == 1
78 #elif SLAVE_BOARD_VERSION == 2
80 #error Please select the slave board version you want to use. Configuration file: \src\module\config\ltc_cfg.h
87 #define LTC_PORTEXPANDER_VERSION (1u)
90 #define LTC_PORTEXPANDER_ADR_TI (0u)
93 #define LTC_DISCARD_PEC (false)
96 #define LTC_GOTO_MUX_CHECK (true)
99 #define LTC_DISCARD_MUX_CHECK (false)
102 #define LTC_N_MUX_PER_LTC (3u)
105 #define LTC_N_MUX_CHANNELS_PER_MUX (8u)
108 #define LTC_NUMBER_OF_MUX_MEASUREMENTS_PER_CYCLE (8u)
111 #define LTC_N_MUX_CHANNELS_PER_LTC (LTC_N_MUX_PER_LTC * LTC_N_MUX_CHANNELS_PER_MUX)
114 #define LTC_NUMBER_OF_LTC_PER_MODULE (1u)
117 #define LTC_ADOW_THRESHOLD (-400)
125 #define LTC_VOLTAGE_MEASUREMENT_MODE (LTC_ADCMODE_NORMAL_DCP0)
133 #define LTC_GPIO_MEASUREMENT_MODE (LTC_ADCMODE_NORMAL_DCP0)
140 #define LTC_OW_MEASUREMENT_MODE (LTC_ADCMODE_NORMAL_DCP0)
146 #define LTC_TRANSMISSION_TIMEOUT (10)
152 #define LTC_SPI_HANDLE &spi_devices[0]
153 #define LTC_SPI_INSTANCE *LTC_SPI_HANDLE.Instance
154 #define LTC_SPI_PRESCALER *LTC_SPI_HANDLE.Init.BaudRatePrescaler
158 #define LTC_TWAKE_US (300)
160 #define LTC_TREADY_US (10)
162 #define LTC_TIDLE_US (6700)
165 #define LTC_SPI_WAKEUP_WAIT_TIME_US (30U)
168 #define LTC_STATEMACH_SHORTTIME (1)
174 #define LTC_STATEMACH_DAISY_CHAIN_FIRST_INITIALIZATION_TIME ((LTC_TWAKE_US * LTC_N_LTC) / 1000)
179 #define LTC_STATEMACH_DAISY_CHAIN_SECOND_INITIALIZATION_TIME ((LTC_TREADY_US * LTC_N_LTC) / 1000)
189 #define LTC_STATEMACH_MEAS_ALL_CELLS_FAST_TCYCLE (2)
195 #define LTC_STATEMACH_MEAS_ALL_CELLS_NORMAL_TCYCLE (3)
201 #define LTC_STATEMACH_MEAS_ALL_CELLS_FILTERED_TCYCLE (202)
207 #define LTC_STATEMACH_MEAS_TWO_CELLS_FAST_TCYCLE (1)
213 #define LTC_STATEMACH_MEAS_TWO_CELLS_NORMAL_TCYCLE (1)
219 #define LTC_STATEMACH_MEAS_TWO_CELLS_FILTERED_TCYCLE (35)
229 #define LTC_STATEMACH_MEAS_ALL_GPIOS_FAST_TCYCLE (2)
235 #define LTC_STATEMACH_MEAS_ALL_GPIOS_NORMAL_TCYCLE (4)
241 #define LTC_STATEMACH_MEAS_ALL_GPIOS_FILTERED_TCYCLE (336)
247 #define LTC_STATEMACH_MEAS_SINGLE_GPIO_FAST_TCYCLE (1)
253 #define LTC_STATEMACH_MEAS_SINGLE_GPIO_NORMAL_TCYCLE (1)
259 #define LTC_STATEMACH_MEAS_SINGLE_GPIO_FILTERED_TCYCLE (68)
262 #define LTC_STATEMACH_SEQERRTTIME (5)
264 #define LTC_STATEMACH_PECERRTIME (1)
270 #define LTC_TRANSMIT_PECERRLIMIT (10)
276 #define LTC_TRANSMIT_SPIERRLIMIT (3)
279 #define LTC_READCOM (0)
289 #define LTC_STANDBY_PERIODIC_OPEN_WIRE_CHECK (false)
292 #define LTC_STANDBY_OPEN_WIRE_PERIOD_ms (600000)
295 #define LTC_NORMAL_PERIODIC_OPEN_WIRE_CHECK (false)
298 #define LTC_NORMAL_OPEN_WIRE_PERIOD_ms (600000)
301 #define LTC_CHARGE_PERIODIC_OPEN_WIRE_CHECK (false)
304 #define LTC_CHARGE_OPEN_WIRE_PERIOD_ms (600000)
307 #define LTC_ERROR_OPEN_WIRE_PERIOD_ms (30000)
323 #define LTC_NMBR_REQ_ADOW_COMMANDS (2)
329 #define LTC_TransmitWakeUp(spi_ltcInterface) SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US)
330 #define LTC_TransmitI2cCommand(spi_ltcInterface, txbuf) \
331 SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \
332 SPI_TransmitData(spi_ltcInterface, txbuf, 4 + 9)
333 #define LTC_TransmitCommand(spi_ltcInterface, command) \
334 SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \
335 SPI_TransmitData(spi_ltcInterface, command, 4)
336 #define LTC_TransmitReceiveData(spi_ltcInterface, txbuf, rxbuf, length) \
337 SPI_TransmitDummyByte(spi_ltcInterface, LTC_SPI_WAKEUP_WAIT_TIME_US); \
338 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
int16_t LTC_Convert_MuxVoltages_to_Temperatures(uint16_t adcVoltage_mV)
converts a raw voltage from multiplexer to a temperature value in deci °C.
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
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.