Добавлены таймауты CAN

This commit is contained in:
cfif 2026-08-27 17:10:25 +03:00
parent 98bda970fd
commit adb3e378fe
10 changed files with 154 additions and 68 deletions

View File

@ -10,7 +10,7 @@
#ifdef __DEF_CCU_CANDB__
ccu_candb_rx_t ccu_candb_rx;
ccu_candb_error_rx_t ccu_candb_error_rx;
ccu_candb_tx_t ccu_candb_tx;
#endif // __DEF_CCU_CANDB__

View File

@ -46,6 +46,43 @@ typedef struct
Diag_Functional_t Diag_Functional;
} ccu_candb_rx_t;
typedef struct
{
uint8_t ESC_04;
uint8_t EMS_Veh;
uint8_t BCM_Powertrain;
uint8_t EMS_Veh_02;
uint8_t BCM_EEM;
uint8_t DMFR_Msg1;
uint8_t DMFL_Msg1;
uint8_t TM_Stat;
uint8_t TM_CP;
uint8_t HVC_CCU_Status_Msg;
uint8_t BCM_VEH_STATE;
uint8_t EMS_HVC_Req_Msg;
uint8_t HVC_Err_Status_Msg;
uint8_t BCM_CLIMATIC_DATA;
uint8_t VCU_CCU_Req;
uint8_t ESC_08;
uint8_t SMFL_status;
uint8_t SMFR_status;
uint8_t SMRL_status;
uint8_t SMRR_status;
uint8_t SDM_Cmd;
uint8_t VEH_VIN;
uint8_t OCUFL_MSG;
uint8_t OCUFR_MSG;
uint8_t OCURL_MSG;
uint8_t OCURR_MSG;
uint8_t DW_STATE;
uint8_t FIU_CCU1;
uint8_t FIU_CCU2;
uint8_t FIU_CCU3;
uint8_t Diag_To_CCU;
uint8_t Diag_Functional;
} ccu_candb_error_rx_t;
typedef struct
{
CCU_HVC_Req_Msg_t CCU_HVC_Req_Msg;
@ -67,7 +104,7 @@ uint32_t ccu_candb_Receive(ccu_candb_rx_t* m, const uint8_t* d, uint32_t msgid,
#ifdef __DEF_CCU_CANDB__
extern ccu_candb_rx_t ccu_candb_rx;
extern ccu_candb_error_rx_t ccu_candb_error_rx;
extern ccu_candb_tx_t ccu_candb_tx;
#endif // __DEF_CCU_CANDB__

View File

@ -7,6 +7,8 @@
#define __DEF_CCU_CANDB__
#define CANDB_USE_DIAG_MONITORS 1
/* ------------------------------------------------------------------------- *
This define enables using CAN message structs with bit-fielded signals
layout.

View File

@ -25,7 +25,7 @@ typedef struct
// @timeout_cycle keeps maximum timeout for frame, user responsibility
// to init this field and use it in missing frame monitoring function
uint32_t timeout_cycle;
uint32_t prev_cycle;
// @frame_cnt keeps count of all the received frames
uint32_t frame_cnt;

View File

@ -4647,7 +4647,7 @@ uint32_t Unpack_CCU_HVC_Req_Msg_candb(CCU_HVC_Req_Msg_t* _m, const uint8_t* _d,
_m->CCU_HVC_Req_RC = (uint8_t) ( ((_d[1] >> 4U) & (0x0FU)) );
_m->CCU_HVC_Req_CS = (uint8_t) ( (_d[2] & (0xFFU)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_HVC_Req_Msg_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -4745,7 +4745,7 @@ uint32_t Unpack_CCU_Stat1_candb(CCU_Stat1_t* _m, const uint8_t* _d, uint8_t dlc_
_m->CCU_TargetTempRL_Stat_phys = (sigfloat_t)(CANDB_CCU_TargetTempRL_Stat_ro_fromS(_m->CCU_TargetTempRL_Stat_ro));
#endif // CANDB_USE_SIGFLOAT
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_Stat1_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -4840,7 +4840,7 @@ uint32_t Unpack_CCU_Stat2_candb(CCU_Stat2_t* _m, const uint8_t* _d, uint8_t dlc_
_m->CCU_DeflectorSwRLB_Stat = (uint8_t) ( ((_d[5] >> 4U) & (0x03U)) );
_m->CCU_DeflectorSwRRB_Stat = (uint8_t) ( ((_d[5] >> 6U) & (0x03U)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_Stat2_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -4898,7 +4898,7 @@ uint32_t Unpack_CCU_Requests_candb(CCU_Requests_t* _m, const uint8_t* _d, uint8_
_m->CCU_CarpetHeatRL_Req = (uint8_t) ( ((_d[0] >> 2U) & (0x01U)) );
_m->CCU_CarpetHeatRR_Req = (uint8_t) ( ((_d[0] >> 3U) & (0x01U)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_Requests_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -4952,7 +4952,7 @@ uint32_t Unpack_CCU_Stat3_candb(CCU_Stat3_t* _m, const uint8_t* _d, uint8_t dlc_
_m->CCU_RRfootBlowDis_Stat = (uint8_t) ( ((_d[3] >> 4U) & (0x01U)) );
_m->CCU_RestMode2_Stat = (uint8_t) ( ((_d[3] >> 5U) & (0x03U)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_Stat3_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -5030,7 +5030,7 @@ uint32_t Unpack_CCU_VCU_Msg1_candb(CCU_VCU_Msg1_t* _m, const uint8_t* _d, uint8_
_m->CCU_LiquidHeaterTargetTemp_Req = (uint8_t) ( (_d[6] & (0x7FU)) );
_m->CCU_VCU_Msg1_RC = (uint8_t) ( ((_d[7] >> 4U) & (0x0FU)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_VCU_Msg1_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -5127,7 +5127,7 @@ uint32_t Unpack_CCU_VCU_Msg2_candb(CCU_VCU_Msg2_t* _m, const uint8_t* _d, uint8_
_m->CCU_VCU_Msg2_RC = (uint8_t) ( ((_d[7] >> 4U) & (0x0FU)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_VCU_Msg2_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -5652,7 +5652,7 @@ uint32_t Unpack_CCU_Msg1_candb(CCU_Msg1_t* _m, const uint8_t* _d, uint8_t dlc_)
_m->CCU_MSG1_RC = (uint8_t) ( ((_d[6] >> 4U) & (0x0FU)) );
_m->CCU_MSG1_CS = (uint8_t) ( (_d[7] & (0xFFU)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_Msg1_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -7241,7 +7241,7 @@ uint32_t Unpack_CCU_Errors_candb(CCU_Errors_t* _m, const uint8_t* _d, uint8_t dl
_m->CCU_IonizationErr_Stat = (uint8_t) ( (_d[3] & (0x07U)) );
_m->CCU_AromaErr_Stat = (uint8_t) ( ((_d[3] >> 3U) & (0x07U)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_Errors_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -7300,7 +7300,7 @@ uint32_t Unpack_CCU_Msg3_candb(CCU_Msg3_t* _m, const uint8_t* _d, uint8_t dlc_)
_m->CCU_MSG3_RC = (uint8_t) ( (_d[3] & (0x0FU)) );
_m->CCU_MSG3_CS = (uint8_t) ( (_d[4] & (0xFFU)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_Msg3_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -16385,7 +16385,7 @@ uint32_t Unpack_Diag_From_CCU_candb(Diag_From_CCU_t* _m, const uint8_t* _d, uint
(void)dlc_;
_m->Diag_From_CCU_Sig = (uint64_t) ( ((uint64_t)(_d[0] & (0xFFU)) << 56U) | ((uint64_t)(_d[1] & (0xFFU)) << 48U) | ((uint64_t)(_d[2] & (0xFFU)) << 40U) | ((uint64_t)(_d[3] & (0xFFU)) << 32U) | ((_d[4] & (0xFFU)) << 24U) | ((_d[5] & (0xFFU)) << 16U) | ((_d[6] & (0xFFU)) << 8U) | (_d[7] & (0xFFU)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < Diag_From_CCU_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;
@ -18456,7 +18456,7 @@ uint32_t Unpack_CCU_AC_Ctrl_candb(CCU_AC_Ctrl_t* _m, const uint8_t* _d, uint8_t
_m->CCU_VCU_AC_WorkReq = (uint8_t) ( (_d[3] & (0x01U)) );
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
_m->mon1.dlc_error = (dlc_ < CCU_AC_Ctrl_DLC);
_m->mon1.last_cycle = GetSystemTick();
_m->mon1.frame_cnt++;

View File

@ -17982,7 +17982,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -18829,7 +18829,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -19562,7 +19562,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -19668,7 +19668,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -19933,7 +19933,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -20039,7 +20039,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -20217,7 +20217,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -23649,7 +23649,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -32192,7 +32192,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -32296,7 +32296,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -55507,7 +55507,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;
@ -56529,7 +56529,7 @@ typedef struct
#endif // CANDB_USE_BITS_SIGNAL
#ifdef CANDB_USE_DIAG_MONITORS
#ifdef CANDB_USE_DIAG_MONITORS_TX
FrameMonitor_t mon1;

View File

@ -20,7 +20,7 @@ void CanSpamReceiver_Init(tCanSpamReceiver *env,
env->logger = logger;
env->access = osMutexNew(NULL);
/*
env->ccu_candb_rx_LOCAL_HVAC_VIN = osMessageQueueNew(1, 17, NULL);
env->ccu_candb_rx_LOCAL_HVAC_UDS_VIN = osMessageQueueNew(1, 17, NULL);
env->ccu_candb_rx_TM_CP = osMessageQueueNew(1, sizeof(ccu_candb_rx.TM_CP), NULL);
@ -33,7 +33,19 @@ void CanSpamReceiver_Init(tCanSpamReceiver *env,
env->ccu_candb_rx_BCM_VEH_STATE = osMessageQueueNew(1, sizeof(ccu_candb_rx.BCM_VEH_STATE), NULL);
env->ccu_candb_rx_EMS_HVC_Req_Msg = osMessageQueueNew(1, sizeof(ccu_candb_rx.EMS_HVC_Req_Msg), NULL);
env->ccu_candb_rx_HVC_Err_Status_Msg = osMessageQueueNew(1, sizeof(ccu_candb_rx.HVC_Err_Status_Msg), NULL);
*/
env->ccu_candb_rx_LOCAL_HVAC_VIN = osMessageQueueNew(1, 17, NULL);
env->ccu_candb_rx_LOCAL_HVAC_UDS_VIN = osMessageQueueNew(1, 17, NULL);
env->ccu_candb_rx_TM_CP = osMessageQueueNew(1, sizeof(rtDW.TM_CP_model), NULL);
env->ccu_candb_rx_FIU_CCU1 = osMessageQueueNew(1, sizeof(rtDW.FIU_CCU1_MODEL), NULL);
env->ccu_candb_rx_FIU_CCU2 = osMessageQueueNew(1, sizeof(rtDW.FIU_CCU2_MODEL), NULL);
env->ccu_candb_rx_BCM_Powertrain = osMessageQueueNew(1, sizeof(rtDW.CCUCAN_BCM_Powertrain_model), NULL);
env->ccu_candb_rx_BCM_CLIMATIC_DATA = osMessageQueueNew(1, sizeof(rtDW.CCUCAN_BCM_Climatic_model), NULL);
env->ccu_candb_rx_EMS_Veh = osMessageQueueNew(1, sizeof(rtDW.CCUCAN_EMS_Veh_model), NULL);
env->ccu_candb_rx_ESC_04 = osMessageQueueNew(1, sizeof(rtDW.CCUCAN_ESC_04_model), NULL);
env->ccu_candb_rx_BCM_VEH_STATE = osMessageQueueNew(1, sizeof(rtDW.CCUCAN_BCM_VEH_STATE_model), NULL);
env->ccu_candb_rx_EMS_HVC_Req_Msg = osMessageQueueNew(1, sizeof(rtDW.CCUCAN_EMS_HVC_REQ_MSG_MODEL), NULL);
env->ccu_candb_rx_HVC_Err_Status_Msg = osMessageQueueNew(1, sizeof(rtDW.HVC_ERR_STATUS_MSG_MODEL), NULL);
env->thread.stack = tCanSpamReceiver_stack;
InitThreadAtr(&env->thread.attr, "CanSpamRec", &env->thread.controlBlock, sizeof(env->thread.controlBlock),
@ -44,9 +56,72 @@ void CanSpamReceiver_Init(tCanSpamReceiver *env,
// osPriorityNormal);
}
#define timeout_CAN_Threshold_Error 3000
// Структура для таблицы мониторов
typedef struct {
uint32_t can_id;
FrameMonitor_t *monitor;
uint8_t *error_flag;
} CAN_MonitorEntry_t;
// Таблица всех мониторов
static const CAN_MonitorEntry_t g_can_monitors[] = {
{ESC_04_CANID, &ccu_candb_rx.ESC_04.mon1, &ccu_candb_error_rx.ESC_04},
{EMS_Veh_CANID, &ccu_candb_rx.EMS_Veh.mon1, &ccu_candb_error_rx.EMS_Veh},
{BCM_Powertrain_CANID, &ccu_candb_rx.BCM_Powertrain.mon1, &ccu_candb_error_rx.BCM_Powertrain},
{EMS_Veh_02_CANID, &ccu_candb_rx.EMS_Veh_02.mon1, &ccu_candb_error_rx.EMS_Veh_02},
{BCM_EEM_CANID, &ccu_candb_rx.BCM_EEM.mon1, &ccu_candb_error_rx.BCM_EEM},
{DMFR_Msg1_CANID, &ccu_candb_rx.DMFR_Msg1.mon1, &ccu_candb_error_rx.DMFR_Msg1},
{DMFL_Msg1_CANID, &ccu_candb_rx.DMFL_Msg1.mon1, &ccu_candb_error_rx.DMFL_Msg1},
{TM_Stat_CANID, &ccu_candb_rx.TM_Stat.mon1, &ccu_candb_error_rx.TM_Stat},
{TM_CP_CANID, &ccu_candb_rx.TM_CP.mon1, &ccu_candb_error_rx.TM_CP},
{HVC_CCU_Status_Msg_CANID, &ccu_candb_rx.HVC_CCU_Status_Msg.mon1, &ccu_candb_error_rx.HVC_CCU_Status_Msg},
{BCM_VEH_STATE_CANID, &ccu_candb_rx.BCM_VEH_STATE.mon1, &ccu_candb_error_rx.BCM_VEH_STATE},
{EMS_HVC_Req_Msg_CANID, &ccu_candb_rx.EMS_HVC_Req_Msg.mon1, &ccu_candb_error_rx.EMS_HVC_Req_Msg},
{HVC_Err_Status_Msg_CANID, &ccu_candb_rx.HVC_Err_Status_Msg.mon1, &ccu_candb_error_rx.HVC_Err_Status_Msg},
{BCM_CLIMATIC_DATA_CANID, &ccu_candb_rx.BCM_CLIMATIC_DATA.mon1, &ccu_candb_error_rx.BCM_CLIMATIC_DATA},
{VCU_CCU_Req_CANID, &ccu_candb_rx.VCU_CCU_Req.mon1, &ccu_candb_error_rx.VCU_CCU_Req},
{ESC_08_CANID, &ccu_candb_rx.ESC_08.mon1, &ccu_candb_error_rx.ESC_08},
{SMFL_status_CANID, &ccu_candb_rx.SMFL_status.mon1, &ccu_candb_error_rx.SMFL_status},
{SMFR_status_CANID, &ccu_candb_rx.SMFR_status.mon1, &ccu_candb_error_rx.SMFR_status},
{SMRL_status_CANID, &ccu_candb_rx.SMRL_status.mon1, &ccu_candb_error_rx.SMRL_status},
{SMRR_status_CANID, &ccu_candb_rx.SMRR_status.mon1, &ccu_candb_error_rx.SMRR_status},
{SDM_Cmd_CANID, &ccu_candb_rx.SDM_Cmd.mon1, &ccu_candb_error_rx.SDM_Cmd},
{VEH_VIN_CANID, &ccu_candb_rx.VEH_VIN.mon1, &ccu_candb_error_rx.VEH_VIN},
{OCUFL_MSG_CANID, &ccu_candb_rx.OCUFL_MSG.mon1, &ccu_candb_error_rx.OCUFL_MSG},
{OCUFR_MSG_CANID, &ccu_candb_rx.OCUFR_MSG.mon1, &ccu_candb_error_rx.OCUFR_MSG},
{OCURL_MSG_CANID, &ccu_candb_rx.OCURL_MSG.mon1, &ccu_candb_error_rx.OCURL_MSG},
{OCURR_MSG_CANID, &ccu_candb_rx.OCURR_MSG.mon1, &ccu_candb_error_rx.OCURR_MSG},
{DW_STATE_CANID, &ccu_candb_rx.DW_STATE.mon1, &ccu_candb_error_rx.DW_STATE},
{FIU_CCU1_CANID, &ccu_candb_rx.FIU_CCU1.mon1, &ccu_candb_error_rx.FIU_CCU1},
{FIU_CCU2_CANID, &ccu_candb_rx.FIU_CCU2.mon1, &ccu_candb_error_rx.FIU_CCU2},
{FIU_CCU3_CANID, &ccu_candb_rx.FIU_CCU3.mon1, &ccu_candb_error_rx.FIU_CCU3},
};
#define CAN_MONITOR_COUNT (sizeof(g_can_monitors) / sizeof(g_can_monitors[0]))
static void CheckAllCANMonitors(void) {
uint32_t current_time = SystemGetMs();
for (uint32_t i = 0; i < CAN_MONITOR_COUNT; i++) {
FrameMonitor_t *mon = g_can_monitors[i].monitor;
// Проверяем таймаут
uint32_t diff = current_time - mon->last_cycle;
uint8_t error = (diff > timeout_CAN_Threshold_Error) ? 1 : 0;
// Сохраняем ошибку
*(g_can_monitors[i].error_flag) = error;
}
}
static void set_CanSpamReceiver(tCanSpamReceiver *env, uint32_t recid) {
osStatus_t status = osOK;
// ВСЕГДА проверяем все мониторы на таймаут
CheckAllCANMonitors();
uint32_t countQueue_ccu_candb_rx = osMessageQueueGetSpace(env->ccu_candb_rx_TM_CP);
if ((countQueue_ccu_candb_rx) && (recid == TM_CP_CANID)) {
status = osMessageQueuePut(env->ccu_candb_rx_TM_CP, &ccu_candb_rx.TM_CP, 0, 0U);
@ -273,34 +348,6 @@ void get_CanSpamReceiver(tCanSpamReceiver *env, char *VIN) {
status = osMessageQueueGet(env->ccu_candb_rx_LOCAL_HVAC_VIN, VIN, 0, 0U);
}
/*
if (osMutexAcquire(env->access, 5000) == osOK) {
memcpy(&rtDW.TM_CP_model, &ccu_candb_rx.TM_CP, sizeof(rtDW.TM_CP_model));
memcpy(&rtDW.FIU_CCU1_MODEL, &ccu_candb_rx.FIU_CCU1, sizeof(rtDW.FIU_CCU1_MODEL));
memcpy(&rtDW.FIU_CCU2_MODEL, &ccu_candb_rx.FIU_CCU2, sizeof(rtDW.FIU_CCU2_MODEL));
// memcpy(&rtDW.FIU_CCU3_MODEL, &ccu_candb_rx.FIU_CCU3, sizeof(rtDW.FIU_CCU3_MODEL));
memset(&ccu_candb_rx.FIU_CCU1,0,sizeof(ccu_candb_rx.FIU_CCU1));
memset(&ccu_candb_rx.FIU_CCU2,0,sizeof(ccu_candb_rx.FIU_CCU2));
memcpy(&rtDW.CCUCAN_BCM_Powertrain_model, &ccu_candb_rx.BCM_Powertrain,
sizeof(rtDW.CCUCAN_BCM_Powertrain_model));
memcpy(&rtDW.CCUCAN_BCM_Climatic_model, &ccu_candb_rx.BCM_CLIMATIC_DATA,
sizeof(rtDW.CCUCAN_BCM_Climatic_model));
memcpy(&rtDW.CCUCAN_EMS_Veh_model, &ccu_candb_rx.EMS_Veh, sizeof(rtDW.CCUCAN_EMS_Veh_model));
memcpy(&rtDW.CCUCAN_ESC_04_model, &ccu_candb_rx.ESC_04, sizeof(rtDW.CCUCAN_ESC_04_model));
memcpy(&rtDW.CCUCAN_BCM_VEH_STATE_model, &ccu_candb_rx.BCM_VEH_STATE, sizeof(rtDW.CCUCAN_BCM_VEH_STATE_model));
memcpy(&rtDW.CCUCAN_EMS_HVC_REQ_MSG_MODEL, &ccu_candb_rx.EMS_HVC_Req_Msg,
sizeof(rtDW.CCUCAN_EMS_HVC_REQ_MSG_MODEL));
memcpy(&rtDW.HVC_ERR_STATUS_MSG_MODEL, &ccu_candb_rx.HVC_Err_Status_Msg, sizeof(rtDW.HVC_ERR_STATUS_MSG_MODEL));
osMutexRelease(env->access);
} else {
LoggerErrorStatic(LOGGER, LOG_SIGN, "Access error get_CanSpamReceiver");
}
*/
}
bool get_CanSpamReceiverUDS(tCanSpamReceiver *env, char *VIN, func_update_func update_func, void *update_func_env,

View File

@ -160,7 +160,7 @@ const FilterTo_FLEXCAN_RxMbFilterType IdCanHardSoftFilterCan0[countIdCanHardSoft
*/
#define countIdCanHardSoftFilterCan0 14
#define countIdCanHardSoftFilterCan0 (14 + 6)
const FilterTo_FLEXCAN_RxMbFilterType IdCanHardSoftFilterCan0[countIdCanHardSoftFilterCan0] = {
{FLEXCAN_ID_STD, Diag_To_CCU_CANID, 0x7FF, PROTOCOL_CAN_UDS},
{FLEXCAN_ID_STD, Diag_Functional_CANID, 0x7FF, PROTOCOL_CAN_UDS},
@ -168,8 +168,8 @@ const FilterTo_FLEXCAN_RxMbFilterType IdCanHardSoftFilterCan0[countIdCanHardSoft
{FLEXCAN_ID_STD, BCM_Powertrain_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, EMS_Veh_02_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, BCM_EEM_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, DMFR_Msg1_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, DMFL_Msg1_CANID, 0x7FF, PROTOCOL_CAN_RAW},
{FLEXCAN_ID_STD, DMFR_Msg1_CANID, 0x7FF, PROTOCOL_CAN_RAW}, //!
{FLEXCAN_ID_STD, DMFL_Msg1_CANID, 0x7FF, PROTOCOL_CAN_RAW}, //!
// {FLEXCAN_ID_STD, TM_Stat_CANID, 0x7FF, PROTOCOL_CAN_RAW},
{FLEXCAN_ID_STD, TM_CP_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, HVC_CCU_Status_Msg_CANID, 0x7FF, PROTOCOL_CAN_RAW},
@ -179,10 +179,10 @@ const FilterTo_FLEXCAN_RxMbFilterType IdCanHardSoftFilterCan0[countIdCanHardSoft
{FLEXCAN_ID_STD, BCM_CLIMATIC_DATA_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, VCU_CCU_Req_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, ESC_08_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, SMFL_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, SMFR_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, SMRL_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, SMRR_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},
{FLEXCAN_ID_STD, SMFL_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},//!
{FLEXCAN_ID_STD, SMFR_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},//!
{FLEXCAN_ID_STD, SMRL_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},//!
{FLEXCAN_ID_STD, SMRR_status_CANID, 0x7FF, PROTOCOL_CAN_RAW},//!
// {FLEXCAN_ID_STD, SDM_Cmd_CANID, 0x7FF, PROTOCOL_CAN_RAW},
{FLEXCAN_ID_STD, VEH_VIN_CANID, 0x7FF, PROTOCOL_CAN_RAW},
// {FLEXCAN_ID_STD, OCUFL_MSG_CANID, 0x7FF, PROTOCOL_CAN_RAW},

View File

@ -17,7 +17,7 @@ void Diagnostic_Init(tDiagnostic *env, tLoggerInterface *logger) {
env->access = osMutexNew(NULL);
env->timeout_VIN = SystemGetMs() + 45000;
env->timeoutDTC[DTC_VIN_INVALID_CONFIG] = SystemGetMs() + 45000;
// for (uint8_t i = 0; i < COUNT_DTC_CODE_ERROR; ++i) {
@ -168,7 +168,7 @@ void set_Dtc_state(tDiagnostic *env, uint8_t *dtc_state_error_model, char *VIN)
}
if ((errorVIN) && (SystemGetMs() > env->timeout_VIN)) {
if ((errorVIN) && (SystemGetMs() > env->timeoutDTC[DTC_VIN_INVALID_CONFIG])) {
dtc_state_error_model[DTC_VIN_INVALID_CONFIG] = 1;
}

View File

@ -20,7 +20,7 @@ typedef struct {
bool isNoBitsDTC;
uint32_t timeout_VIN;
uint32_t timeoutDTC[127];
} tDiagnostic;