2026-01-30 2:00 AM
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.
STM32L443VCT6
STM32L443CCT6
STM32F437ZGT6
All devices communicate together on the same CAN bus.
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 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);
2026-01-30 2:15 AM - edited 2026-01-30 2:23 AM
Hello,
You didn't tell:
1- What is the clock source you have used? HSI or an external Crystal? If HSI that's not recommended you need to use a precise clock source over temperature and other constraints such as a crystal.
2- What is the length of your CAN bus? The maximum bitrate you can reach depends on your bus length:
|
CAN bitrate |
Maximum bus length (m) |
|
1 Mbit/s |
35 |
|
800 kbit/s |
50 |
|
500 kbit/s |
100 |
|
250 kbit/s |
250 |
|
125 kbit/s |
500 |
|
50 kbit/s |
1000 |
|
20 kbit/s |
2500 |
|
10 kbit/s |
5000 |
3- Did you use a twisted pair for a long bus length?
4- Did you connect two terminating resistors of 120ohm at both sides of the CAN bus?
Please refer to the following knowledge base articles:
CAN (bxCAN) bit time configuration on STM32 MCUs
Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 1)
Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 2)