cancel
Showing results for 
Search instead for 
Did you mean: 

Can FDCAN work with CAN 2.0B devices?

anuj
Associate II

I am working on a project where the requirement for the microcontroller is to communicate over the CAN bus. The STM32G0B1KET6 is having FDCAN controller inside. It mentions in the datasheet that "The CAN modules are compliant with ISO 11898-1 (CAN protocol specification version 2.0 part A, B) and CAN FD protocol specification version 1.0".

Does it mean it will work with Non-FDCAN devices i.e just the CAN2.0A/B interface?

While looking at the other series for STM32 controller, it is clearly mentioned that The CAN peripheral supports CAN protocol version 2.0 A, B Active.

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

Hi @anuj​ ,

The answer is yes.

Here an example STM32CubeG0/Projects/STM32G0C1E-EV/Examples/FDCAN/FDCAN_Classic_Frame_Networking.

AN5348 can bring you some more insights about FDCAN implementation in STM32 products.

-Amel

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.

View solution in original post

7 REPLIES 7
Amel NASRI
ST Employee

Hi @anuj​ ,

The answer is yes.

Here an example STM32CubeG0/Projects/STM32G0C1E-EV/Examples/FDCAN/FDCAN_Classic_Frame_Networking.

AN5348 can bring you some more insights about FDCAN implementation in STM32 products.

-Amel

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.

tmlee_mts
Associate II

Hello Amel,

Please tell me what are the exact steps to porting the FDCAN_Classic_Frame_Networking example from the STM32G0C1VETX CPU you reference above to my STM32H735IGK6 CPU on my STM32H735G-DK board. I have tried importing the project and importing the example, creating a new project with the h735 and importing source from the G0C1, but CubeIDE still references the old  STM32G0C1VETX builds files and fails.

 

 

I forgot to mention this..... The project properties to change the MCU type is not available.

tmlee_mts_0-1691686176704.png

 

 

tmlee_mts_0-1691694753164.png

 

I initialize hfdcan1 to the following:

 

hfdcan1.Instance = FDCAN1;

//hfdcan1.Init.ClockDivider = FDCAN_CLOCK_DIV1;

hfdcan1.Init.FrameFormat = FDCAN_FRAME_FD_BRS;

hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;

hfdcan1.Init.AutoRetransmission = ENABLE;

hfdcan1.Init.TransmitPause = ENABLE;

hfdcan1.Init.ProtocolException = DISABLE;

hfdcan1.Init.NominalPrescaler = 1;

hfdcan1.Init.NominalSyncJumpWidth = 16;

hfdcan1.Init.NominalTimeSeg1 = 63;

hfdcan1.Init.NominalTimeSeg2 = 16;

hfdcan1.Init.DataPrescaler = 1;

hfdcan1.Init.DataSyncJumpWidth = 4;

hfdcan1.Init.DataTimeSeg1 = 5;

hfdcan1.Init.DataTimeSeg2 = 4;

hfdcan1.Init.StdFiltersNbr = 1;

hfdcan1.Init.ExtFiltersNbr = 0;

 

and set my TxHeader as:

 

/* Prepare Tx Header */

TxHeader.Identifier = 0x321;

TxHeader.IdType = FDCAN_STANDARD_ID;

TxHeader.TxFrameType = FDCAN_DATA_FRAME;

TxHeader.DataLength = FDCAN_DLC_BYTES_2;

TxHeader.ErrorStateIndicator = FDCAN_ESI_ACTIVE;

TxHeader.BitRateSwitch = FDCAN_BRS_OFF;

TxHeader.FDFormat = FDCAN_CLASSIC_CAN;

TxHeader.TxEventFifoControl = FDCAN_NO_TX_EVENTS;

TxHeader.MessageMarker = 0;

 

I Debug Trace all HAL functions prior to HAL_FDCAN_AddMessageToTxFifoQ, they are all HAL_OK, but

Once I enter the HAL_FDCAN_AddMessageToTxBuffer function, HAL reports a parameter  incorrect error:

tmlee_mts_1-1691694917602.png

 

Hello @tmlee_mts ,

Refer to Projects\STM32H743I-EVAL\Examples\FDCAN\FDCAN_Classic_Frame_Networking (from STM32CubeH7) instead of STM32G0C1 (not the same family). But you have to check the clocks where you have some differences.

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.