cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f1xx and can problem + bug on CUBEMX library

Marco1
Associate II
Posted on November 24, 2016 at 12:52

Hi, 

i have a little problem on Can program.

If you call HAL_CAN_Init and after HAL_CAN_Deinit, when you call again HAL_CAN_Init, the function ''HAL_CAN_Init'' return always Timeout on CAN1.

Its a bug ?

And i found this bug on file 

  * @file    stm32f1xx_hal_can.c

  * @author  MCD Application Team

  * @version V1.0.4

  * @date    29-April-2016

on function HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan)

if you enter in this function, and you have CAN_TXSTATUS_NOMAILBOX, 

when you exit from, you will have the state of your can LOCKED.

Is missing the part with else{ unlock// return error// and other }

Sorry for my english

2 REPLIES 2
Walid FTITI_O
Senior II
Posted on November 29, 2016 at 17:36

Hi macro,

I think It's related to a lock/unlock mechanism issue in the Cube library like this

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4%20CAN%20HAL%20library%20-%20TX%20and%20RX&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&curre...

. This process is under review and a rework will be implemented. Meanwhile,the best approach would be simply removing the call to the lock and unlock in these two drivers as no critical section lock is really required for these drivers.

-Hannibal-

Marco1
Associate II
Posted on November 29, 2016 at 18:12

Ok,

for lock i have already correct the parts and now work all, but about Init, Deinit and Init ? Where is the problem ?

I not find the error....