I have a CAN communication problem with my PWM RGB LED driver. I have a controller and a PWM RGB LED driver. The controller sends messages to the LED driver about what the PWM duty cycle of the RGB channels should be. The communication speed is 250 kb/s.
I didn't see any communication problem in my previous LED driver design. But after some improvements like changing the PWM driver circuit of the MOSFETs, I realized that there are some commutation delays in my second design of the PWM driver (both PCBs are originally manufactured).
After debugging the driver, I saw that the CAN ESR register catches error frames. Because of these error frames, the driver responds to the commands late. But interestingly, these error frames are seen only in some of my second design driver PCBs; some are running with no errors. They were both manufactured in the same process with the same components.
When I reduced the communication speed to 125, 100, and 50 kb/s, the error frame did not appear in the debug. But testing in an 80°C environment, the error frames appeared again.
I designed two different versions of the 4-layer PCB of the driver. One is running without error frame. In a hot environment (80°C), error frames were seen in the second 4-layer PCB.
I think that this problem is because of the PCB layout. 800 Hz PWM pulses on the MOSFETs may be affecting the message on the CAN Rx and Tx lines.
Could there be a different reason than the layout?
What would you suggest I do for a solution?
My first PCB layout. There is no error frame in the communication.
My second PCB layout. Some of this PCB's error frames occur in 250 kb/s CAN communication.
My first 4-layer PCB layout: Top copper is poured with DigitalGND. Inner layer 1 is DigitalGND plane. Inner layer 2 is PowerGND plane (MOSFET's sources). Bottom copper poured with PowerGND (all GND layers connected at Input Common Mode Choke's leg).
Inner Layer 1: DigitalGND plane
Inner Layer 2: PowerGND plane
My second 4-layer PCB layout. Layers are same as the first one.
Inner Layer 1: DigitalGND plane
Inner Layer 2: PowerGND plane
EDIT: Adding CAN Bus circuit CAN bus schematic circuit:
CAN Bus speed : 250kbps
Clock source is Internal RC osc (HSI).