Kernel version : jetson-linux 36.3
Platform : Jetson Orin Nano Devkit (SD card)
Hello!
I am trying to make use of MCP2515 to enable additional CAN bus.
I followed the example on Jetson/L4T/peripheral/ - eLinux.org, which was referred on multiple forum posts. Thanks to that tutorial, I have managed to enable can1 and can2 on my Jetson Orin Nano(SD card).
$ sudo ip link set can0 up type can bitrate 1000000
$ sudo ip link set can1 up type can bitrate 1000000
$ sudo ip link set can2 up type can bitrate 1000000
$ cansend can0 0FF#01.01.01.01.01.01.01.01
$ cansend can1 0FF#01.01.01.01.01.01.01.01
$ cansend can2 0FF#01.01.01.01.01.01.01.01
However, when I compared the CAN msg on an oscilloscope, there is a bitrate difference between the native CAN bus(can0) and the MCP2515 driven CAN bus(can1, can2).
The difference is shown as below. channel 1(yellow) is can1, channel 2(green) is can0.
can0 reads fine. The length of 1 bit is 1μs, which is the right value since all CAN bus is set to 1Mbps. However, it seems the bitrate on MCP2515 CAN bus is about 3 times slower than the settings, showing 3μs per bit.
I tried 100kbps, 500kbps, 1Mbps and it all bitrates had the same results.
I hardly doubt that this problem stems from the MCP2515’s hardware, since I ran test with the same MCP2515 modules on Arduino Mega and Arduino Due. Both cases used the mcp_can library by coryjfowler, a C++ Arduino library.
I even modified the mcp_can library using JETGPIO by Rubberazer to test MCP2515 on Jetson Orin Nano, and in that test, it still had no problems with the CAN msg bitrate.
I also tried altering the SPI max speed tegra234-p3768-0000+p3767-xxxx-nv-common.dtsi
from 2Mbps(based on the eLinux tutorial) to 10Mbps, to match the MCP2515’s max SPI communication speed. But this did not change a thing.
Since, this is my first time modifying and using a Jetson Orin Nano, any help or comments would be very thankful.