Skip to main content
alex.shirley
Associate II
Nov 15, 2018 2:10 PM UTC
Question

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

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.

This topic has been closed for replies.

4 replies

ST Technical Moderator
Nov 15, 2018 2:42 PM UTC

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
alex.shirley
Associate II
Nov 15, 2018 3:10 PM UTC
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
Nov 16, 2018 9:15 AM UTC

@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?

ST Technical Moderator
Nov 19, 2018 10:17 AM UTC

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks