cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 CAN HAL library - TX and RX

apavone9
Associate II
Posted on April 26, 2016 at 12:25

Hi,

I am using the STM32F429ZI CAN peripheral in polling TX and interrupt RX with HAL library V1.4.4 of 22-January-2016. This the procedure that I use:

  • During CAN init, I call the HAL_CAN_Receive_IT to enable the first receive interrupt;
  • At the end of my HAL_CAN_RxCpltCallback implementation, I call the HAL_CAN_Receive_IT to enable the next receive interrupt;
  • Every 100ms in the main I call a HAL_CAN_Transmit.

Here my problem: sometimes the receive interrupt occours during HAL_CAN_Transmit execution where CAN peripheral is locked (__HAL_LOCK(hcan);). In this case the receive interrupt return a BUSY without end the receive procedure and without call the HAL_CAN_RxCpltCallback, so I can not receive other message!

Do you have some suggestion to solve this problem??

Inside HAL_CAN_Receive_IT I tried to comment the line __HAL_LOCK(hcan); e

 __HAL_UNLOCK(hcan); and all is ok. This solution in my opinion is not good.

Thank you very much.

Alex

#stm32f4-can-tx-rx
5 REPLIES 5
slimen
Senior
Posted on April 26, 2016 at 14:03

Hi,

I recommend you to use the last release of STM32F4, as this issue is already fixed in the version STM32Cube_FW_F4_V1.11.0

Regards
apavone9
Associate II
Posted on April 26, 2016 at 14:33

Yes, the version that I currently use is STM32Cube_FW_F4_V1.11.0 (inside the code file I see V1.4.4 of 22-January-2016), but I see the problem.

Thanl you for your answer, any more suggestion???

slimen
Senior
Posted on April 26, 2016 at 14:42

Hi,

Yes, it seem this bug is not fixed.

Regards
Walid FTITI_O
Senior II
Posted on April 26, 2016 at 15:49

Hi

pavone.alessandro,

A new specification for the LOCK and UNLOCK process is ongoing.

But by waiting the new version, we propose to remove Lock from HAL_CAN_Transmit() or use the HAL_CAN_Transmit_It() as workaround.

Sorry for the inconvenience.

-Hannibal-

apavone9
Associate II
Posted on April 27, 2016 at 08:09

Thank you very much for fast feedback. I will follow your suggestion and I am waiting for new HAL FW release.

Bye.