Skip to main content
marcinterka
Visitor II
October 10, 2015
Question

stm32f4 Help with CAN_ErrorCallback

  • October 10, 2015
  • 1 reply
  • 772 views
Posted on October 10, 2015 at 20:29

Hello.

I have some problem and I can't do anything with it. So, I have CAN bus with two CAN. uP is stm32f407. When is normal work i send data by HAL_CAN_Transmit(&hcan2,5), and  HAL_CAN_Transmit(&hcan1,5). I received them by HAL_CAN_ErrorCallback(CAN_HandleTypeDef* hcan). It  is good until it  not have any error. 

When error occurs then is invoking the errorcallback. Before that is invoked one of the function voidCAN1_SCE_IRQHandler(void)  or void CAN2_SCE_IRQHandler(void). When one time occurs error, then every next time is invoked CAN_SCE_IRQ ,although dont have any error (don't have any errorcode, and every  value REC, TEC and LEC is 0). Who tell me why? I add that, before occurs the first errorcallback, function CAN_SCE is never invoked.

It cause that the main program is stopped, because it's all the time invoked one of the function CAN2_SCE_IRQHandler(void), CAN1_SCE_IRQHandler(void). What i can do?

When i cleared ERRIE, then the CAN2_SCE_IRQHandler is not invoked. So it is something with ESR register. But it is equal to 0.

    This topic has been closed for replies.

    1 reply

    Amel NASRI
    ST Technical Moderator
    November 2, 2015
    Posted on November 02, 2015 at 11:08

    Hi Sorix,

    As you have already mentioned it, the problem root cause is a missing clear of ERRI flag in MSR register.

    This bug will be fixed in coming versions of STM32Cube packages.

    -Mayla-

    To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.