cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4 brings down CAN network when exposed to electrical noise

Jack1221
Associate

Hello,

 

I have a CAN 2.0 network (classic can) running at 500 kb/s.  I have multiple STM32F4 nodes running the stm32 HAL CAN driver with no issues.  I have another node running a STM32G4 with a FDCAN driver set to classic mode.  When the G4 node is connected to the network it works most of the time, but when electrical noise is introduced the whole network slowly crashes as each node cannot send messages.  In particular the farthest node from the G4 and the G4 both stop sending messages at exactly the same moment, reporting a FIFO buffer full error.  In the course of 30 seconds of this electrical noise, however, every STM node on the CAN line stops sending messages pretty consistently.  The exact CAN driver error is not yet 100% known across all nodes, but was the BIT_STUFF error at the FDCAN at one point. 

With the G4 removed, but the location of the termination the same, the CAN bus does not experience any issues at the same electrical noise exposure or considerably more extreme disturbances.  The CAN transciver and passive configuration is nearly identical between nodes.

 

Is there anything related to the G4 or FDCAN controller or driver that may cause less tolerance in a noisy environment compared to a classic CAN system?  I am at a loss for how FDCAN in normal mode can be very different from classic CAN, however I do worry that somehow the FDCAN is less tolerant to slight propogation delay or other network imperfections.

 

Here is some relevant FDCAN configs:

```

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 = 13;
hfdcan1.Init.NominalTimeSeg2 = 2;
hfdcan1.Init.DataPrescaler = 1;
hfdcan1.Init.DataSyncJumpWidth = 1;
hfdcan1.Init.DataTimeSeg1 = 1;
hfdcan1.Init.DataTimeSeg2 = 1;
hfdcan1.Init.StdFiltersNbr = 0;
hfdcan1.Init.ExtFiltersNbr = 0;
hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;

```

 

 

3 REPLIES 3
SofLit
ST Employee

Hello,

What is your system clock source?

What if you enable the Auto-Retransmission?

hfdcan1.Init.AutoRetransmission = ENABLE;

 

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.

My system clock source was tested at both PCLK (16 mhz) and PLLLQ (20 mhz) and I found not difference in the problem.

 

I did not try enabling AutoRetransmission as I feared it would mask an underlying issue, but I will do so and get back to you.

What is your clock source HSE with external crystal or HSE?

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.