cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX & STM32G4xx & FDCAN - BUG in CubeMX

MMüll.6
Associate III

Hello,

I use CubeMX V6.13.0 (now the newest version).

I have find out a bug in the configuration wizzard from the FDCAN with the STM32G473.

When I chose:

FDCAN1, Clock Divider = "Divide kernel clock by 10"

FDCAN2, Clock Divider = "Divide kernel clock by 1"

Then start the FDCAN1 and start the FDCAN2, then the FDCAN2 works not with the correct bitrate.

The problem is: CubeMX does not know the µC has only one "Clock Divider".

See RM0440, Rev 8, at 44.4.37 (page 2011):

"Note: The clock divider is common to all FDCAN instances. Only FDCAN1 instance has
FDCAN_CKDIV register, which changes clock divider for all instances."

If I choice for FDCAN1 a other Clock Divider as by 1, the the bitrate calculation for FDCAN2 and FDCAN3 is bad.

 

Please fix this bug in CubeMx,
Thanks a lot.
Best Regads Markus

 

 

5 REPLIES 5
SofLit
ST Employee

Hello,

Do you mean the issue is in the CubeMx GUI so the bitrate value is wrongly shown in FDCAN2/FDCAN3 parameters? 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: Be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.
MMüll.6
Associate III

Yes, but there are 2 issue:

1) I choice in FDCAN1 the Clock Divider as "Divide kernel clock by 10", in this case the parameter "Clock Divider" has automatically change from the FDCAN2 and FDCAN3 to "Clock Divider" to "Divide kernel clock by 10". Currently, the FDCAN2/3 is showing all time "Divide kernel clock by 1"

2) Choice FDCAN1 Clock Divider as "Divide kernel clock by 10", then the bit rate from FDCAN2/3 is wrongly calculated.

3) CubeMX design:

But I think it is better to add a in the left side into "Connectivity" a exta "FDCAN general" section to choice this Clock Divider, that is used for all FDCAN1/2/3 instances.

4) Code generation:

Now the code generation build this code:

static void MX_FDCAN1_Init(void)
{
  hfdcan1.Instance = FDCAN1;
  hfdcan1.Init.ClockDivider = FDCAN_CLOCK_DIV10;
: : :

static void MX_FDCAN2_Init(void)
{
  hfdcan2.Instance = FDCAN2;
  hfdcan2.Init.ClockDivider = FDCAN_CLOCK_DIV1;
: : :
HAL_FDCAN_SetClockDivider(FDCAN_CLOCK_DIV10);

that is also confusing. This looks as if each individual FDCAN has its own ClockDivider.
It is better to delete the "...Init.ClockDivider" and add into the HAL a funktion named like:

HAL_FDCAN_SetClockDivider(FDCAN_CLOCK_DIV10);

 

MMüll.6
Associate III

The format in my last post in the source is not so good, the editor do not that what I wnt have.

Best regads. Markus

Issue escalated internally. Ticket number 200299 (not accessible by community members).


To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: Be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.
SofLit
ST Employee

Solution removed until a final answer is provided.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: Be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.