2016-10-14 02:19 AM
References :
STM32CudeMX 4.16.0 STM32Cube_FW_F1_V1.4.0 STM32F103CBT6 The project uses FREERTOS. Hi All, Once CAN is configured and filters are set, I call HAL_CAN_Receive_IT : OK On receiving a CAN frame, HAL_CAN_RxCpltCallback is called : OK In HAL_CAN_RxCpltCallback, a signal is sent to a thread to handle the frame. The thread receiving the signal, reads the frame an then calls HAL_CAN_Receive_IT for next frames : OK At some time, the application calls HAL_CAN_Transmit_IT to send a frame : OKWhen the frame is sent, HAL_CAN_TxCpltCallback is then called :
multiple times...
It is not only called when the frame is sent, it is also called when a frame is received, because in stm32f1xx_hal_can.c, the function HAL_CAN_Receive_IT enables ''Transmit mailbox empty Interrupt'' ( CAN_IT_TME ). I think it should not ! All CAN IRQ Handlers generated by STM32CudeMX calls the same function HAL_CAN_IRQHandler in stm32f1xx_hal_can.c. CAN_Transmit_IT is called because CAN_IT_TME has been enabled and the status of CAN_TXMAILBOX_* haven't changed. Removing ''CAN_IT_TME'' in HAL_CAN_Receive_IT solved the problem for me. Best regards, Fr�d�ric. #can-stm32f1-stm32cubemx2016-10-25 02:18 AM
Hi,
No one has an idea about this problem ? Am I right or do I missed something ? Regards, Frédéric.2016-10-31 01:48 AM
Hi,
I looked into hal driver for STM32F4 ( Firmware 1.13.0 ). In this firmware, the HAL_CAN_Receive_IT function does not ''Enable Transmit mailbox empty Interrupt''. Regards, Frédéric.2018-07-11 07:40 AM
Hello
Surleau.Fr_d_ric
,For STM32F4, the HAL CAN driver is reworked to bypass limitations on CAN present with previous HAL CAN driver versions.
So, It is recommended to use the new HAL CAN driver, which is located as usual in Driver/STM32F4xx_HAL_Driver/Src and Driver/STM32F4xx_HAL_Driver/Inc folders. It can be enabled through switch HAL_CAN_MODULE_ENABLED in stm32f4xx_hal_conf.h file.
For STM32F1, the
HAL CAN driver will be reworked in the coming release.
So, k
eep an eye out for the coming update.With Regards,
Imen