/*---------------------------------------------------------------------------------------------------------*/
/* CAN0 interrupt handler */
/*---------------------------------------------------------------------------------------------------------*/
void CAN0_IRQHandler(void)
{
uint32_t u8IIDRstatus;
u8IIDRstatus = CAN0->IIDR;
if(u8IIDRstatus == 0x00008000) /* Check Status Interrupt Flag (Error status Int and Status change Int) */
{
/**************************/
/* Status Change interrupt*/
/**************************/
if(CAN0->STATUS & CAN_STATUS_RXOK_Msk)
{
CAN0->STATUS &= ~CAN_STATUS_RXOK_Msk; /* Clear RxOK status*/
}
if(CAN0->STATUS & CAN_STATUS_TXOK_Msk)
{
CAN0->STATUS &= ~CAN_STATUS_TXOK_Msk; /* Clear TxOK status*/
}
/**************************/
/* Error Status interrupt */
/**************************/
if(CAN0->STATUS & CAN_STATUS_BOFF_Msk)
{
printf("BOFF INT\n") ;
}
if(CAN0->STATUS & CAN_STATUS_EWARN_Msk)
{
printf("EWARN INT\n") ;
}
}
else if((u8IIDRstatus >= 0x1) || (u8IIDRstatus <= 0x20))
{
CAN_MsgInterrupt(CAN0, u8IIDRstatus);
CAN_CLR_INT_PENDING_BIT(CAN0, (u8IIDRstatus - 1)); /* Clear Interrupt Pending */
}
else if(CAN0->WU_STATUS == 1)
{
printf("Wake up\n");
CAN0->WU_STATUS = 0; /* Write '0' to clear */
}
}
我用CAN0接收数据再去处理,每次工作3个小时左右就出现问题,在线调试发现在CAN0接受中断函数这里,中断只进入状态中断 if(u8IIDRstatus == 0x00008000) ,而不进入报文对象中断else if((u8IIDRstatus >= 0x1) || (u8IIDRstatus <= 0x20)),请问各位大侠,这是什么原因? |