AnsweredAssumed Answered

STM32Cube CAN Driver locks up with bus errors

Question asked by we.jesper on Jun 1, 2015
Latest reply on Jun 3, 2015 by thysell.daniel
I am using a STM32F072, code generated by CubeMx 4.7.1 with F/W 1.2.1

My CAN code looks exactly like the Example code in ...\STM32Cube_FW_F0_V1.2.0\Projects\STM32072B_EVAL\Examples\CAN

My device is connected to a very long CAN-bus which does have some signal integrity issues due to the length of cabling. But the driver should be able to handle this and recover from errors, I would hope. But it does not.

When there is an error on the bus CEC_CAN_IRQHandler() > HAL_CAN_IRQHandler() gets called, but the latter fails to clear the ERRI interrupt properly, resulting in the device looping in calling these two routines, and thus locking up.

I have solved this temporarily by not letting HAL_CAN_Receive_IT() enable the ERRI interrupt, which at least stops the device from locking up and allows it to continue operating.

But I don't think it is meant to work this way ;-)