tianyi2
1
Hi,
I followed the Controller Area Network (CAN) — Jetson Linux<br/>Developer Guide 34.1 documentation to test the function of CAN.
I executed the following command.
sudo busybox devmem 0x0c303018 w 0xc458
sudo busybox devmem 0x0c303010 w 0xc400
sudo busybox devmem 0x0c303008 w 0xc458
sudo busybox devmem 0x0c303000 w 0xc400
sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
sudo ip link set can0 up type can bitrate 500000 dbitrate 1000000 berr-reporting on fd on
sudo ip link set can1 up type can bitrate 500000 dbitrate 1000000 berr-reporting on fd on
sudo cansend can1 123##1abcdabcd
When the last command is inputed, the following is printed all the time.
#########################log start#######################
sudo cansend can1 123##1abcdabcd
[ 80.355859] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.361731] mttcan c320000.mttcan can1: IR 0x8010000 PSR 0x711
[ 80.367926] mttcan c320000.mttcan can1: entered error warning state
@linux:~$ [ 80.374411] mttcan c320000.mttcan can1: entered error passive state
[ 80.380872] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.386706] mttcan c320000.mttcan can1: IR 0x9800000 PSR 0x779
[ 80.392766] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.398602] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x779
[ 80.404652] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.410487] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x769
[ 80.416533] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.422365] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x771
[ 80.428433] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.434287] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x779
[ 80.440336] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.446178] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x771
[ 80.452307] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.458138] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x779
[ 80.464175] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.470009] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x779
[ 80.476050] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.481891] mttcan c320000.mttcan can1: IR 0x8000000 PSR 0x771
[ 80.487932] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.493794] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.499666] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.505514] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.511367] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.517209] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.523051] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.528893] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.534738] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.540586] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.546432] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.552279] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.558125] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.563972] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.569835] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.575679] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.581522] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.587366] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.593209] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.599049] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.604892] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.610744] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.616599] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.622445] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.628296] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.634139] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.639985] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.645830] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.651674] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.657515] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.663356] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.669197] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.675042] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.680894] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.686745] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.692588] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.698436] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.704278] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.710126] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.715972] mttcan c320000.mttcan can1: Stuff Error Detected
[ 80.721818] mttcan c320000.mttcan can1: Stuff Error Detected
#########################log end#######################
Do I miss something? Please point it out .
kayccc
2
Which transceiver you used?
Had you gone through Topic 221272 to setup CAN?
tianyi2
4
Hi,
I tried the Topic 221272.
First, I executed the following command.
sudo busybox devmem 0x0c303018 w 0xc458
sudo busybox devmem 0x0c303010 w 0xc400
sudo busybox devmem 0x0c303008 w 0xc458
sudo busybox devmem 0x0c303000 w 0xc400
sudo modprobe can
sudo modprobe can_raw
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 500000
sudo ip link set can1 type can bitrate 500000
sudo ifconfig can0 up
sudo ifconfig can1 up
Second, I executed the following command.
@linux:~$ sudo cansend can0 123##1abcdabcd
CAN interface is not CAN FD capable - sorry.
Third, I execute the following command.
@linux:~$ sudo cansend can0 123#abcdabcd
[ 1565.285422] mttcan c310000.mttcan can0: entered error warning state
@linux:~$ [ 1565.292130] mttcan c310000.mttcan can0: entered error passive state.
There is no improvement.The transceiver is as following.
kayccc
5
tianyi2
6
Hi,
The loopback is rightly executed.
tianyi2
7
Hi,
The result of short or not short the TX and RX is the same.
hello tianyi2,
had you seen CAN by checking with… $ ifconfig -a
?
tianyi2
9
Hi,
I execute ifconfig
and two CAN device is listed.
tianyi2
12
Hi,
The following log is the answer of 1,3.The following picture is the answer of 2.
##########log start#############################
@localhost:~$ sudo ip -d -s link show can0
6: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can <BERR-REPORTING,FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 500000 sample-point 0.870
tq 20 prop-seg 43 phase-seg1 43 phase-seg2 13 sjw 1
mttcan: tseg1 2…255 tseg2 0…127 sjw 1…127 brp 1…511 brp-inc 1
dbitrate 1000000 dsample-point 0.720
dtq 40 dprop-seg 8 dphase-seg1 9 dphase-seg2 7 dsjw 1
mttcan: dtseg1 1…31 dtseg2 0…15 dsjw 1…15 dbrp 1…15 dbrp-inc 1
clock 50000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
@localhost:~$ sudo ip -d -s link show can1
7: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can <BERR-REPORTING,FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 500000 sample-point 0.870
tq 20 prop-seg 43 phase-seg1 43 phase-seg2 13 sjw 1
mttcan: tseg1 2…255 tseg2 0…127 sjw 1…127 brp 1…511 brp-inc 1
dbitrate 1000000 dsample-point 0.720
dtq 40 dprop-seg 8 dphase-seg1 9 dphase-seg2 7 dsjw 1
mttcan: dtseg1 1…31 dtseg2 0…15 dsjw 1…15 dbrp 1…15 dbrp-inc 1
clock 50000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
@localhost:~$ sudo busybox devmem 0x0c303010
0x0000C400
@localhost:~$ sudo busybox devmem 0x0c303018
0x0000C458
@localhost:~$ sudo busybox devmem 0x0c303000
0x0000C400
@localhost:~$ sudo busybox devmem 0x0c303008
0x0000C458
##########log end#############################
hello tianyi2,
BTW, please refer to CAN bus - Wikipedia.
A bit stuffing error means one of these added bits was the incorrect value.
could you please try running cansend
as following?
i.e. $ cansend can0 123#abcdabcd
tianyi2
14
Hi,
1.where to displayed the A bit stuffing error?
2.This command is inputed before.
it looks like the error that two CAN nodes cannot communicate on different bit-rates.
BTW, is there a 120ohm termination between CAN_H and CAN_L pins?
tianyi2
16
Hi,
When I enabled the 120ohm, the CAN0 or CAN1 can be running OK singly. If the two device is all brought up , one of it can’t send and receive data rightly.
tianyi2
17
Hi,
Do you have any idea to make the two device work rightly on the same time?
hello tianyi2,
let’s narrow down the issue, had you try To perform a loopback test by shorting the Tx and Rx pins to check the functionality?
Hi,
I retry the send and receive of can0 and can1 on the same time,and it’s OK.I don’t know the reason.
hello tianyi2,
I assume you’re using the same software version, right?
let’s close this thread as it is hardware setup issue.
system
Closed
22
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.