2019-10-10 01:37 AM
I wanted to use the CAN Legacy Driver like i did it in my old STM32F103 Project (Same Cube Version. latest Firmware) but i failed.
I copied the Legacy CAN-Module to the Driver Source-Path, the Legacy Include's were already included.
But what should i do now? In the old Project i only enabled the Legacy Driver in the HAL_conf.h, but this Fails with the STM32F042.
What is the way to enable it here, or is there anywhere a good example how to ust Interrupt Receive with the new Driver??
Solved! Go to Solution.
2019-10-12 11:45 PM
Thank you for your Help!
This is exactly what i did to get it working but i failed.
Meanwhile i changed to the new Structure because there were too many detail changes to make Legacy work, rewriting was really the better Solution.
2019-10-11 07:55 AM
Hello @christophkeiner9 ,
The Legacy HAL CAN driver is present in the package release in Driver/STM32F0xx_HAL_Driver/Src/Legacy and Driver/STM32F0xx_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 stm32f0xx_hal_conf.h file.
Also, check that CAN initialization and configuration are properly done.
Regards,
Imen
2019-10-12 11:45 PM
Thank you for your Help!
This is exactly what i did to get it working but i failed.
Meanwhile i changed to the new Structure because there were too many detail changes to make Legacy work, rewriting was really the better Solution.
2020-01-31 07:08 AM
I have the same issu for a F2. In the MCU Package Version 1.8.0 for the STM32F2 it is mentioned, that the old CAN driver is still available. But as you can see in the image, there is no one. And a definition of "HAL_CAN_LEGACY_MODULE_ENABLED" leads to an "Unresolve inclusion error". Is there a workaround? Our customer is running tests for 2 months with the olc CAN API and it is crucial not to repeat these tests with a new CAN API.
2020-02-03 03:16 AM
Yes, i know, there are a lot of little things to do to get it run, therefore i would not rely on a new software with so many little manual changes.
I would turn back to the older Cube-Version or use the new CAN Driver and do the testing again.
2020-02-03 04:01 AM
I have a working project on github based off a CANable adapter that uses the STM32F042. I've also made a YouTube tutorial on how to start a STM32CubeIDE project.
https://github.com/karlyamashita/CANable_USB_CAN
https://www.youtube.com/watch?v=oe5JmYYAZy0&t=5s
2020-02-03 07:20 AM
Thank you Karl, very nice Project. Do you use a crystal for clocking on the PCB, i didn't see it?
2020-02-03 07:33 AM
The whole uC is running with the internal RC at 48mHz. Surprisingly the USB communication works just as well as the CAN controller.
2020-02-10 01:07 AM
Hi Karl, yes i see, the oscillator is synchronized to USB Data Stream, therefore it is sufficient accurate also for higher CAN Datarates. I never used the USB-Device but it's an nice feature.
2020-03-20 11:52 AM
I'm considering the STM32F042 for a new design with a PCB size constraint, I have always used an external crystal when using CAN.
Is it possible to use this devices internal oscillator ? Anyone had any experience. Max bit rate 125kbs
Thanks