Commit 0f5b4501 authored by 时昊's avatar 时昊

Merge branch 'lijianshuang' into 'dev'

🐞 fix:50220 ,将can外发放入中断中执行,解决【天鹰TY200】【外发】总线负载量83%,外发周期不稳定

See merge request !51
parents 9d6df02e d27dde4f
......@@ -9,9 +9,9 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] =
{
{0x220ul, 50ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_220, (void *)0},
{0x6EEul, 100ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EE, (void *)0},
{0x6EFul, 100ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EF, (void *)0},
{0x450ul, 100ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450, (void *)0},
{0x6EEul, 100ul * 1000ul, 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},
{0x450ul, 100ul * 1000ul, 10ul * 1000ul, 0u, MSG_STD, 4u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450, (void *)0},
#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},
#endif
......
......@@ -310,14 +310,15 @@ uint8_t Get_Busoff_Status(void)
uint8_t COM_APP_Process(st_CAN_Msg *Msg)
{
Can_Write((st_CAN_Msg *)Msg);
return 0;
}
// Can_Write((st_CAN_Msg *)Msg);
// return 0;
// }
void Can_Write(st_CAN_Msg *Msg)
{
// void Can_Write(st_CAN_Msg *Msg)
// {
uint32_t i = 0;
CanTxRxMsg CAN_SendMsg;
uint8_t CAN_result = 0;
CAN_SendMsg.Id = Msg->MsgID; /* ID */
CAN_SendMsg.DLC = Msg->MsgDLC; /* Len */
......@@ -333,23 +334,24 @@ void Can_Write(st_CAN_Msg *Msg)
switch (CAN_SendMsg.Id)
{
case 0x6EE:
CAN_Transmit(CAN0MSG08, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG08, &CAN_SendMsg);
break;
case 0x6EF:
CAN_Transmit(CAN0MSG12, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG12, &CAN_SendMsg);
break;
case 0x450:
CAN_Transmit(CAN0MSG13, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG13, &CAN_SendMsg);
break;
case 0x220:
CAN_Transmit(CAN0MSG10, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG10, &CAN_SendMsg);
break;
#if (IC_Current == TY200_080000b_ty)
case 0x580:
CAN_Transmit(CAN0MSG14, &CAN_SendMsg);
CAN_result = CAN_Transmit(CAN0MSG14, &CAN_SendMsg);
break;
#endif
default:
break;
}
return (!CAN_result);
}
......@@ -725,7 +725,7 @@ uint8_t CAN_Transmit(CANMSG_Type *CANxMSGy, CanTxRxMsg* TxMessage)
CANxMSGy->CMCTRL = CAN_MCTRL_CLR_RDY;
/* Wait the operate complete */
while (((CANxMSGy->CMCTRL & CAN_MCTRL_RDY_MASK) != 0x00) && (timeout != 0))
//while (((CANxMSGy->CMCTRL & CAN_MCTRL_RDY_MASK) != 0x00) && (timeout != 0))
{
timeout--;
}
......
......@@ -18,7 +18,7 @@ void Sys_Pseudo_Real_Time_Tasks(void)
void Sys_2ms_Tasks(void)
{
Common_Input_Para();
Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
//Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
Sys_Status_Update_Service();
Analog_Signal_Conv_Service();
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,2u);
......@@ -121,6 +121,7 @@ void Sys_100ms_Tasks(void)
void Sys_Exact_50us_Tasks(void)
{
static uint32_t task_1ms = 0u;
Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 50u);
DoCAN_Timer_Update(50u);
GenDelay_Tick();
task_1ms++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment