Question
STM32F407 Enable Can Error Irq
Posted on October 16, 2015 at 17:19
Hello,
I would like to enable the CAN error Irq and in particular the LEC so in my init function I did CAN_ITConfig( CAN2, CAN_IT_TME | CAN_IT_FMP0 | CAN_IT_FOV0 | CAN_IT_FF0 | CAN_IT_LEC | CAN_IT_ERR, ENABLE ); and then in the irq I did like that void CAN2_StatusChangeError_IRQHandler( void ) { if (CAN_GetITStatus( CAN2, CAN_IT_LEC ) == SET ) { HALCAN_ERROR_2ND_CAN(CAN_GetLastErrorCode(CAN2)); CAN_ClearITPendingBit( CAN2, CAN_IT_LEC ); } } In normal working everything goes fine but if I remove the cable I continously go in the irq: I would like to go inside only once. Is there something I'm missing? I configured it to automatically exit from bus off .. I don't know if that is the problem. thank michele #can-stm32f407