cancel
Showing results for 
Search instead for 
Did you mean: 

How can I include HAL Legacy Can drivers instead of the updated HAL CAN Driver

alex.shirley
Associate II

I inherited a Keil Project which used the HAL Legacy CAN driver, and so I'm trying to port this system to SW4STM32, however, when I generate/regenerate a new project with the STM32Cube Generator, the CAN driver is replaced.

Normally this wouldn't be an issue, except we heavily use the CAN structures, which no longer exist, so it would be quite an impediment to need to upgrade the CAN driver just to move out of the Keil Ecosystem. Are there any suggestions or work arounds so that I can continue using the Legacy CAN driver with STM32Cube.

4 REPLIES 4
Imen.D
ST Employee

Hello @alex.shirley​ ,

The legacy HAL CAN driver is present in the release in Drivers/STM32XXxx_HAL_Driver/Src/Legacy and Drivers/STM32XXxx_HAL_Driver/Inc/Legacy folders for software compatibility reasons. 

Its usage is not recommended as deprecated. It can however be enabled through switch HAL_CAN_LEGACY_MODULE_ENABLED in stm32XXxx_hal_conf.h

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
alex.shirley
Associate II
I understand that the legacy CAN driver is deprecated, but to minimally compile with little refactoring using the legacy driver is preferred.
In the stm32F4xx_hal_conf.h that's generated by CubeMX, there is no switch for using legacy drivers. I tried to add the include to the system, but when the program was later regenerated, the defines disappeared.
alex.shirley
Associate II

@Imen DAHMEN​  Alternatively, is there an older version of CubeMX and stm32_fw_f4 that uses the older CAN driver? Where can I find the change log with regards to the CAN driver, so I know which version of generator software to use?

Imen.D
ST Employee

Hello @alex.shirley​ ,

You can find older versions of STM32CubeMX in this discussion:

https://community.st.com/s/question/0D50X00009XkYVDSA3/please-provide-a-way-to-download-older-version-of-the-cube

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen