对应的函数配置如下:
void can1HighLevelInterrupt(void)
{
uint32 value = canREG1->INT;
uint32 ES_value;
/* USER CODE BEGIN (41) */
/* USER CODE END */
if (value == 0x8000U)
{
/* Read Error and Status Register*/
ES_value = canREG1->ES;
/* Check for Error (PES, Boff, EWarn & EPass) captured */
if((ES_value & 0x1E0U) != 0U)
{
canErrorNotification(canREG1, ES_value & 0x1E0U);
}
else
{ /* Call General Can notification incase of RxOK, TxOK, PDA, WakeupPnd Interrupt */
canStatusChangeNotification(canREG1, ES_value & 0x618U);
}
}
else
{
/** – Setup IF1 for clear pending interrupt flag */
/*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found – Hardware Status check for execution sequence" */
while ((canREG1->IF1STAT & 0x80U) ==0x80U)
{ } /* Wait */
canREG1->IF1CMD = 0x08U;
/*SAFETYMCUSW 93 S MR: 6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "LDRA Tool issue" */
canREG1->IF1NO = (uint8) value;
/*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found – Hardware Status check for execution sequence" */
while ((canREG1->IF1STAT & 0x80U) ==0x80U)
{ } /* Wait */
canREG1->IF1CMD = 0x87U;
canMessageNotification(canREG1, value);
}
/* USER CODE BEGIN (42) */
/* USER CODE END */
}
void canStatusChangeNotification(canBASE_t *node, uint32 notification){
/* enter user code between the USER CODE BEGIN and USER CODE END. */
/* USER CODE BEGIN (14) */
if(node==canREG1 && notification==canLEVEL_RxOK)
{
CAN0_RX_ISR();
}
else if(node==canREG1 && notification==canLEVEL_TxOK )
{
CAN0_TX_ISR();
}
else if(node==canREG2 && notification==canLEVEL_RxOK)
{
CAN2_RX_ISR();
}
else if(node==canREG2 && notification==canLEVEL_TxOK )
{
CAN2_TX_ISR();
}
else if(node==canREG3 && notification==canLEVEL_RxOK)
{
CAN1_RX_ISR();
}
else if(node==canREG3 && notification==canLEVEL_TxOK )
{
CAN1_TX_ISR();
}
/* USER CODE END */
}
代码运行过程中,发现运行到 if(node==canREG1 && notification==canLEVEL_RxOK)这里时无法进入,查明发现 notification==canLEVEL_RxOK这个条件不满足,notification一直都等于0。请问是什么原因。
gaoyang9992006:
消息1配置和消息2配置是否正确?先查看图形化配置是否正确。
huan duan:
回复 gaoyang9992006:
设想是任何一个messagebox接收所有的报文信息,不屏蔽,该如何配置HALCoGen,另外,在这种情况下,如何获取接收到的任何一帧的ID,谢谢!