Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
TianYing_ty100
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TY
TianYing_ty100
Commits
beb5f293
Commit
beb5f293
authored
Aug 13, 2024
by
陈家乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:52817 AliveCounter信号,仪表重新上电,第一帧发送到数据错误
parent
bce3dc21
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
65 deletions
+84
-65
CAN_CH0_CAN_Communication_Matrix.c
...ce/Application/CAN_APP/CAN_CH0_CAN_Communication_Matrix.c
+4
-4
Can_User.c
Firmware/Source/Application/CAN_User/Can_User.c
+79
-60
Can_User.h
Firmware/Source/Application/CAN_User/Can_User.h
+1
-1
No files found.
Firmware/Source/Application/CAN_APP/CAN_CH0_CAN_Communication_Matrix.c
View file @
beb5f293
...
@@ -8,10 +8,10 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
...
@@ -8,10 +8,10 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
const
st_CAN_SendAttribute
CAN_CH0_CANSendAttr
[
CAN_CH0_ID_SEND_TOTAL
]
=
const
st_CAN_SendAttribute
CAN_CH0_CANSendAttr
[
CAN_CH0_ID_SEND_TOTAL
]
=
{
{
{
0x220ul
,
50ul
*
1000ul
,
7
ul
*
1000ul
,
0u
,
MSG_STD
,
1u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_220
,
(
void
*
)
0
},
{
0x220ul
,
50ul
*
1000ul
,
49
ul
*
1000ul
,
0u
,
MSG_STD
,
1u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_220
,
(
void
*
)
0
},
{
0x6EEul
,
100ul
*
1000ul
,
8ul
*
1000ul
,
0u
,
MSG_STD
,
2u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_6EE
,
(
void
*
)
0
},
{
0x6EEul
,
100ul
*
1000ul
,
9
8ul
*
1000ul
,
0u
,
MSG_STD
,
2u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_6EE
,
(
void
*
)
0
},
{
0x6EFul
,
100ul
*
1000ul
,
9ul
*
1000ul
,
0u
,
MSG_STD
,
3u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_6EF
,
(
void
*
)
0
},
{
0x6EFul
,
100ul
*
1000ul
,
9
7
ul
*
1000ul
,
0u
,
MSG_STD
,
3u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_6EF
,
(
void
*
)
0
},
{
0x450ul
,
100ul
*
1000ul
,
10
ul
*
1000ul
,
0u
,
MSG_STD
,
4u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_450
,
(
void
*
)
0
},
{
0x450ul
,
100ul
*
1000ul
,
96
ul
*
1000ul
,
0u
,
MSG_STD
,
4u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_450
,
(
void
*
)
0
},
#if (IC_Current == TY200_080000b_ty)
#if (IC_Current == TY200_080000b_ty)
{
0x580ul
,
8ul
*
1000ul
,
0ul
*
1000ul
,
0u
,
MSG_STD
,
1u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_580
,
(
void
*
)
0
},
{
0x580ul
,
8ul
*
1000ul
,
0ul
*
1000ul
,
0u
,
MSG_STD
,
1u
,
8u
,
CAN_MSG_TX_CYCLE
,
Can_Set_Buff_580
,
(
void
*
)
0
},
#endif
#endif
...
...
Firmware/Source/Application/CAN_User/Can_User.c
View file @
beb5f293
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include "RTE.h"
#include "RTE.h"
__align
(
4
)
__align
(
4
)
uint32_t
pRXBuff
[
CAN_RX_MSG_Block
*
CAN_CH0_ID_TOTAL_MAX
];
uint32_t
pRXBuff
[
CAN_RX_MSG_Block
*
CAN_CH0_ID_TOTAL_MAX
];
uint32_t
pTXBuff
[
CAN_TX_MSG_Block
*
CAN_CH0_ID_SEND_TOTAL
];
uint32_t
pTXBuff
[
CAN_TX_MSG_Block
*
CAN_CH0_ID_SEND_TOTAL
];
static
RSCAN0BusoffMonitorStruct
RSCAN0Busoff
;
static
RSCAN0BusoffMonitorStruct
RSCAN0Busoff
;
...
@@ -26,8 +26,7 @@ void Can_Init(void)
...
@@ -26,8 +26,7 @@ void Can_Init(void)
Can_Tx_Apply_Buff
();
Can_Tx_Apply_Buff
();
Can_RX_Apply_Buff
();
Can_RX_Apply_Buff
();
RTE_GPIO_Set_Level
(
RTE_GPIO_PORT05_PIN02
,
RTE_GPIO_LEVEL_LOW
);
RTE_GPIO_Set_Level
(
RTE_GPIO_PORT05_PIN02
,
RTE_GPIO_LEVEL_LOW
);
}
}
/**
/**
...
@@ -196,8 +195,6 @@ void Can_Tx_Apply_Buff(void)
...
@@ -196,8 +195,6 @@ void Can_Tx_Apply_Buff(void)
CAN_MessageCache_DeInit
(
CAN0MSG14
);
CAN_MessageCache_DeInit
(
CAN0MSG14
);
CAN_MessageCache_Init
(
CAN0MSG14
,
&
CAN_SendMsg
);
CAN_MessageCache_Init
(
CAN0MSG14
,
&
CAN_SendMsg
);
CAN_SendMsg_Diag_Tx
.
Id
=
DIAG_ID_Tx
;
CAN_SendMsg_Diag_Tx
.
Id
=
DIAG_ID_Tx
;
CAN_SendMsg_Diag_Tx
.
IDE
=
CAN_Id_Standard
;
CAN_SendMsg_Diag_Tx
.
IDE
=
CAN_Id_Standard
;
CAN_SendMsg_Diag_Tx
.
CacheType
=
CAN_CacheType_Tx
;
CAN_SendMsg_Diag_Tx
.
CacheType
=
CAN_CacheType_Tx
;
...
@@ -244,7 +241,14 @@ void COM_CAN_Init(void)
...
@@ -244,7 +241,14 @@ void COM_CAN_Init(void)
Can_TX_BuffInit
(
&
CAN_CH0_CanMsgTxOp
,
CAN_CH0_CANSendAttr
,
CAN_CH0_ID_SEND_TOTAL
,
COM_APP_Process
);
Can_TX_BuffInit
(
&
CAN_CH0_CanMsgTxOp
,
CAN_CH0_CANSendAttr
,
CAN_CH0_ID_SEND_TOTAL
,
COM_APP_Process
);
CAN_TX_SetEnable
(
&
CAN_CH0_CanMsgTxOp
,
CAN_N_TX_Disable
);
CAN_TX_SetEnable
(
&
CAN_CH0_CanMsgTxOp
,
CAN_N_TX_Disable
);
}
}
void
Can_QuickTimer_Init
(
void
)
{
uint32_t
i
=
0u
;
for
(
i
=
0u
;
i
<
CAN_CH0_ID_SEND_TOTAL
;
i
++
)
{
Can_Msg_TX_FastInitCycle
(
&
CAN_CH0_CanMsgTxOp
,
i
,
CAN_CH0_CANSendAttr
[
i
].
u32MsgCycleOffset
);
}
}
/**
/**
* @brief Buff恢复函数
* @brief Buff恢复函数
...
@@ -254,6 +258,7 @@ void Can_BusOff_Recover(uint8_t deltaTime)
...
@@ -254,6 +258,7 @@ void Can_BusOff_Recover(uint8_t deltaTime)
{
{
if
(
get_can_busoff
(
CAN_CH_0
)
==
2
)
if
(
get_can_busoff
(
CAN_CH_0
)
==
2
)
{
{
CAN_TX_Count_Init
();
if
(
RSCAN0Busoff
.
Status
==
RSCAN0_BUS_STABLE
)
if
(
RSCAN0Busoff
.
Status
==
RSCAN0_BUS_STABLE
)
{
{
RSCAN0Busoff
.
Status
=
RSCAN0_BUS_OFF_LV1
;
RSCAN0Busoff
.
Status
=
RSCAN0_BUS_OFF_LV1
;
...
@@ -262,18 +267,21 @@ void Can_BusOff_Recover(uint8_t deltaTime)
...
@@ -262,18 +267,21 @@ void Can_BusOff_Recover(uint8_t deltaTime)
if
(
RSCAN0Busoff
.
Status
==
RSCAN0_BUS_OFF_LV1
)
if
(
RSCAN0Busoff
.
Status
==
RSCAN0_BUS_OFF_LV1
)
{
{
RSCAN0Busoff
.
Timer
++
;
RSCAN0Busoff
.
Timer
++
;
if
(
RSCAN0Busoff
.
Timer
>=
RSCAN0_BUS_OFF_LV1_RECOVERY_TIME
/
deltaTime
)
if
(
RSCAN0Busoff
.
Timer
>=
RSCAN0_BUS_OFF_LV1_RECOVERY_TIME
/
deltaTime
)
/**/
{
{
RSCAN0Busoff
.
Timer
=
0U
;
RSCAN0Busoff
.
Timer
=
0U
;
RSCAN0Busoff
.
Cnt
++
;
RSCAN0Busoff
.
Cnt
++
;
if
(
RSCAN0Busoff
.
Cnt
>=
10U
)
if
(
RSCAN0Busoff
.
Cnt
>=
10U
)
/**/
{
{
RSCAN0Busoff
.
Cnt
=
0U
;
RSCAN0Busoff
.
Cnt
=
0U
;
RSCAN0Busoff
.
Status
=
RSCAN0_BUS_OFF_LV2
;
RSCAN0Busoff
.
Status
=
RSCAN0_BUS_OFF_LV2
;
}
}
//需调用CAN中止函数,中止所有硬件buf内要发送的数据
CAN_TX_Count_Init
();
Can_QuickTimer_Init
();
reset_busoff
(
CAN_CH_0
);
reset_busoff
(
CAN_CH_0
);
}
}
}
}
...
@@ -281,9 +289,12 @@ void Can_BusOff_Recover(uint8_t deltaTime)
...
@@ -281,9 +289,12 @@ void Can_BusOff_Recover(uint8_t deltaTime)
{
{
RSCAN0Busoff
.
Timer
++
;
RSCAN0Busoff
.
Timer
++
;
if
(
RSCAN0Busoff
.
Timer
>=
RSCAN0_BUS_OFF_LV2_RECOVERY_TIME
/
deltaTime
)
if
(
RSCAN0Busoff
.
Timer
>=
RSCAN0_BUS_OFF_LV2_RECOVERY_TIME
/
deltaTime
)
/**/
{
{
RSCAN0Busoff
.
Timer
=
0U
;
RSCAN0Busoff
.
Timer
=
0U
;
//需调用CAN中止函数,中止所有硬件buf内要发送的数据
CAN_TX_Count_Init
();
Can_QuickTimer_Init
();
reset_busoff
(
CAN_CH_0
);
reset_busoff
(
CAN_CH_0
);
}
}
}
}
...
@@ -293,7 +304,15 @@ void Can_BusOff_Recover(uint8_t deltaTime)
...
@@ -293,7 +304,15 @@ void Can_BusOff_Recover(uint8_t deltaTime)
}
}
else
/* 总线正常,没有Bus-off发生*/
else
/* 总线正常,没有Bus-off发生*/
{
{
RSCAN0Busoff
.
RecoverTimer
++
;
if
(
RSCAN0Busoff
.
RecoverTimer
>=
4
)
{
RSCAN0Busoff
.
RecoverTimer
=
0
;
RSCAN0Busoff
.
Status
=
RSCAN0_BUS_STABLE
;
RSCAN0Busoff
.
Timer
=
0
;
RSCAN0Busoff
.
Cnt
=
0
;
}
}
}
}
}
...
@@ -310,12 +329,12 @@ uint8_t Get_Busoff_Status(void)
...
@@ -310,12 +329,12 @@ uint8_t Get_Busoff_Status(void)
extern
uint8_t
Can_341_Flg
;
extern
uint8_t
Can_341_Flg
;
uint8_t
COM_APP_Process
(
st_CAN_Msg
*
Msg
)
uint8_t
COM_APP_Process
(
st_CAN_Msg
*
Msg
)
{
{
// Can_Write((st_CAN_Msg *)Msg);
// Can_Write((st_CAN_Msg *)Msg);
// return 0;
// return 0;
// }
// }
// void Can_Write(st_CAN_Msg *Msg)
// void Can_Write(st_CAN_Msg *Msg)
// {
// {
uint32_t
i
=
0
;
uint32_t
i
=
0
;
CanTxRxMsg
CAN_SendMsg
;
CanTxRxMsg
CAN_SendMsg
;
uint8_t
CAN_result
=
0
;
uint8_t
CAN_result
=
0
;
...
@@ -341,7 +360,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
...
@@ -341,7 +360,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
break
;
break
;
case
0x450
:
case
0x450
:
//
if(Can_341_Flg == 1 || Common_GetIgnOnTime() > 2000)
//
if(Can_341_Flg == 1 || Common_GetIgnOnTime() > 2000)
{
{
CAN_result
=
CAN_Transmit
(
CAN0MSG13
,
&
CAN_SendMsg
);
CAN_result
=
CAN_Transmit
(
CAN0MSG13
,
&
CAN_SendMsg
);
}
}
...
@@ -349,7 +368,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
...
@@ -349,7 +368,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
break
;
break
;
case
0x220
:
case
0x220
:
CAN_result
=
CAN_Transmit
(
CAN0MSG10
,
&
CAN_SendMsg
);
CAN_result
=
CAN_Transmit
(
CAN0MSG10
,
&
CAN_SendMsg
);
if
(
AliveCountTimer
<
7
)
if
(
AliveCountTimer
<
7
)
{
{
AliveCountTimer
++
;
AliveCountTimer
++
;
}
}
...
@@ -360,7 +379,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
...
@@ -360,7 +379,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
break
;
break
;
#if (IC_Current == TY200_080000b_ty)
#if (IC_Current == TY200_080000b_ty)
case
0x580
:
case
0x580
:
if
(
Get_Tpms_TX_Flag
()
!=
0
)
if
(
Get_Tpms_TX_Flag
()
!=
0
)
{
{
CAN_result
=
CAN_Transmit
(
CAN0MSG14
,
&
CAN_SendMsg
);
CAN_result
=
CAN_Transmit
(
CAN0MSG14
,
&
CAN_SendMsg
);
}
}
...
...
Firmware/Source/Application/CAN_User/Can_User.h
View file @
beb5f293
...
@@ -27,7 +27,7 @@ typedef struct
...
@@ -27,7 +27,7 @@ typedef struct
uint8_t
Status
;
uint8_t
Status
;
uint8_t
Timer
;
uint8_t
Timer
;
uint8_t
Cnt
;
uint8_t
Cnt
;
uint8_t
ReportDTCCnt
;
uint8_t
RecoverTimer
;
}
RSCAN0BusoffMonitorStruct
;
}
RSCAN0BusoffMonitorStruct
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment