AnsweredAssumed Answered

Possible STM library bug in CAN interrupt routine

Question asked by vu.andy on Mar 23, 2018
Latest reply on Mar 23, 2018 by vu.andy

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 */
    _Error_Handler(__FILE__, __LINE__);
  }

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?

 

Thanks.

Outcomes