I faced an issue while testing the CAN interface on Jetson Xavier nx,
CAN interface on my board has a frequency of 34MHz and the slave device that I am using has a frequency of 40MHz. Hence the data exchange was not taking place.
Is there a way to change this frequency of CAN on board??
To achieve 40MHz, first you need to set CAN parent clock as pllaon.
Please follow below doc to do so:
Check “ To use PLLAON as clock source” section
Also, by default, CAN clock rate requested is 50MHz from MTTCAN kernel driver. So to use 40MHz, make below change in driver:
The mttcan kernel driver sets the CAN clock rate. Follow the instructions in the Kernel Customization topic’s section Obtaining the Kernel Sources with Git to obtain kernel source code, then update the clock rate in the mttcan driver as in this code snippet:
.set_can_core_clk = true,
.can_core_clk_rate = 50000000, //// modify here (in Hz)
.can_clk_rate = 200000000, //// four times of core clk rate
Build the kernel and flash with the new kernel Image.
You can also directly copy mttcan.ko in the target under /lib/…
Let me know if you face any issues.
Thanks for the instructions, i will try that out