60 #ifndef FOXBMS__BENDER_ISO165C_CFG_H_
61 #define FOXBMS__BENDER_ISO165C_CFG_H_
74 #define I165C_CAN_NODE (CAN1_NODE)
80 #define I165C_IS_165C_USED (false)
84 #define I165C_SELF_TEST_LONG
87 #define I165C_WARNING_THRESHOLD_kOhm IMD_WARNING_THRESHOLD_INSULATION_RESISTANCE_kOhm
90 #define I165C_ERROR_THRESHOLD_kOhm IMD_ERROR_THRESHOLD_INSULATION_RESISTANCE_kOhm
92 #if ((I165C_WARNING_THRESHOLD_kOhm > 2000u) || (I165C_WARNING_THRESHOLD_kOhm < 40u))
93 #error "Warning threshold outside of possible measurement 40-2000 kOhm"
95 #if ((I165C_ERROR_THRESHOLD_kOhm > 1000u) || (I165C_ERROR_THRESHOLD_kOhm < 30u))
96 #error "Warning threshold outside of possible measurement 40-2000 kOhm"
100 #define I165C_MEASUREMENT_AVERAGING_FACTOR (10u)
103 #define I165C_TRANSMISSION_ATTEMPTS (3u)
106 #define I165C_IMD_INFO_RECEIVE_ATTEMPTS (50u)
109 #define I165C_MAX_QUEUE_READS (5u)
112 #define I165C_QUEUE_TIMEOUT_ms ((TickType_t)0u)
127 #define I165C_DW1 (0u)
129 #define I165C_DW2 (1u)
131 #define I165C_DW3 (2u)
133 #define I165C_DB1 (3u)
135 #define I165C_DB2 (4u)
137 #define I165C_DB3 (5u)
139 #define I165C_DB4 (6u)
144 #define I165C_MESSAGETYPE_IMD_INFO (CAN_ID_IMD_INFO)
146 #define I165C_MESSAGETYPE_IMD_REQUEST (CAN_ID_IMD_REQUEST)
148 #define I165C_MESSAGETYPE_IMD_RESPONSE (CAN_ID_IMD_RESPONSE)
153 #define I165C_CMD_S_IMC_CTL_SELFTEST (0x21u)
154 #define I165C_D_IMC_SELFTEST_SCR_CTL_REQUEST (I165C_DW1)
155 #define I165C_D_IMC_SELFTEST_SCR_CTL_RESPONSE (I165C_DW1)
156 #define I165C_SELFTEST_SCENARIO_NO_ACTION (0u)
157 #define I165C_SELFTEST_SCENARIO_OVERALL (1u)
158 #define I165C_SELFTEST_SCENARIO_PARAMETERCONFIG (2u)
160 #define I165C_CMD_S_VIFC_CTL_IMC_RESET (0xC8u)
163 #define I165C_CMD_S_VIFC_CTL_LOCK (0xCAu)
164 #define I165C_D_VIFC_LOCK_MODE_CTL_REQUEST (I165C_DW1)
165 #define I165C_D_VIFC_LOCK_MODE_CTL_RESPONSE (I165C_DW1)
166 #define I165C_D_VIFC_LOCK_PWD_CTL_REQUEST (I165C_DW2)
167 #define I165C_LOCKMODE_UNLOCKED (0u)
168 #define I165C_LOCKMODE_LOCKED (1u)
169 #define I165C_LOCKMODE_UNKNOWN (100u)
170 #define I165C_UNLOCK_PASSWORD (0u)
171 #define I165C_LOCK_PASSWORD (0xFFFFu)
174 #define I165C_CMD_S_VIFC_CTL_MEASUREMENT (0xCBu)
175 #define I165C_DW_VIFC_CTL_MEASUREMENT_REQUEST (I165C_DW1)
176 #define I165C_DISABLE_MEASUREMENT (0u)
177 #define I165C_ENABLE_MEASUREMENT (1u)
178 #define I165C_MEASUREMENT_MODE_UNKNOWN (100u)
189 #define I165C_CMD_S_IMC_SET_R_ISO_ERR_THR (0x28u)
190 #define I165C_D_IMC_R_ISO_ERR_THR_SET_REQUEST (I165C_DW1)
191 #define I165C_D_IMC_R_ISO_ERR_THR_SET_RESPONSE (I165C_DW1)
193 #define I165C_CMD_S_IMC_SET_R_ISO_ERR_WRN (0x29u)
194 #define I165C_D_IMC_R_ISO_ERR_WRN_SET_REQUEST (I165C_DW1)
195 #define I165C_D_IMC_R_ISO_ERR_WRN_SET_RESPONSE (I165C_DW1)
197 #define I165C_CMD_S_IMC_SET_MEAN_FACTOR (0x2Bu)
198 #define I165C_D_IMC_MEAN_FACTOR_SET_REQUEST (I165C_DW1)
199 #define I165C_D_IMC_MEAN_FACTOR_SET_RESPONSE (I165C_DW1)
201 #define I165C_CMD_S_VIFC_SET_HV_RELAIS (0xD2u)
202 #define I165C_D_VIFC_HV_RELAIS_SET_REQUEST (I165C_DW1)
203 #define I165C_D_VIFC_HV_RELAIS_STATE_SET_REQUEST (I165C_DW2)
204 #define I165C_D_VIFC_HV_RELAIS_NEGATIVE (0u)
205 #define I165C_D_VIFC_HV_RELAIS_POSITIVE (1u)
206 #define I165C_D_VIFC_HV_RELAIS_SET_RESPONSE (I165C_DW1)
207 #define I165C_D_VIFC_HV_RELAIS_STATE_SET_RESPONSE (I165C_DW2)
208 #define I165C_RELAY_STATE_OPEN (0u)
209 #define I165C_RELAY_STATE_CLOSED (1u)
220 #define I165C_CMD_S_VIFC_DUMMY (0x00u)
223 #define I165C_CMD_S_IMC_GET_STATUS (0x37u)
224 #define I165C_D_IMC_STATUS_GET_RESPONSE (I165C_DW1)
225 #define I165C_INSULATION_FAULT_SHIFT (0u)
226 #define I165C_CHASSIS_FAULT_SHIFT (1u)
227 #define I165C_SYSTEM_FAILURE_SHIFT (2u)
228 #define I165C_CALIBRATION_RUNNING_SHIFT (3u)
229 #define I165C_SELFTEST_RUNNING_SHIFT (4u)
230 #define I165C_INSULATION_WARNING_SHIFT (5u)
233 #define I165C_D_IMC_STATUS_EXT_GET_RESPONSE (I165C_DW2)
234 #define I165C_CALIBRATION_PARAMETER_SHIFT (0u)
235 #define I165C_HARDWARE_FAILURE_SHIFT (1u)
236 #define I165C_EEPROM_PARAMETER_SHIFT (2u)
237 #define I165C_FLASH_PARAMETER_SHIFT (3u)
238 #define I165C_RAM_PARAMETER_SHIFT (4u)
239 #define I165C_STACK_OVERFLOW_SHIFT (5u)
240 #define I165C_PARAMETER_VALUE_SHIFT (7u)
241 #define I165C_TEST_PULSE_VOLTAGE_A_REF_SHIFT (8u)
242 #define I165C_VOLTAGE_LEVEL_PLUS12V_SHIFT (9u)
243 #define I165C_VOLTAGE_LEVEL_MINUS12V_SHIFT (10u)
244 #define I165C_FUSE_BIT_VALID_INVALID_SHIFT (11u)
245 #define I165C_HV1_VOLTAGE_SHIFT (12u)
246 #define I165C_HV2_VOLTAGE_SHIFT (13u)
247 #define I165C_MANUFACTURER_STRING_VALID_INVALID_SHIFT (14u)
250 #define I165C_CMD_S_IMC_GET_R_ISO (0x35u)
251 #define I165C_D_IMC_R_ISO_GET_RESPONSE (I165C_DW1)
252 #define I165C_D_IMC_R_ISO_BIAS_GET_RESPONSE (I165C_DB1)
253 #define I165C_BIAS_TO_HV_MINUS (1u)
254 #define I165C_BIAS_TO_HV_PLUS (2u)
255 #define I165C_D_IMC_R_ISO_CNT_GET_RESPONSE (I165C_DB2)
258 #define I165C_CMD_S_IMC_GET_R_ISO_ERR_THR (0x32u)
259 #define I165C_D_IMC_R_ISO_ERR_THR_GET_RESPONSE (I165C_DW1)
262 #define I165C_CMD_S_IMC_GET_R_ISO_WRN_THR (0x39u)
263 #define I165C_D_IMC_R_ISO_WRN_THR_GET_RESPONSE (I165C_DW1)
266 #define I165C_CMD_S_IMC_GET_MEAN_FACTOR (0x3Cu)
267 #define I165C_D_IMC_MEAN_FACTOR_GET_RESPONSE (I165C_DW1)
270 #define I165C_CMD_S_IMC_GET_HV_1 (0x36u)
271 #define I165C_D_IMC_HV_1_GET_RESPONSE (I165C_DW1)
274 #define I165C_CMD_S_IMC_GET_HV_2 (0x3Au)
275 #define I165C_D_IMC_HV_2_GET_RESPONSE (I165C_DW1)
278 #define I165C_CMD_S_IMC_GET_VERSION (0x33u)
279 #define I165C_D_IMC_VERSION_INDEX_GET_REQUEST (I165C_DW1)
280 #define I165C_IMC_BOOTLOADER (0u)
281 #define I165C_IMC_FIRMWARE (1u)
282 #define I165C_IMC_FIRMWARE_ID (2u)
283 #define I165C_IMC_FIRMWARE_HASH (3u)
284 #define I165C_D_IMC_VERSION_INDEX_GET_RESPONSE (I165C_DW1)
285 #define I165C_D_IMC_VERSION_GET_RESPONSE (I165C_DW2)
288 #define I165C_CMD_S_IMC_GET_TEST_CNT (0x5Au)
289 #define I165C_D_IMC_TEST_CNT_GET_RESPONSE (I165C_DW1)
292 #define I165C_CMD_S_IMC_GET_MANUFACTURER (0x3Du)
293 #define I165C_D_IMC_MANUFACT_INDEX_GET_REQUEST (I165C_DW1)
294 #define I165C_D_IMC_MANUFACT_INDEX_GET_RESPONSE (I165C_DW1)
295 #define I165C_D_IMC_MANUFACT_DATA_GET_RESPONSE (I165C_DW2)
298 #define I165C_CMD_S_VIFC_GET_STATUS (0xDCu)
299 #define I165C_D_VIFC_STATUS_GET_RESPONSE (I165C_DW1)
300 #define I165C_INSULATION_MEASUREMENT_STATUS_SHIFT (0u)
301 #define I165C_IMC_CONNECTIVITY_SHIFT (1u)
302 #define I165C_IMC_ALIVE_STATUS_DETECTION_SHIFT (2u)
303 #define I165C_VIFC_COMMAND_SHIFT (4u)
304 #define I165C_RESISTANCE_VALUE_OUTDATED_SHIFT (8u)
305 #define I165C_IMC_SELFTEST_OVERALL_SCENARIO_SHIFT (12u)
306 #define I165C_IMC_SELFTEST_PARAMETERCONFIG_SCENARIO_SHIFT (13u)
309 #define I165C_CMD_S_VIFC_GET_HV_RELAIS (0xDDu)
310 #define I165C_D_VIFC_HV_RELAIS_GET_REQUEST (I165C_DW1)
311 #define I165C_D_VIFC_HV_RELAIS_GET_RESPONSE (I165C_DW1)
312 #define I165C_D_VIFC_HV_RELAIS_STATE_GET_RESPONSE (I165C_DW2)
315 #define I165C_CMD_S_VIFC_GET_IMC_ALIVE (0xE2u)
316 #define I165C_D_VIFC_IMC_ALIVE_GET_RESPONSE (I165C_DW1)
319 #define I165C_CMD_S_VIFC_GET_VERSION (0xDEu)
320 #define I165C_D_IMC_VERSION_INDEX_GET_REQUEST (I165C_DW1)
321 #define I165C_D_VIFC_VERSION_INDEX_GET_RESPONSE (I165C_DW1)
322 #define I165C_D_VIFC_VERSION_GET_RESPONSE (I165C_DW2)
325 #define I165C_CMD_S_VIFC_GET_LOCK (0xE0u)
326 #define I165C_D_VIFC_LOCK_MODE_GET_RESPONSE (I165C_DW1)
Headers for the configuration for the CAN module.
General macros and definitions for the whole platform.
API header for the insulation monitoring device.