How to use the can function on the agx development kit on jetpack4.5.1?

pinmux.0x0c303000 = 0x0000c400; # can1_dout_paa0: rsvd1, pull-down, tristate-enable, input-enable
pinmux.0x0c303008 = 0x0000c458; # can1_din_paa1: rsvd1, pull-down, tristate-enable, input-enable
pinmux.0x0c303010 = 0x0000c059; # can0_dout_paa2: rsvd1, pull-up, tristate-enable, input-enable
pinmux.0x0c303018 = 0x0000c059; # can0_din_paa3: rsvd1, pull-up, tristate-enable, input-enable
pinmux.0x0c303020 = 0x0000c000; # can0_stb_paa4: rsvd0, tristate-disable, input-disable
pinmux.0x0c303028 = 0x0000c000; # can0_en_paa5: rsvd0, tristate-disable, input-disable
pinmux.0x0c303030 = 0x0000c058; # can0_wake_paa6: rsvd0, pull-up, tristate-enable, input-enable
pinmux.0x0c303038 = 0x0000c048; # can0_err_paa7: rsvd0, pull-up, tristate-disable, input-enable
pinmux.0x0c303040 = 0x0000c054; # can1_stb_pbb0: rsvd0, pull-down, tristate-enable, input-enable
pinmux.0x0c303048 = 0x0000c054; # can1_en_pbb1: rsvd0, pull-down, tristate-enable, input-enable
pinmux.0x0c303050 = 0x0000c058; # can1_wake_pbb2: rsvd0, pull-up, tristate-enable, input-enable
pinmux.0x02430078 = 0x00000000; # soc_gpio05_pp5: rsvd0, tristate-disable, input-disable, lpdr-disable

I modified according to the above content, and then flashed into the device, but the can still cannot be used.

When you say “cannot be used,” what do you mean?
What code are you running to attempt to use it?
What error messages are you getting when trying it?
What is the output of dmesg or the kernel serial port when doing so?

Please refer to below L4T document: NVIDIA Jetson Linux Driver Package Software Features : Hardware Setup | NVIDIA Docs

I refer to this article, modify the text Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg file, modify the code as shown above, and then flash into the development board, The results are abnormal.
https://elinux.org/Jetson/AGX_Xavier_CAN

#!/bin/sh
clear

declare -i i=1
str_can0='can0'
str_can1='can1'
str=''

sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan

echo 'Enable can0'
sudo ip link set can0 type can bitrate 80000
sudo ip link set up can0
for i in {1..30}
do
	cansend can0 1F334455#1122334455667788
	sleep 1
	
	echo 'can0 Sent, waiting to be received'
done

sudo ip link set can0 down

exit

This is my test code, and then the can analyzer is connected to the outside, and the test script is executed. The can analyzer does not receive any information.

Hi,
Can you paste output of:
ip -d -s link show can0

nvidia@agx:~$ ip -d -s link show can1
11: can1: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state STOPPED (berr-counter tx 248 rx 0) restart-ms 0 
	  bitrate 80000 sample-point 0.875 
	  tq 52 prop-seg 104 phase-seg1 105 phase-seg2 30 sjw 1
	  mttcan: tseg1 2..255 tseg2 0..127 sjw 1..127 brp 1..511 brp-inc 1
	  mttcan: dtseg1 1..31 dtseg2 0..15 dsjw 1..15 dbrp 1..15 dbrp-inc 1
	  clock 38400000
	  re-started bus-errors arbit-lost error-warn error-pass bus-off
	  0          0          0          1          1          1         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
    RX: bytes  packets  errors  dropped overrun mcast   
    24         3        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       2       0       0       
nvidia@agx:~$ 


Hi,
Clock rate on Xavier is 38400000 . If bus has nodes with different rate, communication will not work. To change clock source, refer: https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/clocks.html#wwpID0E06B0HA

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.