EWGF (Error Warning Flag) intermittently set at 1 Mbps CAN on STM32L4 / STM32F4 – works fine at 500 kbps
We are facing an intermittent EWGF (Error Warning Flag) issue during CAN communication at 1 Mbps on multiple STM32 MCUs. The same hardware and software setup works reliably at 500 kbps without any CAN warnings.
MCUs Used
STM32L443VCT6
STM32L443CCT6
STM32F437ZGT6
All devices communicate together on the same CAN bus.
Issue Details
When CAN bit rate is configured to 1 Mbps, the EWGF bit in CAN_ESR register gets set intermittently
Communication does not stop immediately, but error counters increase over time
At 500 kbps, the issue is not observed
Same CAN transceivers, wiring, and termination are used
CAN Configuration
Common Settings
CAN peripheral clock: 24 MHz
GPIO speed for CAN TX/RX pins: High speed
Same clock source and configuration across all MCUs
For Bit Rate 500KHz
CANx->BTR = CAN_TSEG1(12) | CAN_TSEG2(1) | CAN_BRP(2) |CAN_SJW(0);
For Bit Rate 1MHz (Tried for different TQ , but still getting CAN warning)
TQ per bit = 8 TQ
CANx->BTR = CAN_TSEG1(5) | CAN_TSEG2(0) | CAN_BRP(2) |CAN_SJW(0);
TQ per bit = 12 TQ
CANx->BTR = CAN_TSEG1(7) | CAN_TSEG2(2) | CAN_BRP(1) |CAN_SJW(0);
TQ per bit = 24 TQ
CANx->BTR = CAN_TSEG1(14) | CAN_TSEG2(7) | CAN_BRP(0) |CAN_SJW(0);
