But when I modify the dts like this
spi@c260000 {
status = "okay";
mcp2518fdcan0: can@0 {
status = "okay";
compatible = "microchip,mcp2518fd";
reg = <0>;
spi-max-frequency = <20000000>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x7>;
nvidia,clk-parents = "osc";
clocks = <&mcp2518fd_osc>;
interrupt-parent = <&gpio_tca9539>;
interrupts =<&gpio_tca9539 5 IRQ_TYPE_LEVEL_LOW>;
controller-data {
nvidia,cs-setup-clk-count = <0x1e>;
nvidia,cs-hold-clk-count = <0x1e>;
nvidia,rx-clk-tap-delay = <0x1f>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
};
The mcp2518fd driver load success
[ 3.187495] mcp25xxfd spi1.0: MCP2518 successfully initialized.
When I operate as follow,the CANFD can’t work
step 1
ifconfig -a
Got
can0: flags=128<NOARP> mtu 72
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
step 2
sudo ip link set can0 type can bitrate 500000 dbitrate 2000000 fd on loopback on
setp 3
ip -details link show can0
Got
4: can0: <NOARP,ECHO> mtu 72 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can <LOOPBACK,FD> state STOPPED (berr-counter tx 0 rx 0) restart-ms 0
bitrate 5000000 sample-point 0.750
tq 50 prop-seg 1 phase-seg1 1 phase-seg2 1 sjw 1
mcp25xxfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1
dbitrate 2000000 dsample-point 0.700
dtq 50 dprop-seg 3 dphase-seg1 3 dphase-seg2 3 dsjw 1
mcp25xxfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1
clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
step 4
sudo ip link set can0 up
step 5
ip -details link show can0
Got
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can <LOOPBACK,FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 500000 sample-point 0.875
tq 50 prop-seg 17 phase-seg1 17 phase-seg2 5 sjw 1
mcp25xxfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1
dbitrate 2000000 dsample-point 0.700
dtq 50 dprop-seg 3 dphase-seg1 3 dphase-seg2 3 dsjw 1
mcp25xxfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1
clock 20000000numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
step 6
sudo candump can0 &
step 7
cansend can0 123#11223344556677
Then got failed as follow
[ 261.451912] pcieport 0000:00:01.0: PCIe Bus Error: severity=Corrected, type=Physical Layer, id=0008(Receiver ID)
[ 261.462152] pcieport 0000:00:01.0: device [10de:10e5] error status/mask=00000001/00002000
syrius@tegra-ubuntu:~$ [ 261.470696] pcieport 0000:00:01.0: [ 0] Receiver Error (First)
[ 261.479333] mcp25xxfd spi1.0 can0: CAN Bus error experienced