62 #include "HL_system.h"
81 #define LTC_PORT_EXPANDER_TI_INPUT_REG_ADR (0x00u)
82 #define LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR (0x01u)
83 #define LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR (0x03u)
90 #define LTC_ICOM_START (0x60u)
91 #define LTC_ICOM_STOP (0x10u)
92 #define LTC_ICOM_BLANK (0x00u)
93 #define LTC_ICOM_NO_TRANSMIT (0x70u)
94 #define LTC_FCOM_MASTER_ACK (0x00u)
95 #define LTC_FCOM_MASTER_NACK (0x08u)
96 #define LTC_FCOM_MASTER_NACK_STOP (0x09u)
100 #define LTC_MAX_SUPPORTED_CELLS (12u)
108 #pragma SET_DATA_SECTION(".sharedRAM")
111 #pragma SET_DATA_SECTION()
135 .minimumPlausibleVoltage_mV = 0,
151 .numberOfMeasuredMux = 32,
153 .ErrRetryCounter = 0,
154 .ErrRequestCounter = 0,
155 .VoltageSampleTime = 0,
157 .commandDataTransferTime = 3,
158 .commandTransferTime = 3,
159 .gpioClocksTransferTime = 3,
162 .muxmeas_nr_end = {0},
163 .first_measurement_made =
false,
167 .transmit_ongoing =
false,
189 .requestedString = 0u,
224 {0x69, 0x18, 0x0F, 0xF0, 0x0F, 0xF9};
227 {0x64, 0x18, 0x0F, 0xF9, 0x7F, 0xF9};
231 {0x03, 0x60, 0xF4, 0x6C};
233 {0x03, 0x70, 0xAF, 0x42};
235 {0x03, 0xE0, 0xB0, 0x4A};
237 {0x03, 0xF0, 0xEB, 0x64};
239 {0x02, 0xE0, 0x38, 0x06};
241 {0x02, 0xF0, 0x63, 0x28};
243 {0x02, 0xE1, 0xB3, 0x34};
263 {0x05, 0xE0, 0x97, 0x86};
301 uint16_t timer_ms_ok,
303 uint8_t substate_nok,
304 uint16_t timer_ms_nok);
311 uint32_t frameLength,
313 uint8_t stringNumber);
320 uint32_t frameLength);
340 uint8_t stringNumber);
345 uint8_t stringNumber);
349 uint16_t *DataBufferSPI_RX_with_PEC,
350 uint8_t stringNumber);
356 uint32_t frameLength);
362 uint32_t frameLength);
369 uint32_t frameLength,
378 uint32_t frameLength,
385 uint32_t frameLength,
393 uint32_t frameLength);
401 uint32_t frameLength,
408 uint32_t frameLength);
414 uint32_t frameLength,
423 uint32_t frameLength,
432 uint8_t stringNumber);
525 ltc_state->
state = state;
527 ltc_state->
timer = timer_ms;
559 uint16_t timer_ms_ok,
561 uint8_t substate_nok,
562 uint16_t timer_ms_nok) {
584 int32_t stringVoltage_mV = 0;
585 uint16_t numberValidMeasurements = 0;
610 numberValidMeasurements++;
637 uint16_t numberValidMeasurements = 0;
653 numberValidMeasurements++;
690 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
691 const uint16_t val_i = DataBufferSPI_RX[8u + (1u * i * 8u)] |
692 (DataBufferSPI_RX[8u + (1u * i * 8u) + 1u] << 8u);
756 return ltc_state->
state;
816 uint8_t tmpbusID = 0;
829 if (ltc_state->
timer > 0u) {
830 if ((--ltc_state->
timer) > 0u) {
837 if (ltc_state->
timer > 0u) {
838 if ((--ltc_state->
timer) > 0u) {
846 if (continueFunction ==
STD_OK) {
847 switch (ltc_state->
state) {
858 ltc_state->
adcMode = tmpadcMode;
1271 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1308 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1336 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1368 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1427 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1554 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1599 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1813 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1868 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1893 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1929 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1954 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
1984 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2039 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2097 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2122 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2152 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2204 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2249 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2302 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2348 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2394 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2419 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2449 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2507 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2532 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2563 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2588 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2618 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2675 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2700 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2731 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2756 if ((ltc_state->
timer == 0) && (transmitOngoing ==
true)) {
2951 uint8_t stringNumber) {
2955 uint16_t val_ui = 0;
2956 int16_t temperature_ddegC = 0;
2957 uint8_t sensor_idx = 0;
2959 uint16_t buffer_LSB = 0;
2960 uint16_t buffer_MSB = 0;
2964 if (muxseqptr->
muxCh != 0xFF) {
2966 if ((muxseqptr->
muxID == 1) || (muxseqptr->
muxID == 2)) {
2967 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
2968 if (muxseqptr->
muxID == 1) {
2969 ch_idx = 0 + muxseqptr->
muxCh;
2971 ch_idx = 8 + muxseqptr->
muxCh;
2974 if (ch_idx < (2u * 8u)) {
2975 val_ui = *((uint16_t *)(&pRxBuff[6u + (1u * i * 8u)]));
2981 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
2982 buffer_MSB = pRxBuff[4u + (i * 8u) + 1u];
2983 buffer_LSB = pRxBuff[4u + (i * 8u)];
2984 val_ui = buffer_LSB | (buffer_MSB << 8);
3000 (~(1u << sensor_idx));
3032 uint8_t registerSet,
3033 uint8_t stringNumber) {
3036 uint16_t cellOffset = 0;
3037 uint16_t voltage_index = 0;
3038 uint16_t val_ui = 0;
3039 uint16_t voltage = 0;
3040 uint32_t bitmask = 0;
3041 uint16_t buffer_LSB = 0;
3042 uint16_t buffer_MSB = 0;
3043 bool continueFunction =
true;
3045 if (registerSet == 0u) {
3048 }
else if (registerSet == 1u) {
3051 }
else if (registerSet == 2u) {
3054 }
else if (registerSet == 3u) {
3057 }
else if (registerSet == 4u) {
3060 }
else if (registerSet == 5u) {
3064 continueFunction =
false;
3067 if (continueFunction ==
true) {
3069 bitmask |= 0x07u << cellOffset;
3072 if (cellOffset == 0u) {
3077 for (uint16_t m = 0u; m <
LTC_N_LTC; m++) {
3078 uint16_t incrementations = 0u;
3081 for (uint8_t c = 0u; c < 3u; c++) {
3083 voltage_index = c + cellOffset;
3086 buffer_MSB = pRxBuff[4u + (2u * c) + (m * 8u) + 1u];
3087 buffer_LSB = pRxBuff[4u + (2u * c) + (m * 8u)];
3088 val_ui = buffer_LSB | (buffer_MSB << 8u);
3090 voltage = ((val_ui)) * 100e-6f * 1000.0f;
3144 uint8_t registerSet,
3145 uint8_t stringNumber) {
3148 uint8_t i_offset = 0;
3149 uint32_t bitmask = 0;
3150 uint16_t buffer_LSB = 0;
3151 uint16_t buffer_MSB = 0;
3153 if (registerSet == 0u) {
3156 bitmask = 0x07u << i_offset;
3158 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
3164 buffer_MSB = pRxBuff[4u + (i * 8u) + 1u];
3165 buffer_LSB = pRxBuff[4u + (i * 8u)];
3168 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3170 buffer_MSB = pRxBuff[6u + (i * 8u) + 1u];
3171 buffer_LSB = pRxBuff[6u + (i * 8u)];
3174 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3176 buffer_MSB = pRxBuff[8u + (i * 8u) + 1u];
3177 buffer_LSB = pRxBuff[8u + (i * 8u)];
3180 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3186 }
else if (registerSet == 1u) {
3189 bitmask = 0x03u << i_offset;
3191 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
3197 buffer_MSB = pRxBuff[4u + (i * 8u) + 1u];
3198 buffer_LSB = pRxBuff[4u + (i * 8u)];
3201 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3203 buffer_MSB = pRxBuff[6u + (i * 8u) + 1u];
3204 buffer_LSB = pRxBuff[6u + (i * 8u)];
3207 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3213 }
else if (registerSet == 2u) {
3216 bitmask = 0x07u << i_offset;
3218 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
3224 buffer_MSB = pRxBuff[4u + (i * 8u) + 1u];
3225 buffer_LSB = pRxBuff[4u + (i * 8u)];
3228 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3230 buffer_MSB = pRxBuff[6u + (i * 8u) + 1u];
3231 buffer_LSB = pRxBuff[6u + (i * 8u)];
3234 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3236 buffer_MSB = pRxBuff[8u + (i * 8u) + 1u];
3237 buffer_LSB = pRxBuff[8u + (i * 8u)];
3240 ((buffer_LSB | (buffer_MSB << 8u))) / 10u;
3246 }
else if (registerSet == 3u) {
3249 bitmask = 0x01u << i_offset;
3251 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
3259 *((uint16_t *)(&pRxBuff[4u + (i * 8u)])) / 10u;
3347 uint32_t frameLength) {
3354 uint16_t PEC_result = 0;
3364 for (uint16_t i = 0u; i <
LTC_N_LTC; i++) {
3366 pTxBuff[4u + (i * 8u)] = 0xFC;
3367 pTxBuff[5u + (i * 8u)] = 0x00;
3368 pTxBuff[6u + (i * 8u)] = 0x00;
3369 pTxBuff[7u + (i * 8u)] = 0x00;
3370 pTxBuff[8u + (i * 8u)] = 0x00;
3371 pTxBuff[9u + (i * 8u)] = 0x00;
3373 PEC_Check[0] = pTxBuff[4u + (i * 8u)];
3374 PEC_Check[1] = pTxBuff[5u + (i * 8u)];
3375 PEC_Check[2] = pTxBuff[6u + (i * 8u)];
3376 PEC_Check[3] = pTxBuff[7u + (i * 8u)];
3377 PEC_Check[4] = pTxBuff[8u + (i * 8u)];
3378 PEC_Check[5] = pTxBuff[9u + (i * 8u)];
3381 pTxBuff[10u + (i * 8u)] = (PEC_result >> 8u) & 0xFFu;
3382 pTxBuff[11u + (i * 8u)] = PEC_result & 0xFFu;
3412 uint32_t frameLength,
3413 uint8_t registerSet,
3414 uint8_t stringNumber) {
3422 uint16_t PEC_result = 0;
3426 if (registerSet == 0u) {
3438 pTxBuff[4u + (reverseModuleNumber * 8u)] = 0xFC;
3439 pTxBuff[5u + (reverseModuleNumber * 8u)] = 0x00;
3440 pTxBuff[6u + (reverseModuleNumber * 8u)] = 0x00;
3441 pTxBuff[7u + (reverseModuleNumber * 8u)] = 0x00;
3442 pTxBuff[8u + (reverseModuleNumber * 8u)] = 0x00;
3443 pTxBuff[9u + (reverseModuleNumber * 8u)] = 0x00;
3447 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x01u;
3451 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x02u;
3455 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x04u;
3459 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x08u;
3463 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x10u;
3467 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x20u;
3471 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x40u;
3475 pTxBuff[8u + (reverseModuleNumber * 8u)] |= 0x80u;
3479 pTxBuff[9u + (reverseModuleNumber * 8u)] |= 0x01u;
3483 pTxBuff[9u + (reverseModuleNumber * 8u)] |= 0x02u;
3487 pTxBuff[9u + (reverseModuleNumber * 8u)] |= 0x04u;
3491 pTxBuff[9u + (reverseModuleNumber * 8u)] |= 0x08u;
3494 PEC_Check[0] = pTxBuff[4u + (reverseModuleNumber * 8u)];
3495 PEC_Check[1] = pTxBuff[5u + (reverseModuleNumber * 8u)];
3496 PEC_Check[2] = pTxBuff[6u + (reverseModuleNumber * 8u)];
3497 PEC_Check[3] = pTxBuff[7u + (reverseModuleNumber * 8u)];
3498 PEC_Check[4] = pTxBuff[8u + (reverseModuleNumber * 8u)];
3499 PEC_Check[5] = pTxBuff[9u + (reverseModuleNumber * 8u)];
3502 pTxBuff[10u + (reverseModuleNumber * 8u)] = (PEC_result >> 8u) & 0xFFu;
3503 pTxBuff[11u + (reverseModuleNumber * 8u)] = PEC_result & 0xFFu;
3506 }
else if (registerSet == 1u) {
3518 pTxBuff[4u + (reverseModuleNumber * 8u)] = 0x0F;
3519 pTxBuff[5u + (reverseModuleNumber * 8u)] = 0x00;
3520 pTxBuff[6u + (reverseModuleNumber * 8u)] = 0x00;
3521 pTxBuff[7u + (reverseModuleNumber * 8u)] = 0x00;
3522 pTxBuff[8u + (reverseModuleNumber * 8u)] = 0x00;
3523 pTxBuff[9u + (reverseModuleNumber * 8u)] = 0x00;
3527 pTxBuff[4u + (reverseModuleNumber * 8u)] |= 0x10u;
3531 pTxBuff[4u + (reverseModuleNumber * 8u)] |= 0x20u;
3535 pTxBuff[4u + (reverseModuleNumber * 8u)] |= 0x40u;
3540 pTxBuff[4u + (reverseModuleNumber * 8u)] |= 0x80u;
3544 pTxBuff[5u + (reverseModuleNumber * 8u)] |= 0x01u;
3548 pTxBuff[5u + (reverseModuleNumber * 8u)] |= 0x02u;
3552 PEC_Check[0] = pTxBuff[4u + (reverseModuleNumber * 8u)];
3553 PEC_Check[1] = pTxBuff[5u + (reverseModuleNumber * 8u)];
3554 PEC_Check[2] = pTxBuff[6u + (reverseModuleNumber * 8u)];
3555 PEC_Check[3] = pTxBuff[7u + (reverseModuleNumber * 8u)];
3556 PEC_Check[4] = pTxBuff[8u + (reverseModuleNumber * 8u)];
3557 PEC_Check[5] = pTxBuff[9u + (reverseModuleNumber * 8u)];
3560 pTxBuff[10u + (reverseModuleNumber * 8u)] = (PEC_result >> 8u) & 0xFFu;
3561 pTxBuff[11u + (reverseModuleNumber * 8u)] = PEC_result & 0xFFu;
3581 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
3795 }
else if (PUP == 1u) {
3825 uint16_t *DataBufferSPI_RX_with_PEC,
3826 uint8_t stringNumber) {
3831 uint16_t PEC_result = 0;
3835 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
3836 PEC_Check[0] = DataBufferSPI_RX_with_PEC[4u + (i * 8u)];
3837 PEC_Check[1] = DataBufferSPI_RX_with_PEC[5u + (i * 8u)];
3838 PEC_Check[2] = DataBufferSPI_RX_with_PEC[6u + (i * 8u)];
3839 PEC_Check[3] = DataBufferSPI_RX_with_PEC[7u + (i * 8u)];
3840 PEC_Check[4] = DataBufferSPI_RX_with_PEC[8u + (i * 8u)];
3841 PEC_Check[5] = DataBufferSPI_RX_with_PEC[9u + (i * 8u)];
3844 PEC_TX[0] = (uint8_t)((PEC_result >> 8u) & 0xFFu);
3845 PEC_TX[1] = (uint8_t)(PEC_result & 0xFFu);
3848 if ((PEC_TX[0] != DataBufferSPI_RX_with_PEC[10u + (i * 8u)]) ||
3849 (PEC_TX[1] != DataBufferSPI_RX_with_PEC[11u + (i * 8u)])) {
3899 uint32_t frameLength) {
3914 pTxBuff[0] = Command[0];
3915 pTxBuff[1] = Command[1];
3916 pTxBuff[2] = Command[2];
3917 pTxBuff[3] = Command[3];
3967 uint32_t frameLength) {
3974 uint16_t PEC_result = 0;
3977 pTxBuff[0] = Command[0];
3978 pTxBuff[1] = Command[1];
3979 pTxBuff[2] = Command[2];
3980 pTxBuff[3] = Command[3];
3983 for (uint16_t i = 0u; i <
LTC_N_LTC; i++) {
3984 PEC_Check[0] = pTxBuff[4u + (i * 8u)];
3985 PEC_Check[1] = pTxBuff[5u + (i * 8u)];
3986 PEC_Check[2] = pTxBuff[6u + (i * 8u)];
3987 PEC_Check[3] = pTxBuff[7u + (i * 8u)];
3988 PEC_Check[4] = pTxBuff[8u + (i * 8u)];
3989 PEC_Check[5] = pTxBuff[9u + (i * 8u)];
3992 pTxBuff[10u + (i * 8u)] = (PEC_result >> 8u) & 0xFFu;
3993 pTxBuff[11u + (i * 8u)] = PEC_result & 0xFFu;
4014 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4015 #if SLAVE_BOARD_VERSION == 2u
4018 uint8_t address = 0x98u | ((mux % 4u) << 1u);
4019 uint8_t data = 1u << (channel % 8u);
4020 if (channel == 0xFFu) {
4027 uint8_t address = 0x90u | ((mux % 4u) << 1u);
4028 uint8_t data = 0x08u | (channel % 8u);
4029 if (channel == 0xFFu) {
4035 pTxBuff[4u + (i * 8u)] =
LTC_ICOM_START | ((address >> 4u) & 0x0Fu);
4037 pTxBuff[6u + (i * 8u)] =
LTC_ICOM_BLANK | ((data >> 4u) & 0x0Fu);
4040 pTxBuff[9u + (i * 8u)] = 0x00;
4062 uint32_t frameLength,
4092 address &= 0x3FFFFu;
4093 const uint8_t address0 = address >> 16u;
4094 const uint8_t address1 = (address & 0xFFFFu) >> 8u;
4095 const uint8_t address2 = address & 0xFFu;
4098 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4107 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4130 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4132 ((pRxBuff[7u + (i * 8u)] >> 4u));
4159 uint32_t frameLength,
4189 address &= 0x3FFFFu;
4190 const uint8_t address0 = address >> 16u;
4191 const uint8_t address1 = (address & 0xFFFFu) >> 8u;
4192 const uint8_t address2 = address & 0xFFu;
4195 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4204 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4241 uint32_t frameLength,
4274 uint32_t frameLength,
4275 uint16_t *cmd_data) {
4283 pTxBuff[4u + (i * 6u)] = cmd_data[0];
4284 pTxBuff[5u + (i * 6u)] = cmd_data[1];
4286 pTxBuff[6u + (i * 6u)] = cmd_data[2];
4287 pTxBuff[7u + (i * 6u)] = cmd_data[3];
4289 pTxBuff[8u + (i * 6u)] = cmd_data[4];
4290 pTxBuff[9u + (i * 6u)] = cmd_data[5];
4313 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4314 uint8_t temp_tmp[2];
4315 temp_tmp[0] = (pRxBuff[6u + (i * 8u)] << 4u) | ((pRxBuff[7u + (i * 8u)] >> 4u));
4316 temp_tmp[1] = (pRxBuff[8u + (i * 8u)] << 4u) | ((pRxBuff[9u + (i * 8u)] >> 4u));
4317 uint16_t val_i = (temp_tmp[0] << 8u) | (temp_tmp[1]);
4318 val_i = val_i >> 8u;
4343 uint32_t frameLength) {
4358 pTxBuff[5u + (i * 8u)] =
4361 pTxBuff[6u + (i * 8u)] =
4363 (output_data >> 4u);
4364 pTxBuff[7u + (i * 8u)] =
4365 (uint8_t)(output_data << 4u) |
4369 pTxBuff[9u + (i * 8u)] = 0;
4393 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4394 const uint8_t val_i = (pRxBuff[6u + (i * 8u)] << 4u) | ((pRxBuff[7u + (i * 8u)] >> 4u));
4420 uint32_t frameLength,
4442 pTxBuff[9u + (i * 8u)] = (uint8_t)(direction << 4u) |
4470 uint32_t frameLength) {
4492 pTxBuff[9u + (i * 8u)] = (uint8_t)(output_data << 4u) |
4521 uint32_t frameLength,
4541 pTxBuff[9u + (i * 8u)] = 0;
4555 pTxBuff[9u + (i * 8u)] = 0;
4577 for (uint16_t i = 0; i <
LTC_N_LTC; i++) {
4578 const uint8_t val_i = (pTxBuff[6u + (i * 8u)] << 4u) | ((pTxBuff[7u + (i * 8u)] >> 4u));
4599 uint16_t ltc_TXBufferClock[4u + 9u];
4601 for (uint16_t i = 0; i < (4u + 9u); i++) {
4602 ltc_TXBufferClock[i] = 0xFF;
4626 uint32_t SPI_Clock = 0;
4627 uint32_t prescaler = 0;
4652 prescaler = ((pSpiInterface->
pNode->FMT0) >> 8u) & 0xFFu;
4653 SPI_Clock = (uint32_t)(AVCLK1_FREQ * 1000000u) / (prescaler + 1u);
4668 uint32_t transferTime_us = 0;
4669 uint32_t SPI_Clock = 0;
4675 transferTime_us = (8u * 1000u * 1000u) / (SPI_Clock);
4682 transferTime_us = ((4u) * 8u * 1000u * 1000u) / (SPI_Clock);
4688 transferTime_us = ((4u + 9u) * 8u * 1000u * 1000u) / (SPI_Clock);
4729 bool retval =
false;
4768 #ifdef UNITY_UNIT_TEST
4769 uint8_t TEST_LTC_CheckReEntrance(
LTC_STATE_s *ltc_state) {
4773 extern void TEST_LTC_SetFirstMeasurementCycleFinished(
LTC_STATE_s *ltc_state) {
4778 #define TEST_LTC_DEFINE_GET(VARIABLE) \
4779 extern void TEST_LTC_Get_##VARIABLE(uint8_t data[4]) { \
4780 for (uint8_t i = 0u; i < 4u; i++) { \
4781 data[i] = (uint8_t)(VARIABLE)[i]; \
STD_RETURN_TYPE_e AFE_PlausibilityCheckTempMinMax(const int16_t celltemperature_ddegC)
Cell temperature plausibility check.
STD_RETURN_TYPE_e AFE_PlausibilityCheckVoltageMeasurementRange(const int16_t cellVoltage_mV, const AFE_PLAUSIBILITY_VALUES_s plausibleValues)
Cell voltage measurement range plausibility check.
plausibility checks for cell voltage and cell temperatures
#define BS_NR_OF_CELL_BLOCKS_PER_MODULE
number of cells per module
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define BS_NR_OF_TEMP_SENSORS_PER_MODULE
number of temperature sensors per battery module
#define BS_NR_OF_GPIOS_PER_MODULE
Defines the number of GPIOs.
#define BS_NR_OF_CELL_BLOCKS_PER_STRING
#define BS_NR_OF_MODULES_PER_STRING
number of modules in a string
#define BS_NR_OF_TEMP_SENSORS_PER_STRING
#define DATA_READ_DATA(...)
#define DATA_WRITE_DATA(...)
@ DATA_BLOCK_ID_BALANCING_CONTROL
@ DATA_BLOCK_ID_CELL_TEMPERATURE_BASE
@ DATA_BLOCK_ID_OPEN_WIRE_BASE
@ DATA_BLOCK_ID_SLAVE_CONTROL
@ DATA_BLOCK_ID_CELL_VOLTAGE_BASE
@ DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE
STD_RETURN_TYPE_e DIAG_CheckEvent(STD_RETURN_TYPE_e cond, DIAG_ID_e diagId, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_CheckEvent provides a simple interface to check an event for STD_OK.
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
@ DIAG_ID_AFE_CELL_VOLTAGE_MEAS_ERROR
@ DIAG_ID_AFE_CELL_TEMPERATURE_MEAS_ERROR
@ DIAG_ID_AFE_COM_INTEGRITY
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
#define NULL_PTR
Null pointer.
Header for the driver for the IO module.
Headers for the driver for the LTC analog front-end.
const uint8_t ltc_voltage_input_used[LTC_6806_MAX_SUPPORTED_CELLS]
const uint8_t ltc_muxsensortemperatur_cfg[BS_NR_OF_TEMP_SENSORS_PER_MODULE]
#define LTC_STATEMACH_DAISY_CHAIN_FIRST_INITIALIZATION_TIME
#define LTC_TRANSMISSION_TIMEOUT
#define LTC_TRANSMIT_COMMAND(spi_ltcInterface, command)
#define LTC_STATEMACH_SHORTTIME
#define LTC_PORTEXPANDER_ADR_TI
#define LTC_NUMBER_OF_LTC_PER_MODULE
#define LTC_TRANSMIT_I2C_COMMAND(spi_ltcInterface, txbuf)
#define LTC_VOLTAGE_MEASUREMENT_MODE
#define LTC_ADOW_THRESHOLD
int16_t LTC_ConvertMuxVoltagesToTemperatures(uint16_t adcVoltage_mV)
converts a raw voltage from multiplexer to a temperature value in deci °C.
#define LTC_SPI_WAKEUP_WAIT_TIME_US
#define LTC_GPIO_MEASUREMENT_MODE
#define LTC_TRANSMIT_WAKE_UP(spi_ltcInterface)
#define LTC_NMBR_REQ_ADOW_COMMANDS
#define LTC_OW_MEASUREMENT_MODE
#define LTC_TRANSMIT_RECEIVE_DATA(spi_ltcInterface, txbuf, rxbuf, length)
#define LTC_STATEMACH_DAISY_CHAIN_SECOND_INITIALIZATION_TIME
#define LTC_PORT_EXPANDER_TI_OUTPUT_REG_ADR
static uint16_t ltc_cmdADAX_fast_GPIO3[4]
uint16_t ltc_TxPecBuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION]
static uint16_t ltc_cmdRDCVC[4]
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.
static uint16_t ltc_cmdRDAUXB[4]
static DATA_BLOCK_ALL_GPIO_VOLTAGES_s ltc_allgpiovoltage
static uint16_t ltc_cmdRDCVA[4]
static uint16_t ltc_cmdWRCOMM[4]
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.
#define LTC_PORT_EXPANDER_TI_INPUT_REG_ADR
static DATA_BLOCK_OPEN_WIRE_s ltc_openWire
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.
static uint16_t ltc_cmdADAX_normal_GPIO1[4]
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.
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.
LTC_STATEMACH_e LTC_GetState(LTC_STATE_s *ltc_state)
gets the current state.
static STD_RETURN_TYPE_e LTC_ReadRegister(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.
bool LTC_IsFirstMeasurementCycleFinished(LTC_STATE_s *ltc_state)
gets the measurement initialization status.
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.
static uint16_t ltc_cmdRDAUXA[4]
static uint16_t ltc_cmdRDCVB[4]
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.
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.
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
static uint16_t ltc_cmdADCV_fast_DCP1[4]
static uint16_t ltc_cmdWRCFG2[4]
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.
static void LTC_SetFirstMeasurementCycleFinished(LTC_STATE_s *ltc_state)
sets the measurement initialization status.
static LTC_RETURN_TYPE_e LTC_CheckStateRequest(LTC_STATE_s *ltc_state, LTC_REQUEST_s statereq)
checks the state requests that are made.
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.
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.
static void LTC_SetTransferTimes(LTC_STATE_s *ltc_state)
sets the transfer time needed to receive/send data with the LTC daisy-chain.
static uint16_t ltc_cmdRDAUXC[4]
static uint32_t LTC_GetSpiClock(SPI_INTERFACE_CONFIG_s *pSpiInterface)
gets the frequency of the SPI clock.
static uint16_t LTC_GetMeasurementTimeCycle(LTC_ADCMODE_e adcMode, LTC_ADCMEAS_CHAN_e adcMeasCh)
brief missing
static uint16_t ltc_cmdADAX_fast_GPIO2[4]
static uint16_t ltc_cmdADAX_normal_ALLGPIOS[4]
static uint16_t ltc_cmdADAX_filtered_GPIO3[4]
static uint16_t ltc_cmdADAX_filtered_GPIO2[4]
static STD_RETURN_TYPE_e LTC_CheckPec(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.
static uint16_t ltc_cmdRDCVD[4]
static uint16_t ltc_I2CcmdPortExpander1[6]
static uint16_t ltc_cmdRDCFG[4]
#define LTC_ICOM_NO_TRANSMIT
static void LTC_SaveLastStates(LTC_STATE_s *ltc_state)
Saves the last state and the last substate.
static void LTC_PortExpanderSaveValuesTi(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.
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.
void LTC_SaveTemperatures(LTC_STATE_s *ltc_state, uint8_t stringNumber)
stores the measured temperatures and the measured multiplexer feedbacks in the database.
#define LTC_PORT_EXPANDER_TI_CONFIG_REG_ADR
static uint16_t ltc_used_cells_index[BS_NR_OF_STRINGS]
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.
static DATA_BLOCK_BALANCING_CONTROL_s ltc_balancing_control
static STD_RETURN_TYPE_e LTC_SetPortExpanderDirectionTi(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
static STD_RETURN_TYPE_e LTC_GetPortExpanderInputTi(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
#define LTC_FCOM_MASTER_NACK_STOP
static uint16_t ltc_cmdADAX_fast_ALLGPIOS[4]
void LTC_InitializeMonitoringPin(void)
Sets the transceiver pins to enable LTC6820 IC.
static DATA_BLOCK_CELL_VOLTAGE_s ltc_cellVoltage
static uint16_t ltc_cmdADAX_normal_GPIO2[4]
static uint16_t ltc_BC_cmdADOW_PDOWN_filtered_DCP0[4]
static STD_RETURN_TYPE_e LTC_WriteRegister(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.
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.
static uint16_t ltc_cmdADAX_filtered_ALLGPIOS[4]
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.
static uint16_t ltc_I2CcmdTempSens1[6]
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
static STD_RETURN_TYPE_e LTC_I2cClock(SPI_INTERFACE_CONFIG_s *pSpiInterface)
sends 72 clock pulses to the LTC daisy-chain.
static uint16_t ltc_cmdADCV_fast_DCP0[4]
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.
LTC_REQUEST_s LTC_GetStateRequest(LTC_STATE_s *ltc_state)
gets the current state request.
static DATA_BLOCK_BALANCING_FEEDBACK_s ltc_balancing_feedback
void LTC_SaveVoltages(LTC_STATE_s *ltc_state, uint8_t stringNumber)
stores the measured voltages in the database.
static STD_RETURN_TYPE_e LTC_SetPortExpanderOutputTi(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
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.
static const AFE_PLAUSIBILITY_VALUES_s ltc_plausibleCellVoltages681x
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.
static uint16_t ltc_cmdADCV_filtered_DCP0[4]
static void LTC_ResetErrorTable(LTC_STATE_s *ltc_state)
resets the error table.
static STD_RETURN_TYPE_e LTC_SendI2cCommand(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
LTC_STATE_s ltc_stateBase
static uint16_t ltc_cmdADAX_normal_GPIO3[4]
static void LTC_GetBalancingControlValues(LTC_STATE_s *ltc_state)
gets the balancing orders from the database.
#define LTC_FCOM_MASTER_NACK
static uint16_t ltc_cmdADCV_normal_DCP1[4]
static uint16_t ltc_cmdRDCVE[4]
static uint16_t ltc_cmdRDAUXD[4]
static uint16_t ltc_cmdADCV_normal_DCP0[4]
void LTC_SaveAllGpioMeasurement(LTC_STATE_s *ltc_state)
stores the measured GPIOs in the database.
static uint16_t ltc_BC_cmdADOW_PDOWN_normal_DCP0[4]
static uint16_t ltc_cmdADCV_fast_DCP0_twocells[4]
static LTC_ERRORTABLE_s ltc_errorTable
void LTC_Trigger(LTC_STATE_s *ltc_state)
trigger function for the LTC driver state machine.
static uint16_t ltc_cmdRDCVF[4]
uint8_t LTC_CheckReEntrance(LTC_STATE_s *ltc_state)
re-entrance check of LTC state machine trigger function
static uint16_t ltc_BC_cmdADOW_PUP_normal_DCP0[4]
static void LTC_InitializeDatabase(LTC_STATE_s *ltc_state)
in the database, initializes the fields related to the LTC drivers.
static uint16_t ltc_cmdRDCOMM[4]
uint16_t ltc_RxPecBuffer[LTC_N_BYTES_FOR_DATA_TRANSMISSION]
static DATA_BLOCK_SLAVE_CONTROL_s ltc_slave_control
static uint16_t ltc_I2CcmdTempSens0[6]
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.
static LTC_OPENWIRE_DETECTION_s ltc_openWireDetection
static uint16_t ltc_cmdSTCOMM[4]
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
static uint16_t ltc_cmdADAX_filtered_GPIO1[4]
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.
static uint16_t ltc_cmdWRCFG[4]
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.
static uint16_t ltc_BC_cmdADOW_PUP_filtered_DCP0[4]
static DATA_BLOCK_CELL_TEMPERATURE_s ltc_celltemperature
static uint16_t ltc_cmdADCV_filtered_DCP1[4]
static uint16_t ltc_cmdADAX_fast_GPIO1[4]
LTC_MUX_SEQUENCE_s ltc_mux_seq
Header for the configuration for the LTC 6804-1 6811-1, 6812-1, and 6813-1 monitoring IC.
#define LTC_STATEMACH_MEAS_SINGLE_GPIO_FAST_TCYCLE
#define LTC_STATEMACH_MEAS_ALL_CELLS_FAST_TCYCLE
#define LTC_DISCARD_MUX_CHECK
#define LTC_STATEMACH_MEAS_ALL_GPIOS_FILTERED_TCYCLE
#define LTC_STATEMACH_MEAS_ALL_CELLS_NORMAL_TCYCLE
#define LTC_STATEMACH_MEAS_ALL_GPIOS_NORMAL_TCYCLE
#define LTC_STATEMACH_MEAS_SINGLE_GPIO_FILTERED_TCYCLE
#define LTC_GOTO_MUX_CHECK
#define LTC_STATEMACH_MEAS_TWO_CELLS_FILTERED_TCYCLE
#define LTC_STATEMACH_MEAS_ALL_CELLS_FILTERED_TCYCLE
#define LTC_STATEMACH_MEAS_ALL_GPIOS_FAST_TCYCLE
#define LTC_STATEMACH_MEAS_TWO_CELLS_NORMAL_TCYCLE
#define LTC_STATEMACH_MEAS_TWO_CELLS_FAST_TCYCLE
#define LTC_6813_MAX_SUPPORTED_CELLS
Defines the maximal number of supported cells per module.
#define LTC_STATEMACH_MEAS_SINGLE_GPIO_NORMAL_TCYCLE
bool AFE_IsTransmitOngoing(LTC_STATE_s *pLtcState)
gets the SPI transmit status.
void AFE_SetTransmitOngoing(LTC_STATE_s *pLtcState)
sets the SPI transmit status.
#define LTC_N_BYTES_FOR_DATA_TRANSMISSION
@ LTC_RE_ENTRY_INITIALIZATION
@ LTC_ENTRY_INITIALIZATION
@ LTC_START_INIT_INITIALIZATION
@ LTC_EXIT_INITIALIZATION
@ LTC_CHECK_INITIALIZATION
@ LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM
@ LTC_USER_IO_SEND_CLOCK_STCOMM
@ LTC_USER_IO_READ_INPUT_REGISTER
@ LTC_USER_IO_SET_OUTPUT_REGISTER
@ LTC_STATE_EEPROM_READ_REQUEST
@ LTC_STATE_USER_IO_READ_REQUEST_TI
@ LTC_STATE_USER_IO_READ_REQUEST
@ LTC_STATE_EEPROM_WRITE_REQUEST
@ LTC_STATE_USER_IO_WRITE_REQUEST
@ LTC_STATE_USER_IO_WRITE_REQUEST_TI
@ LTC_STATE_OPENWIRE_CHECK_REQUEST
@ LTC_STATE_TEMP_SENS_READ_REQUEST
@ LTC_STATEMACH_BALANCEFEEDBACK_REQUEST
@ LTC_STATEMACH_INITIALIZATION
@ LTC_STATEMACH_USER_IO_FEEDBACK
@ LTC_STATEMACH_UNINITIALIZED
@ LTC_STATEMACH_MUXMEASUREMENT
@ LTC_STATEMACH_TEMP_SENS_READ
@ LTC_STATEMACH_BALANCECONTROL
@ LTC_STATEMACH_EEPROM_WRITE
@ LTC_STATEMACH_EEPROM_READ
@ LTC_STATEMACH_USER_IO_FEEDBACK_TI
@ LTC_STATEMACH_STARTMEAS_CONTINUE
@ LTC_STATEMACH_READALLGPIO
@ LTC_STATEMACH_OPENWIRE_CHECK
@ LTC_STATEMACH_USER_IO_CONTROL_TI
@ LTC_STATEMACH_USER_IO_CONTROL
@ LTC_STATEMACH_READVOLTAGE
@ LTC_STATEMACH_BALANCEFEEDBACK
@ LTC_STATEMACH_INITIALIZED
@ LTC_STATEMACH_STARTMEAS
@ LTC_STATEMACH_MEASCYCLE_FINISHED
@ LTC_STATEMACH_ALLGPIOMEASUREMENT
@ LTC_STATEMACH_READMUXMEASUREMENT
@ LTC_CONFIG_BALANCECONTROL
@ LTC_SAVE_FEEDBACK_BALANCECONTROL
@ LTC_STATEMACH_MUXCONFIGURATION_INIT
@ LTC_CONFIG2_BALANCECONTROL_END
@ LTC_READ_FEEDBACK_BALANCECONTROL
@ LTC_CONFIG2_BALANCECONTROL
@ LTC_STATEMACH_STOREMUXMEASUREMENT
#define LTC_DATA_SIZE_IN_BYTES
@ LTC_EEPROM_SEND_CLOCK_STCOMM4
@ LTC_EEPROM_SEND_CLOCK_STCOMM2
@ LTC_EEPROM_READ_I2C_TRANSMISSION_RESULT_RDCOMM
@ LTC_EEPROM_SEND_CLOCK_STCOMM3
@ LTC_EEPROM_SEND_CLOCK_STCOMM1
@ LTC_REQUEST_PULLDOWN_CURRENT_OPENWIRE_CHECK
@ LTC_READ_VOLTAGES_PULLDOWN_OPENWIRE_CHECK
@ LTC_READ_VOLTAGES_PULLUP_OPENWIRE_CHECK
@ LTC_REQUEST_PULLUP_CURRENT_OPENWIRE_CHECK
@ LTC_PERFORM_OPENWIRE_CHECK
@ LTC_ADCMEAS_SINGLECHANNEL_GPIO5
@ LTC_ADCMEAS_SINGLECHANNEL_GPIO2
@ LTC_ADCMEAS_SINGLECHANNEL_GPIO4
@ LTC_ADCMEAS_SINGLECHANNEL_GPIO1
@ LTC_ADCMEAS_SINGLECHANNEL_GPIO3
@ LTC_ADCMEAS_SINGLECHANNEL_TWOCELLS
@ LTC_ADCMEAS_ALLCHANNEL_GPIOS
@ LTC_ADCMEAS_ALLCHANNEL_CELLS
@ LTC_USER_IO_SET_OUTPUT_REGISTER_TI
@ LTC_USER_IO_SET_DIRECTION_REGISTER_TI
@ LTC_USER_IO_READ_INPUT_REGISTER_TI_FIRST
@ LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM_TI_SECOND
@ LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM_TI_THIRD
@ LTC_USER_IO_SAVE_DATA_TI
@ LTC_USER_IO_READ_INPUT_REGISTER_TI_SECOND
@ LTC_USER_IO_READ_I2C_TRANSMISSION_RESULT_RDCOMM_TI_FOURTH
@ LTC_USER_IO_SEND_CLOCK_STCOMM_TI
LTC_PORT_EXPANDER_TI_DIRECTION_e
@ LTC_PORT_EXPANDER_TI_OUTPUT
@ LTC_PORT_EXPANDER_TI_INPUT
@ LTC_ALREADY_INITIALIZED
@ LTC_TEMP_SENS_READ_I2C_TRANSMISSION_RESULT_RDCOMM
@ LTC_TEMP_SENS_SEND_CLOCK_STCOMM1
@ LTC_TEMP_SENS_SEND_CLOCK_STCOMM2
@ LTC_TEMP_SENS_SAVE_TEMP
@ LTC_TEMP_SENS_SEND_DATA1
@ LTC_TEMP_SENS_READ_DATA1
@ LTC_READ_I2C_TRANSMISSION_RESULT_RDCOMM_MUXMEASUREMENT_CONFIG
@ LTC_READ_I2C_TRANSMISSION_CHECK_MUXMEASUREMENT_CONFIG
@ LTC_SEND_CLOCK_STCOMM_MUXMEASUREMENT_CONFIG
@ LTC_READ_AUXILIARY_REGISTER_D_RDAUXD
@ LTC_READ_VOLTAGE_REGISTER_F_RDCVF_READVOLTAGE
@ LTC_READ_AUXILIARY_REGISTER_A_RDAUXA
@ LTC_READ_VOLTAGE_REGISTER_A_RDCVA_READVOLTAGE
@ LTC_READ_VOLTAGE_REGISTER_D_RDCVD_READVOLTAGE
@ LTC_READ_AUXILIARY_REGISTER_C_RDAUXC
@ LTC_EXIT_READAUXILIARY_ALLGPIOS
@ LTC_READ_AUXILIARY_REGISTER_B_RDAUXB
@ LTC_READ_VOLTAGE_REGISTER_B_RDCVB_READVOLTAGE
@ LTC_READ_VOLTAGE_REGISTER_E_RDCVE_READVOLTAGE
@ LTC_READ_VOLTAGE_REGISTER_C_RDCVC_READVOLTAGE
@ LTC_REUSE_READVOLT_FOR_ADOW_PUP
@ LTC_REUSE_READVOLT_FOR_ADOW_PDOWN
@ LTC_ADCMODE_FILTERED_DCP1
@ LTC_ADCMODE_NORMAL_DCP0
@ LTC_ADCMODE_FILTERED_DCP0
@ LTC_ADCMODE_NORMAL_DCP1
Declaration of the OS wrapper interface.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void PEX_SetPin(uint8_t portExpander, uint8_t pin)
sets pin to high.
void PEX_SetPinDirectionOutput(uint8_t portExpander, uint8_t pin)
sets pin to input.
Header for the driver for the NXP PCA9539 port expander module.
#define PEX_PORT_EXPANDER3
SPI_INTERFACE_CONFIG_s spi_ltcInterface[BS_NR_OF_STRINGS]
struct definition for plausibility values of an AFE
const int16_t maximumPlausibleVoltage_mV
uint16_t invalidGpioVoltages[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]
int16_t gpioVoltages_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING *BS_NR_OF_GPIOS_PER_MODULE]
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
uint16_t nrBalancedCells[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint16_t value[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]
DATA_BLOCK_HEADER_s header
int16_t cellTemperature_ddegC[BS_NR_OF_STRINGS][BS_NR_OF_TEMP_SENSORS_PER_STRING]
uint16_t nrValidTemperatures[BS_NR_OF_STRINGS]
uint16_t invalidCellTemperature[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]
int32_t packVoltage_mV[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint64_t invalidCellVoltage[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING]
uint16_t nrValidCellVoltages[BS_NR_OF_STRINGS]
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
DATA_BLOCK_HEADER_s header
uint8_t openWire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES_PER_STRING *BS_NR_OF_CELL_BLOCKS_PER_MODULE]
uint32_t eepromWriteAddressToUse
uint32_t eepromWriteAddressLastUsed
uint8_t ioValueOut[BS_NR_OF_MODULES_PER_STRING]
uint32_t eepromReadAddressToUse
uint32_t eepromReadAddressLastUsed
uint8_t ioValueIn[BS_NR_OF_MODULES_PER_STRING]
uint8_t eepromValueWrite[BS_NR_OF_MODULES_PER_STRING]
uint8_t externalTemperatureSensor[BS_NR_OF_MODULES_PER_STRING]
uint8_t eepromValueRead[BS_NR_OF_MODULES_PER_STRING]
DATA_BLOCK_HEADER_s header
LTC_OPENWIRE_DETECTION_s * openWireDetection
DATA_BLOCK_ALL_GPIO_VOLTAGES_s * allGpioVoltages
DATA_BLOCK_CELL_VOLTAGE_s * cellVoltage
DATA_BLOCK_CELL_TEMPERATURE_s * cellTemperature
LTC_ERRORTABLE_s * errorTable
DATA_BLOCK_BALANCING_FEEDBACK_s * balancingFeedback
SPI_INTERFACE_CONFIG_s * pSpiInterface
DATA_BLOCK_SLAVE_CONTROL_s * slaveControl
DATA_BLOCK_OPEN_WIRE_s * openWire
DATA_BLOCK_BALANCING_CONTROL_s * balancingControl
uint8_t PEC_valid[BS_NR_OF_STRINGS][LTC_N_LTC]
uint8_t mux3[BS_NR_OF_STRINGS][LTC_N_LTC]
uint8_t mux2[BS_NR_OF_STRINGS][LTC_N_LTC]
uint8_t mux0[BS_NR_OF_STRINGS][LTC_N_LTC]
uint8_t mux1[BS_NR_OF_STRINGS][LTC_N_LTC]
LTC_MUX_CH_CFG_s * seqptr
int32_t openWireDelta[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
int16_t openWirePdown[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
int16_t openWirePup[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
LTC_STATE_REQUEST_e request
uint32_t commandDataTransferTime
DIAG_ID_e voltMeasDiagErrorEntry
DIAG_ID_e pecDiagErrorEntry
DIAG_ID_e muxDiagErrorEntry
uint8_t muxmeas_nr_end[BS_NR_OF_STRINGS]
DIAG_ID_e tempMeasDiagErrorEntry
SPI_INTERFACE_CONFIG_s * spiSeqPtr
uint32_t commandTransferTime
SPI_INTERFACE_CONFIG_s * spiSeqEndPtr
LTC_STATEMACH_e laststate
LTC_ADCMEAS_CHAN_e adcMeasCh
LTC_REUSE_MODE_e reusageMeasurementMode
uint32_t gpioClocksTransferTime
uint8_t resendCommandCounter
DIAG_ID_e spiDiagErrorEntry
uint8_t spiNumberInterfaces
LTC_MUX_CH_CFG_s * muxmeas_seqendptr[BS_NR_OF_STRINGS]
LTC_MUX_CH_CFG_s * muxmeas_seqptr[BS_NR_OF_STRINGS]
uint32_t ErrRequestCounter
STD_RETURN_TYPE_e balance_control_done
STD_RETURN_TYPE_e check_spi_flag
bool first_measurement_made
LTC_ADCMEAS_CHAN_e adcMeasChreq