Hi everyone,
I am using CAN0 on the S32K312 at 500 kbps with an 87.5% sampling point.
Initially, I set up CAN0 to use the internal FIRC_CLK as the clock source. When I connected the S32K312 to a network with multiple CAN nodes, I noticed a lot of CAN error frames.
I then switched the CAN clock source from FIRC_CLK to the external FXOSC_CLK while keeping the CAN bitrate and sampling point the same. After this change, the communication became stable, and I stopped seeing the error frames.
Could anyone help me understand why switching the clock source from FIRC_CLK to FXOSC_CLK would fix the CAN errors?
Hello @Karthik_R,
Usually, FIRC clock is not recommended for FlexCAN communication, as accuracy is over the ~1% requirement according to CAN protocol (ISO 11898-1). You can see from S32K3's Data Sheet that FIRC's deviation is +- 5%.
Recommendation is to use either FXOSC or PLL running from XOSC. You can refer to FlexCAN Bit Timing Calculation document, and MPC5xxx/S32Kxx/LPCxxxx: CAN / CAN FD bit timing calculation tool for clock and timing calculations.
Hope this is clear.
Best regards,
Julián