2024-06-20 04:14 AM
Hello,
I am running the code as shown in the attached file and I get two different behaviours on to identical stm32h735g-dk boards. One of the boards will send exactly 37 can messages when the button for master is clicked and the other board will send a infinite amount of messages. What could be the issue?
Any help is welcome!
Kind regards,
Björn Lindholm
Solved! Go to Solution.
2024-06-20 06:12 AM - edited 2024-06-21 01:37 AM
Hello,
Not sure I understood well your issue. Each board having the same firmware but behave differently?
Also you are using an RTOS and this complicates the analysis. May be you need to test without RTOS.
Meanwhile, I have one comment regarding the bitrate config and mainly regarding these parameters:
hfdcan1.Init.NominalPrescaler = 256;
hfdcan1.Init.NominalTimeSeg1 = 2;
hfdcan1.Init.NominalTimeSeg2 = 2;
To me these are bad parameters and need to be changed:
TSEG1 and TSEG2 need to be increased as much as possible and decrease the prescaler as much as possible to fit your CAN bitrate where the sample point is at (70% to 80%) of the bit time. TSEG1 =~ (70% to 80%) (TSEG1+TSEG2 )
2024-06-20 06:12 AM - edited 2024-06-21 01:37 AM
Hello,
Not sure I understood well your issue. Each board having the same firmware but behave differently?
Also you are using an RTOS and this complicates the analysis. May be you need to test without RTOS.
Meanwhile, I have one comment regarding the bitrate config and mainly regarding these parameters:
hfdcan1.Init.NominalPrescaler = 256;
hfdcan1.Init.NominalTimeSeg1 = 2;
hfdcan1.Init.NominalTimeSeg2 = 2;
To me these are bad parameters and need to be changed:
TSEG1 and TSEG2 need to be increased as much as possible and decrease the prescaler as much as possible to fit your CAN bitrate where the sample point is at (70% to 80%) of the bit time. TSEG1 =~ (70% to 80%) (TSEG1+TSEG2 )
2024-06-23 11:03 PM - edited 2024-06-23 11:09 PM
So the sample point must be above 70% for the can bus to behave "normally"? I am not too familiar with the can protocol so an explanation would be helpful :). Yes we are using the same firmware on two of the same model board and they are acting differently from one another.
Björn
2024-06-24 03:17 AM
Hello,
@BjornLindholm wrote:
So the sample point must be above 70% for the can bus to behave "normally"? I am not too familiar with the can protocol so an explanation would be helpful :).
I suggest you to look at this link: http://www.bittiming.can-wiki.info/ for CAN sample point calculation sheet.
And also the following docs:
1- For classical CAN: http://www.oertel-halle.de/files/cia99paper.pdf
2- For CANFD: http://www.oertel-halle.de/files/icc14_2013_paper_Hartwich.pdf