1
\$\begingroup\$

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 send 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;

```
\$\endgroup\$
5
  • \$\begingroup\$ It's not really clear to me how many nodes there are. There are more than 2, correct? In case of exactly 2 nodes, then in case one controller fails due to reset etc, error frames resulting in "bit stuff error" are expected since there is no node to ACK any longer. In case of 3 or more nodes however, this is no longer the case. \$\endgroup\$
    – Lundin
    Commented May 13 at 7:47
  • \$\begingroup\$ I'm not familiar with the particular CAN controller but normally TQ settings for nominal and data should be the same in classic mode. Does the datasheet say that data time seg settings are ignored when using classic CAN? \$\endgroup\$
    – Lundin
    Commented May 13 at 7:50
  • \$\begingroup\$ Specifically, ignoring ST HAL bloat layer crap, what values do you have written in registers FDCAN_DBTP and FDCAN_NBTP after setup? \$\endgroup\$
    – Lundin
    Commented May 13 at 8:02
  • \$\begingroup\$ Yes, I found a third party (not datasheet) that confirms data time quanta is ignored for FDCAN. Additionally I tried with the data time quanta matching nominal to no avail. There are 5 nodes, 2 STM32F4s, 1 STM32G4, a MCP2515, and another commercial/proprietary device. I will check the register values soon. \$\endgroup\$
    – Jack1221
    Commented May 14 at 2:12
  • \$\begingroup\$ Anyway, the root cause is likely in the hardware since a correctly designed CAN bus is incredibly rugged and will not easily go haywire due to EMI. So the next step is probably to share your CAN design schematic. \$\endgroup\$
    – Lundin
    Commented May 14 at 7:34

0

Browse other questions tagged or ask your own question.