MCP2518FD SPI-CAN transmit jitter (~6ms) with same-ID frames

Hi all,

I’m observing frame timing jitter on the MCP2518FD SPI-CAN interface and would appreciate any insights.

Environment

  • Platform: Jetson Orin NX (custom carrier board)

  • OS: Jetson Linux, Kernel 5.15.158

  • CAN Controller: MCP2518FD on SPI0

  • Driver: mcp251xfd (in-tree)

  • External crystal: 20 MHz

Connect a motor to the CAN bus and send the message using the following command


candump can0 -xe -t a > test.txt
cangen can1 -I 603 -L 8 -D 1122334455667788 -g 1 -n 10000

There is a frame jitter problem when sending consecutive messages with an interval of 1ms. It will be re-sent in the next cycle.
The effect is as follows: there was a 5ms pause at 510 milliseconds, and 5 frames were sent consecutively at 516 milliseconds.

This phenomenon does not occur regularly, and this time interval is not in line with the expected behavior.
dtb 如下

spi@3210000{

            status = "okay";

            

            spi@0 {

                compatible = "microchip,mcp251xfd";

                reg = <0x00>;

                clocks = <&can_clock>;

                spi-max-frequency = <40000000>;

                interrupt-parent = <&gpio>;

                interrupts = <TEGRA234_MAIN_GPIO(Z, 1) IRQ_TYPE_LEVEL_LOW>;

                nvidia,enable-hw-based-cs;

                

                controller-data {

                    nvidia,enable-hw-based-cs;

                    nvidia,rx-clk-tap-delay = <0x10>;

                    nvidia,tx-clk-tap-delay = <0x0>;

                };

            };

            

            spi@1 {

                compatible = "tegra-spidev";

                reg = <0x1>;

                spi-max-frequency = <50000000>;

                controller-data {

                    nvidia,enable-hw-based-cs;

                    nvidia,rx-clk-tap-delay = <0x10>;

                    nvidia,tx-clk-tap-delay = <0x0>;

                };

            };

        };

Any suggestions or pointers to patches/errata would be greatly appreciated.

Thanks!

Hi hexu_1212,

What’s the Jetpack version in use?
Could you share the block diagram of the connections between MCP2518FD and the Orin Nano?

You can apply the following change to check if it could help for your case.
Jetson orin nano SPI Speed not changing - #9 by KevinFFF

Please also provide the full dmesg and device tree for further check.

Hi KevinFFF

Thank you for your reply. I will try this change and recompile.

I am using Jetpack 6.0 [L4T 36.3.0]

dmesg.txt (61.4 KB)

kernel_tegra234-p3768-0000+p3767-0000-nv.txt (312.1 KB)

pib-319_rev0.pdf (64.6 KB)

can.pdf (155.2 KB)

[   14.638274] mcp251xfd spi0.0 can1: renamed from spican0
[   14.675676] mcp251xfd spi1.0 can0: renamed from spican1

Okay, it seems you have 2 MCP2518FD modules connected on SPI1_CS0 and SPI3_CS0 respectively.
Please let us know if that patch helping for your case.

Could you also check if the patch from Orin NX SPI delay between transfers - #21 by KevinFFF helps for your case?