Commit 6e02ccb3 authored by 李延凯's avatar 李延凯

fix: 调通诊断CAN收发

1、诊断报文RX BUFFER使用 CAN0MSG08和CAN0MSG09
2、诊断报文TX BUFFER使用 CAN0MSG00
3、将CGC_PLL_CFG_AS_FCLK放到SRAM中执行, 横展润通偶尔无法启动的问题
parent 8b9d70c2
......@@ -361,7 +361,7 @@
</VariousControls>
</Aads>
<LDads>
<umfTarg>1</umfTarg>
<umfTarg>0</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
......@@ -370,7 +370,7 @@
<TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile></ScatterFile>
<ScatterFile>.\Objects\HaoJin750TFT.sct</ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
......
......@@ -100,23 +100,23 @@ void Can_RX_Apply_Buff(void)
CAN_MessageCache_OverWriteConfig(CAN0MSG07, ENABLE);
// CAN_RecvMsg.Id = DIAG_ID_Rx_PHY;
// CAN_RecvMsg.IDE = CAN_Id_Standard;
// CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// CAN_RecvMsg.RTR = CAN_RTR_Data;
// CAN_RecvMsg.Interrupt = ENABLE;
// CAN_MessageCache_DeInit(CAN0MSG03);
// CAN_MessageCache_Init(CAN0MSG03, &CAN_RecvMsg);
// CAN_MessageCache_OverWriteConfig(CAN0MSG03, ENABLE);
// CAN_RecvMsg.Id = DIAG_ID_Rx_FUN;
// CAN_RecvMsg.IDE = CAN_Id_Standard;
// CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// CAN_RecvMsg.RTR = CAN_RTR_Data;
// CAN_RecvMsg.Interrupt = ENABLE;
// CAN_MessageCache_DeInit(CAN0MSG04);
// CAN_MessageCache_Init(CAN0MSG04, &CAN_RecvMsg);
// CAN_MessageCache_OverWriteConfig(CAN0MSG04, ENABLE);
CAN_RecvMsg.Id = DIAG_ID_Rx_PHY;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
CAN_RecvMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = ENABLE;
CAN_MessageCache_DeInit(CAN0MSG08);
CAN_MessageCache_Init(CAN0MSG08, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG08, ENABLE);
CAN_RecvMsg.Id = DIAG_ID_Rx_FUN;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
CAN_RecvMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = ENABLE;
CAN_MessageCache_DeInit(CAN0MSG09);
CAN_MessageCache_Init(CAN0MSG09, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG09, ENABLE);
}
/**
......@@ -126,7 +126,7 @@ void Can_RX_Apply_Buff(void)
void Can_Tx_Apply_Buff(void)
{
// CanTxRxMsg CAN_SendMsg;
// CanTxRxMsg CAN_SendMsg_Diag_Tx;
CanTxRxMsg CAN_SendMsg_Diag_Tx;
// CAN_SendMsg.Id = 0x500;
// CAN_SendMsg.IDE = CAN_Id_Standard;
// CAN_SendMsg.CacheType = CAN_CacheType_Tx;
......@@ -141,20 +141,19 @@ void Can_Tx_Apply_Buff(void)
// CAN_MessageCache_DeInit(CAN0MSG08);
// CAN_MessageCache_Init(CAN0MSG08, &CAN_SendMsg);
// CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx;
// CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard;
// CAN_SendMsg_Diag_Tx.CacheType = CAN_CacheType_Tx;
// CAN_SendMsg_Diag_Tx.RTR = CAN_RTR_Data;
// CAN_SendMsg_Diag_Tx.Interrupt = DISABLE;
// CAN_SendMsg_Diag_Tx.DLC = 8;
// for (uint8_t i = 0; i < CAN_SendMsg_Diag_Tx.DLC; i++)
// {
// CAN_SendMsg_Diag_Tx.Data[i] = 0;
// }
CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx;
CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard;
CAN_SendMsg_Diag_Tx.CacheType = CAN_CacheType_Tx;
CAN_SendMsg_Diag_Tx.RTR = CAN_RTR_Data;
CAN_SendMsg_Diag_Tx.Interrupt = DISABLE;
CAN_SendMsg_Diag_Tx.DLC = 8;
for (uint8_t i = 0; i < CAN_SendMsg_Diag_Tx.DLC; i++)
{
CAN_SendMsg_Diag_Tx.Data[i] = 0;
}
// CAN_MessageCache_DeInit(CAN0MSG09);
// CAN_MessageCache_Init(CAN0MSG09, &CAN_SendMsg_Diag_Tx);
CAN_MessageCache_DeInit(CAN0MSG00);
CAN_MessageCache_Init(CAN0MSG00, &CAN_SendMsg_Diag_Tx);
}
/**
* @brief 用于接收回调函数
......
......@@ -465,7 +465,7 @@ void CGC_PLL_Setting(PLL_Src_t src, PLL_Div_t div, PLL_Mul_t mul)
* @note
* @retval None
*/
void CGC_PLL_CFG_AS_FCLK(void)
__attribute__((section("RW_FUNC_PLL"))) void CGC_PLL_CFG_AS_FCLK(void)
{
CGC->MCKC = 0x01;
while((CGC->MCKC & CGC_MCKC_CKSTR_Msk) == 0);
......
......@@ -216,36 +216,37 @@ void DoCAN_N_USData_Indication(uint16_t N_TAtype, uint8_t *MessageData, uint16_t
返回值:无
******************************************************************************/
void DoCAN_L_Data_Request(uint16_t Identifier, uint8_t dlc, uint8_t *Data)
{
uint8_t i;
CanTxRxMsg msg_diag_tx;
LinkTxCtrl.Identifier = Identifier;
for ( i = 0; i < dlc; i++ )
for (i = 0; i < dlc; i++)
{
LinkTxCtrl.Data[i] = *Data;
Data++;
}
for ( i = dlc; i < 8; i++ )
for (i = dlc; i < 8; i++)
{
LinkTxCtrl.Data[i] = FILLER_BYTE;
}
msg_diag_tx.Id = LinkTxCtrl.Identifier;
msg_diag_tx.DLC = 8;
msg_diag_tx.RTR = 0;
msg_diag_tx.IDE = 0;
msg_diag_tx.CacheType = CAN_CacheType_Tx;
for(i =0;i<8;i++)
{
msg_diag_tx.Data[i] = LinkTxCtrl.Data[i] ;
}
msg_diag_tx.Id = LinkTxCtrl.Identifier;
msg_diag_tx.DLC = 8;
msg_diag_tx.RTR = 0;
msg_diag_tx.IDE = 0;
msg_diag_tx.CacheType = CAN_CacheType_Tx;
for (i = 0; i < 8; i++)
{
msg_diag_tx.Data[i] = LinkTxCtrl.Data[i];
}
CAN_Transmit(CAN0MSG09, &msg_diag_tx);
// Can_Write(&msg);
//CANFD_Ch1_L_Data_Request(LinkTxCtrl.Identifier,8,LinkTxCtrl.Data);
LinkTxCtrl.Busy = 1;
CAN_Transmit(CAN0MSG00, &msg_diag_tx);
// Can_Write(&msg);
// CANFD_Ch1_L_Data_Request(LinkTxCtrl.Identifier,8,LinkTxCtrl.Data);
LinkTxCtrl.Busy = 1;
}
/******************************************************************************
......
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