I am using STM32F072 device and I am using STM library calls for all my CAN routines. But I notice that occasionally, the main interrupt routine HAL_CAN_IRQHandler(&hcan) would not get called.
At the end of my HAL_CAN_RxCpltCallback(), I call
if(HAL_CAN_Receive_IT(CanHandle, CAN_FIFO0) != HAL_OK)
/* Reception Error */
so I think my codes are correct.
So what I do is at the end of my main while() loop, I would call : HAL_CAN_Receive_IT(&L_hcan, CAN_FIFO0)
and so far it seems to have solve my problem.
So I think the possible problem was for whatever reason, the CAN receive IT was disabled somewhere in STM library routine which I am not able to figure it out yet. I have seen similar issue in I2C library where I intentionally overwhelm
the I2C bus, STM library routine would incorrectly disable I2C interrupt. And what I did there is similarly call I2C_IT at
the end of my main while() loop and that solved that problem.
Could anyone know where in the code that CAN would disable the Receive IT?