cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 CAN FD configured as classic CAN 2.0

VYoun
Associate III

Hello,

I am working with STM32H7. I need to configure the CAN FD to work as Classic CAN 2.0. I have found an example that configures the CAN FD as Classic CAN 2.0, but in the example the system clock is different from my system clock.

I need to find the method to configure the STM32H7 CAN FD as CAN 2.0. Please help me cause I am not able to find this method anywhere.

Thank you in advance.

Best regards,

Vouria

1 ACCEPTED SOLUTION

Accepted Solutions
Bouraoui Chemli
ST Employee

Hello @VYoun​ 

For a detailed description of the CAN bit timing and resynchronization mechanism, (Prop_Seg, Phase_Seg1, SJW...), refer to the ISO 11898-1 standard.

You can find through STM32CubeFW an example shows how to configure the FDCAN peripheral to send and receive

Classic CAN frames in normal mode : STM32Cube_FW_H7_V1.7.0\Projects\STM32H743I-EVAL\Examples\FDCAN\FDCAN_Classic_Frame_Networking

Best regards,

Bouraoui

View solution in original post

7 REPLIES 7
Bouraoui Chemli
ST Employee

Hello @VYoun​ 

Please refer to STM32CubeMX; In Pinout & Configuration you can select the mode and the configuration of FDCAN under Conectivity. In Clock Configuration you can select the input clock of FDCAN.

Best regards

Bouraoui

Hello @Bouraoui Chemli​ ,

Thank you for your reply. I have used the STM32CuveMX and chose the "classic mode" for the CAN Bus.

The problem is that I can not find any formula for the CAN FD Bit Timing in "Classic Master" mode.

The Formulas are only for CAN FD and not for CAN FD "Classic Mode".

I appreciate your help.

Best regards,

Vouria

Bouraoui Chemli
ST Employee

Hello @VYoun​ 

You can find the equations for FDCAN as classic CAN in the reference manual RM0433 Rev7 section 56.4.4 Bit timing :

for the nominal bit time

– tq = (FDCAN_NBTP.NBRP[8:0] + 1) * tfdcan_tq_ck

– tSyncSeg = 1 tq

– tBS1 = tq * (FDCAN_NBTP.NTSEG1[7:0] + 1)

– tBS2 = tq * (FDCAN_NBTP.NTSEG2[6:0] + 1)

Best regards

Bouraoui

Hello @Bouraoui Chemli​ ,

Thank you for your reply.

I came across this formula. However, the parameters which are needed for the STM32CubeMX is different.

There I need the following parameters:

  1. NominalSyncJumpWidth
  2. NominalTimeSeg1
  3. NominalTimeSeg2

I appreciate if you could tell me how to derive the above parameters from the formula in the Reference Manual.

Thank you and best regards,

Vouria

Bouraoui Chemli
ST Employee

Hello @VYoun​ 

  1. NominalTimeSeg1 : tBS1
  2. NominalTimeSeg2 : tBS2
  3. NominalSyncJumpWidth : SJW

SJW is not included in the equations and explained in RM0433 Rev7 (page 2509).

For a detailed description of the CAN bit timing and resynchronization mechanism, refer to the ISO 11898-1 standard.

Best regards,

Bouraoui

Hello @Bouraoui Chemli​ ,

Thank you for your reply.

I went through the Reference Manual as you mentioned.

There are however two points which are not clear to me:

In the Reference Manual it is mentioned that: FDCAN_NBTP.NTSEG1[7:0] is the sum of Prop_Seg and Phase_Seg1.

my question is how is the value of Prop_Seg is found?

second, regarding the NominalSyncJumpWidth. This is discussed in the reference manual on page 2509, however there is nothing mentioned about finding its value.

Thank you again for your help.

Best regards,

Vouria

Bouraoui Chemli
ST Employee

Hello @VYoun​ 

For a detailed description of the CAN bit timing and resynchronization mechanism, (Prop_Seg, Phase_Seg1, SJW...), refer to the ISO 11898-1 standard.

You can find through STM32CubeFW an example shows how to configure the FDCAN peripheral to send and receive

Classic CAN frames in normal mode : STM32Cube_FW_H7_V1.7.0\Projects\STM32H743I-EVAL\Examples\FDCAN\FDCAN_Classic_Frame_Networking

Best regards,

Bouraoui