Hi, I am trying to set up the MCAL CAN driver on S32K118 EVB powered through USB micro connector. I did the configurations on EB Tresos and enabled the Loop-Back mode. I am using the POLLING option for both TX and RX. In my code, I set up a PDU similar to the example can_pal_s32k118 and called Can_Write() function. I have also set up a timer to call Can_MainFunction_Read() and Can_MainFunction_Write() at every 10 milliseconds or so. The Loop-Back mode worked properly and I had no issues with it.
Then, I tried to communicate with Kvaser's CAN bus. To do this I unchecked the Loop_Back mode configuration on EB Tresos. and did not change anything. After having issues communicating with Kvaser, I decided to measure the CAN_HI pin of Evaluation Board. As I suspected it stays at 0 Volts even after initialization and the voltage does not change when Can_Write() and Can_MainFunction_Write() are called respectively. I am guessing it should stay at a HIGH voltage and the voltage should change during write operations.
What am I missing?
Thanks in advance,
M. Talha Uyar
Edit: After using the 12V external power instead of the USB micro connector, The CAN_HI and CAN_LO voltages are started working expectedly. However, I still cannot communicate with Kvaser's CAN bus. Both are at 20 kbps and I have connected the 120 Ohm termination resistors between Kvaser's CAN_HI and CAN_LO.
Edit2: Ok, I have previously configured SOSCDIV2_CLK for the CAN in EB Tresos since in the Reference Manual it is mentioned that FlexCAN oscillator clock is SOSCDIV2_CLK. I have changed that to SYS_CLK and repeated the calculations for 24 MHz instead of 4 MHz. It is now working fine and I am able to communicate with Kvaser's CAN bus.
Hi,
may I ask what do you mean, in edit 2, with "...repeated the calculations for 24 MHz instead of 4 MHz"?
I ran on a similar issue and using the SYS clock reference, but not actually changed any specific calculation.
BR
F.