Hello Ana,
thank you i got the example projects for standard CAN (No CAN FD).
the example code is working fine with CLKSRC = 0 (The CAN engine clock source is the oscillator clock = 8Mhz.) I tested on Evaluation Board. I am bale to see the Frame(0x55) on CANalyzer tool.
But I want to use the CLKSRC = 1 (The CAN engine clock source is the peripheral clock.) in our application.
We have below Slow RUN configure clock setting in our application(S32K144).
SCG_RCCR[SCS] = 0011b .........CORE_CLK 48 MHz
SCG_RCCR[DIVCORE] = 0000b .....SYS_CLK 48 MHz
SCG_RCCR[DIVBUS] = 0000b ......BUS_CLK 48 MHz (max freq. in RUN mode)
SCG_RCCR[DIVSLOW] = 0001b .....FLASH_CLK 24 MHz
I did the Bit Timing calculation with below parameters.(I have refer the simple guide FlexCAN bit timing calculation ).
Bit rate = 500k bit per second
Bus length = 10m
Bus propagation delay = 5 x 10-9 s/m
Physical Interface (TJA1040) transmitter plus receiver propagation delay = 150ns at 85C
CPI_clock = 48 MHz
Calculated Bit Timing parameters values are :
NBT = 16
Prescaler = 6
PROP_SEG = 3
PHASE_SEG1 = 6
PHASE_SEG2 = 6
RJW = 4
CTRL1 register update with below value.
CAN0->CTRL1 = CAN_CTRL1_PRESDIV(6) | CAN_CTRL1_RJW(3) | CAN_CTRL1_PSEG1(6) | CAN_CTRL1_PSEG2(6) | CAN_CTRL1_PROPSEG(3) | CAN_CTRL1_CLKSRC(1) | CAN_CTRL1_SMP(1);
With this all setting I getting the CAN signals on Oscilloscope but on CANalyzer i am getting error frames.
Is there any thing wrong in bit timing calculation or clock setting ?
or I have to change any other settings for CLKSRC = 1 ?
The same example code is working fine with CLKSRC = 0 (The CAN engine clock source is the oscillator clock = 8Mz.)