Skip to main content
Associate III
March 4, 2026
Solved

FDCAN Classical STM32G473 not working with canBus

  • March 4, 2026
  • 2 replies
  • 350 views

Hey I am having trouble tryng to connect my stm32g473 to a canbus. I am using a l9616 as a transceiver and the bus is functions as I have connected to it with an stm32f722re with the same l9616.

The clock is 64Mhz,Ive used the canbit time calculation website to define the values of nominal time 1 and 2 to achive 500kbs.

Also using NVIC and it seems to be configured fine. When tested in loopback the interrupt is called and the messages are received.

This is the init with the filter config,as I ve understand I am not filtering anything and any of the messages on the bus should get to my uC.

When running the state of hfdcan1 is Busy and also no error code show up.

FDCAN_HandleTypeDef hfdcan1;

/* FDCAN1 init function */
void MX_FDCAN1_Init(void)
{

 /* USER CODE BEGIN FDCAN1_Init 0 */

 /* USER CODE END FDCAN1_Init 0 */

 /* USER CODE BEGIN FDCAN1_Init 1 */

 /* USER CODE END FDCAN1_Init 1 */
 hfdcan1.Instance = FDCAN1;
 hfdcan1.Init.ClockDivider = FDCAN_CLOCK_DIV1;
 hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
 hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
 hfdcan1.Init.AutoRetransmission = DISABLE;
 hfdcan1.Init.TransmitPause = DISABLE;
 hfdcan1.Init.ProtocolException = DISABLE;
 hfdcan1.Init.NominalPrescaler = 1;
 hfdcan1.Init.NominalSyncJumpWidth = 1;
 hfdcan1.Init.NominalTimeSeg1 = 111;
 hfdcan1.Init.NominalTimeSeg2 = 16;
 hfdcan1.Init.DataPrescaler = 1;
 hfdcan1.Init.DataSyncJumpWidth = 1;
 hfdcan1.Init.DataTimeSeg1 = 1;
 hfdcan1.Init.DataTimeSeg2 = 1;
 hfdcan1.Init.StdFiltersNbr = 1;
 hfdcan1.Init.ExtFiltersNbr = 0;
 hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
 if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK)
 {
 Error_Handler();
 }

 /* USER CODE BEGIN FDCAN1_Init 2 */
 FDCAN_FilterTypeDef sFilter;

 sFilter.IdType = FDCAN_STANDARD_ID;
 sFilter.FilterIndex = 0;
 sFilter.FilterType = FDCAN_FILTER_MASK;
 sFilter.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
 sFilter.FilterID1 = 0x000;
 sFilter.FilterID2 = 0x000; 

 if (HAL_FDCAN_ConfigFilter(&hfdcan1, &sFilter) != HAL_OK)
 {
 Error_Handler();
 }

 if (HAL_FDCAN_ConfigGlobalFilter(&hfdcan1,
 FDCAN_ACCEPT_IN_RX_FIFO0, 
 FDCAN_ACCEPT_IN_RX_FIFO0, 
 FDCAN_REJECT_REMOTE, 
 FDCAN_REJECT_REMOTE) != HAL_OK)
 {
 Error_Handler();
 }


 /* USER CODE END FDCAN1_Init 2 */

}

Also here is the circuit of the transceiver if that helps,I have 5v stable and gnd on the transceiver itself

 

Best answer by mƎALLEm

@DiogoPedrosa wrote:

About the transceiver,I ve used with many stm32f7 and it worked fine. I will try to search for a substitute but i dont think thats the issue.


If that worked before that doesn't mean it will work forever. You are running out of spec here.. you are at the limit of voltage levels..

If in loopback mode is working but not in normal mode, you have either

- A hardware issue a transceiver issue including the problem I cited previously.. solder joints, connection/wiring etc ..

- Clock issue: not using a precise clock source such as using HSI introducing jitters..

- Bitrate issue: you are not running at the exact CAN bitrate

 

2 replies

mƎALLEm
Technical Moderator
March 4, 2026

Hello,

The issue is not clear.

You said:

"Also using NVIC and it seems to be configured fine. When tested in loopback the interrupt is called and the messages are received."

Do you have an issue in Normal mode but not in Loopback mode (you can send and receive CAN frames)? 

"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."
Associate III
March 4, 2026

Yeah the issue happens in normal mode but not in loopback mode. When in loopback I can send packets and receive via nvic.

About the transceiver,I ve used with many stm32f7 and it worked fine. I will try to search for a substitute but i dont think thats the issue.

As testing continued I also changed the can divider to 4 and changed the nominal seg1 and to match my 500kbits/s baud rate.

 

The issue is when in normal mode I cant receive and read any msg.

 

 

mƎALLEm
mƎALLEmBest answer
Technical Moderator
March 4, 2026

@DiogoPedrosa wrote:

About the transceiver,I ve used with many stm32f7 and it worked fine. I will try to search for a substitute but i dont think thats the issue.


If that worked before that doesn't mean it will work forever. You are running out of spec here.. you are at the limit of voltage levels..

If in loopback mode is working but not in normal mode, you have either

- A hardware issue a transceiver issue including the problem I cited previously.. solder joints, connection/wiring etc ..

- Clock issue: not using a precise clock source such as using HSI introducing jitters..

- Bitrate issue: you are not running at the exact CAN bitrate

 

"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."
mƎALLEm
Technical Moderator
March 4, 2026

Looking at the transceiver datasheet:

screenshot.png

VTXO min = 0.7Vs = 0.7x5 = 3.5V > MCU VDD.

That tranceiver is an automotive grade ans it's not compatible with STM32. 

Use a 3.3V transceiver like SN65HVD230 .

 

"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."