2021-11-13 01:44 PM
Hello,
regarding the STM32G474 I have some questions regarding the CAN Controller:
1) The CAN-Controller has an input called “fdcan_clk�?, is this connected to APB1-peripheral-clocks?
2) How does the CCU work to generate the fdcan_tq_ck, how should it be set up?
I found very little information about it, what would be a recommendation for a 500kBit/s CAN2.0B setup.
I assume the calibration-feature is most likely be used in the CAN-FD Mode, I may use that in the future. If someone has more details how set up, I would really be interested as well.
Many thanks for helping in advance.
Best Regards, Seppel
P.S. I also found different diagrams( RM0440 Rev 6 vs. AN5348 - Rev 1), not sure why that is the case. I also did not find where the registers are described in detail.
2021-11-15 12:43 AM
It's recommended to get the sample point between 75% and 87.5% so TSEG1 must be longer than TSEG2.
I mostly use an external tool to calculate the best configuration. For example: http://www.bittiming.can-wiki.info/
So the nominal prescaler can be set to 20, with nominal TSEG1 to 13 and nominal TSEG2 to 2.
The data prescaler and TSEG's are not used when you only want to use CAN2.0 frames.
Another good tool is https://play.google.com/store/apps/details?id=com.peaksystem.BitRateCalculator&hl=en&gl=US but you will have to set the clock source to PLLQ for example and make sure it's output is 80MHz.
2021-11-15 01:16 AM
Hello,
in the meantime I found an example from ST: https://github.com/STMicroelectronics/STM32CubeG4/blob/master/Projects/STM32G474E-EVAL/Examples/FDCAN/FDCAN_Classic_Frame_Networking/Src/main.c
I'll give it a try and keep everyone updated.
Thanks a lot, Best Regards, Seppel
2021-11-15 01:26 AM
I use a different chip with a different CANbus peripheral and im using CUBEMX ,but maybe this helps:
For the clock source i go to the ref manual (of my stm32f105xx) and find out which peripheral bus is my canbus atacched to (APB1)
In cubemx, i setup the clock of the APB1 to the speed i want (max possible)
Inside CANBUS parameter settings i modify Time quantas to match the sample points i want (@Nick van IJzendoorn explained this)
CubeMX helps me by calculating the time quanta and total canbus speed i would get with the current parameters.
2022-03-19 12:31 PM