Jetson TX2 CAN bus send problem

Dear NVidia!

We have a Jetson TX2 development board ver c02. With latest Jetpack 4.4 (also tried 4.3 and 4.2.1) version installed. We connected through the CAN bus to third party device as described in topics here on the forum. And Jetson CAN receiving work fine. We can receive CAN packets without any error and see this with candump. But we can’t send any packets from Jetson. We are using sn65hvd230 CAN transceivers. The Jetson baudrate set to 500 kbps the same as on our device. All wiring checked several times. We tried CAN0 and CAN1 instances on Jetson (5 and 7, 15 and 17 pins on J26). We tried send packets with cansend, cangen and directly from C++ code though SocketCAN API. The results always the same. With the oscilloscope we see some short pulses on CAN0/1_TX pins on J26 connector and nothing else. If CAN configured without “restart-ms” option after try to send only one packet CAN bus going to BUS-OFF state. And recovery from BUSS-OFF is possible only after reloading the mttcan module from the kernel with modprobe -r mttcan. And then configuring CAN again.

On the pic you can see CAN0_RX signal (yellow) and accompanying CAN0_TX signal on J26 connector. The same picture on CAN1 pins.


So RX looks fine and as i said before we receiving packets from our device.

When we just trying to send CAN packet from Jetson without receiving data from third party devise we see only one short pulse on CAN0/1_TX at J26 connector and that is all.

Looks like TX on jetson is not working.

Hi,
Can you please provide output of :
ip -d -s link show can0
ip -d -s link show can1

busybox devmem 0x0c303018
busybox devmem 0x0c303008
busybox devmem 0x0c303010
busybox devmem 0x0c303020

Also, let me know if you have made any changes in kernel?

Thanks,
Shubhi

Dear Shubhi,

We don’t made any changes in the kernel. We install all stuff as described through SDK Manager connected through USB in recovery mode. No files were changed.

lsmod
Module Size Used by
mttcan 66251 0
can_dev 13306 1 mttcan
can_raw 10388 0
can 46600 1 can_raw
fuse 103841 3
bnep 16562 2
bcmdhd 934210 0
zram 26166 6
cfg80211 589351 1 bcmdhd
spidev 13282 0
ov5693 29772 0
overlay 48691 0
binfmt_misc 13103 1
nvgpu 1579891 46
bluedroid_pm 13912 0
ip_tables 19441 0
x_tables 28951 1 ip_tables

ip -d -s link show can0
8: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 1000
bitrate 500000 sample-point 0.875
tq 25 prop-seg 34 phase-seg1 35 phase-seg2 10 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 40000000
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

ip -d -s link show can1
9: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 1000
bitrate 500000 sample-point 0.875
tq 25 prop-seg 34 phase-seg1 35 phase-seg2 10 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 40000000
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

busybox devmem 0x0c303018
0x00000400
busybox devmem 0x0c303008
0x00000400
busybox devmem 0x0c303010
0x00000458
busybox devmem 0x0c303020
0x00000458

If I have opened two terminals and in one run
candump can1
and in another
cansend can0 123#1122

then i immediately obtain this:
ip -d -s link show can0
8: can0: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state BUS-OFF (berr-counter tx 248 rx 0) restart-ms 1000
bitrate 500000 sample-point 0.875
tq 25 prop-seg 34 phase-seg1 35 phase-seg2 10 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 40000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
8 0 0 9 9 9 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
280 35 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

and this
ip -d -s link show can1
9: can1: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-PASSIVE (berr-counter tx 0 rx 127) restart-ms 1000
bitrate 500000 sample-point 0.875
tq 25 prop-seg 34 phase-seg1 35 phase-seg2 10 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 40000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 1 1 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped overrun mcast
16 2 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

though i send data only from can0 to can1. All wires are connected as described in How to use CAN on JETSON TX2? - #2 by spatra

Is is looks like data from CAN0 TX immediately goes to CAN0 RX due to EMI interference or some other error in board routing. Or error deep inside the kernel/driver.

Thank you for quick answer!

Kind regards,
Alexander

Hi Alex,
It does not look SW issue to me. Also, your configurations are fine.
Which transceiver have you attached from Jetson CAN controller ? Also, if you do not have other transceiver, can you describe your setup once, what is connected on which CAN controller. As you said, both can0_rx and can1_rx are working fine. When you try to send packet from external nodes to can0_tx/can1_tx, it’s not working or internally also within jetson( send from can0 and receive on can1 or vice-versa, it’s not working??)

Dear Shubhi,

We tested two configurations.
First one is totally the same as described in How to use CAN on JETSON TX2? - #2 by spatra.
With TI sn65hvd230 tranceivers. In this case we don’t able send CAN packets and as a consequence receive them. Because, as i said before the TX oscillogram looks like


yellow - CAN0_TX, blue - CAN0_RX

The second configuration looks like

And oscillogram looks like in first pic from my first post. We can receive packets from our device. But can’t send any from Jetson to our device.

Kind regards,
Alexander

Hi,
Let’s talk about first case. So, you connected 2 transceivers. and trying to send data from can0 to can1. You are receiving data on can1 but not able to send? how is that possible, may be I am missing something in understanding the scenario. In this case, you are sending and receiving from Jetson only right?

No. In the first case i am NOT ABLE to send any and as a consequence NOT able to receive any. Not from CNA0 to CAN1 nor from CAN1 to CAN0. Because as you can see on oscillogram the TX signal is not looks like a valid CAN frame. It looks like some pulses. And in this case CAN bus immediately goes to BUS-OFF state.
The setup and wiring for the first case is completely the same as described in How to use CAN on JETSON TX2? - #2 by spatra.

Hi,
Can you give me the dump of can clock before you load mttcan and after mttcan is loaded?
cat /sys/kerne/debug/bpmp/debug/clk/can1/rate
cat /sys/kerne/debug/bpmp/debug/clk/can2/rate

Also, are there any error logs you are getting from kernel? Please paste those also.

Before mttcan is loaded
cat /sys/kerne/debug/bpmp/debug/clk/can1/rate
cat: /sys/kerne/debug/bpmp/debug/clk/can1/rate: No such file or directory
cat /sys/kerne/debug/bpmp/debug/clk/can2/rate
cat: /sys/kerne/debug/bpmp/debug/clk/can2/rate: No such file or directory

After with loaded mttcan
cat /sys/kerne/debug/bpmp/debug/clk/can1/rate
cat: /sys/kerne/debug/bpmp/debug/clk/can1/rate: No such file or directory
cat /sys/kerne/debug/bpmp/debug/clk/can2/rate
cat: /sys/kerne/debug/bpmp/debug/clk/can2/rate: No such file or director

log.txt (68.7 KB)

Hi Alex,
Sorry, typo error:
it’s kernel
cat /sys/kernel/debug/bpmp/debug/clk/can1/rate
cat /sys/kernel/debug/bpmp/debug/clk/can2/rate

Can you please try above command.

Before mttcan is loaded:
cat /sys/kernel/debug/bpmp/debug/clk/can1/rate
38400000
cat /sys/kernel/debug/bpmp/debug/clk/can2/rate
38400000

With loaded mttcan
cat /sys/kernel/debug/bpmp/debug/clk/can1/rate
40000000
cat /sys/kernel/debug/bpmp/debug/clk/can2/rate
40000000

The clocks looks right. And also the settings obtained with ip -d -s link show can0/1
also match with this clocks. If you will divide 40000000 to sum of the prop-seg 34 phase-seg1 35 phase-seg2 10
you will obtain 500 kbps.
tq also looks good. 25 ns multiplied by 80 is equal to 2 usec so it matches with 500 kbps baudrate too.

But the width of short pulses at CAN0_TX pin in this image https://global.discourse-cdn.com/nvidia/original/3X/0/4/044750cb6ba1c487a4431a6dbefe4992e9b9014f.jpeg is equal to 6 usec. And the large one is 46 usec. So looks like bit width is not equal 2 usec as it must.

Hi,
Yes clocks are fine.
Can you try controller loopback testing to check if transceiver is the issue. You need to disconnect transceiver.
Short CAN0_TX and CAN0_RX
ip link set can0 up type can bitrate 500000 loopback on
candump can0 &
cansend can0 123#abcdbacd
Check if you receive data.
Try same on CAN1.
Let me know the results.

cansend can0 123#abcdbacd
candump can0
can0 123 [4] AB CD BA CD
can0 123 [4] AB CD BA CD

cansend can1 123#abcdbacd
candump can1
can1 123 [4] AB CD BA CD
can1 123 [4] AB CD BA CD

Loopback works fine for both ports. And oscillogram also looks fine

So you think that problem with tranceivers? But why i can receive data form my device in this case?
I used TI sn65hvd230 for a very long time and never had problems with them.

I suspect issue with transceiver TX line.
You can also try loopback along with transceiver.
Do not short CAN0_RX and CAN0_TX instead connect transceiver and short it’s TX and RX and try same commands as above.

I just received TJA1051/3 transceivers. So will check with them.

I checked with TJA1051/3 and it is working.

So i even don’t have nothing to say about how that is possible?
That means that every team that have TI sn65 transceivers will not able to work with Jetson???

Because i am sure that my transceivers was not damaged and TX pin is working.

Are you checked before that your CAN bus is working with most common CAN transceivers like TI sn65hvd230 or AD LTC2875 or Maxim max3051?

Hi Alex,
I am not sure why it did not work with sn65 in your case. It’s not like it is incompatible with Jetson, many have used it and found working.

Thanks,
Shubhi

Dear Shubhi,

Thank you. Maybe later we will try with another sn65 transceivers.

Best regards,
Alexander