CAN communication Issue

I have made the CAN communication on the CAN0 and CAN1. I followed the instructions provided on the below link.
https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/HR/ControllerAreaNetworkCan.html?highlight=can%20bus#important-features
I am able to perform the loopback test on CAN1 and separately for CAN0. When I connect a motor on CAN0 and connect it using the transceiver using the CAN Hi and CAN Low, I am unable to send the signal to the motor. The motor’s can ID is 38. i type the can command
cansend can0 038#0000018000000000

This signal does not go to the motor and the packet does not show up in ifconfig either

Hi ssivakumar,

When you refer to the instruction to do loopback test, it is internal loopback test which means you don’t need to connect any cable.
When you want to connect to a CAN device (like your motor), you need a CAN transceiver to transform CAN-TX/CAN-RX to CAN-H/CAN-L signal.

Which CAN transceiver are you using?
Could you also share your block diagram of the connections?

Hello KevinFFF,

I have used the transceiver https://www.amazon.com/SN65HVD230-CAN-Board-Communication-Development/dp/B00KM6XMXO - Waveshare SN65 mentioned on the CAN link on the NVIDIA page. The block diagram for my connection is the same as the one mentioned on the CAN page here (Controller Area Network (CAN) — Jetson Linux<br/>Developer Guide 34.1 documentation).
image

it posses the first part of controller (image AON CAN0 controller) → transceiver(Waveshare SN65) → (through CAN Hi CAN Low connections and CAN_TX CAN_RX) → Motor controller (Image it is shown as AON CAN1 Controller and CAN transceiver)

What is your carrier board for Orin NX?
It seems only CAN0 available on Orin Nano devkit board (p3768).
Are you using the custom carrier board?
What’s your Jetpack version in use?

Are you sure there’s CAN transceiver included in your motor?
Could your motor send some packet and you could receive them from the board?

It’s not a Jetson NX but a Jetson AGX Orin. NVIDIA forum did not allow me to include that. I have the latest jetpack version whose details, if required I can provide in the next message.

And yes, I am sure there’s a transceiver in the motor I have. I believe the transceiver’s function here to be converting TX RX signals to CAN_Hi CAN_Lo signals. The motor already has got only CAN_Hi and CAN_Lo wires by default. And with ifcoconfig results, the connections seems to be established. The result for ip -details -statistic link show can0 also doesnt show any connection error.

Your transceiver board is garbage. Sorry.

  1. Your board only has screw terminals for CAN_H and CAN_L. This is not enough. You also need to connect GND in order to ensure not exceeding the common voltage range. The receiver in the transceiver chip subtracts CAN_L from CAN_H in order to get the value. This only works if both signals are in a certain range with respect to local GND. CAN_H=4V and CAN_L=2V gives dV=2V and works. CAN_H=30V and CAN_L=28V also gives dV=2V, but since the voltages are outside auf the allowed absolute voltage range with respect to the local CAN Transceiver GND, receiving will fail, and the bus lines might get killed. You ABSOLUTELY MUST have a board that has a third terminal with GND.

  2. This is a 3.3V only transceiver. CAN however is a 5V standard. In recessive state (1) CAN_H=CAN_L=2.5V. In dominant state (0) CAN_H=3.5V and CAN_L=1.5V. However, if the transceiver only as 3.3V available it can’t output 3.5V for CAN_H, but only 3.0V These transceivers use CAN_L=1V so the difference is still 2V. Works for most of the time but does not conform to the Bosch ISO-11898-2 standard.

There are many transceiver that take 5.0V on pin 3 for the line drivers for standard bus voltage levels, bus also have a separate Vio input on pin 5 as logic supply for interfacing with 3.3V logic. These transceivers are preferred if there is 5V supply available.

Then watch for proper bus wiring and termination and note that there are also minimum cable lengths.

Oh, all right, it was mentioned on the NVIDIA page so I got it. Do you have any suggestions for a better transceiver?

And for now, my issue seems to be the fact that I am able to recognize the CAN network, but it is not sending any message over the network. I dont know if this is just for the loopback test but I expected that when I send a message using cansend it would print the message similar to the following example

can0 123 [4] AB CD AB CD
can0 123 [4] AB CD AB CD

but it did not with my motor commands. I am wondering if it could be because I sent maybe to the wrong CAN ID. I am trying to send to the CAN ID 38.

Transceiver Suggestion: MCP2558FD

Does your motor need CAN 2.0A (11 bit ID) or CAN 2.0B (29 bit ID)? ID 038 hex (000 0011 1000) and ID 00000038 hex (0 0000 0000 0000 0000 0000 0011 1000) are different IDs.

fchk

1 Like

I am sending the messages using Linux terminal commands and for that 3 bit CAN ID’s are enough I believe. I was using 038 I was just told by the motor company to try 226?

CAN doesn’t work this way. If the motor expects 11 bit ids, you MUST send 11 bit ids (3 hex digits). If the motor expects 29 bit ids you MUST send 29 bit IDs (8 hex digits), even if the numeric id value would also fit into 11 bits. Length is important here.

I am sorry for the wrong info. I am new to CAN and I am trying with information that the motor company provided.

I believe the motor is expecting a 11 bit ID as you say then. In the motor setting, I have set the motor CAN ID as 38.

This is what I have done till now. From the examples, I am supposed to set the can kernel drivers, make the connection send on the terminal the following commands:
ip link set can0 up type can bitrate 500000 → this is to set the can bit rate I beleive
cansend can0 038#0000000000000000 → here I was using 038 as the Can ID and the 16 zeroes are the message to be sent

How should I edit the command or make additions? when I check ifconfig or ip -details -statistic link show can0 it shows the CAN to be connected

and they asked me to send 226h if it makes any difference

If the motor expect 11 bit ids, then 038 hex is correct. You should verifiy this with the motor vendor.

You could use a logic analyzer to capture the can frames on the CAN_RX pin. A cheap 24 MHz/8 ch device from Amazon should do the job.

If the motor has received your packet successfully it should overwrite the ACK bit with a 0. Your should see this in the logic analyzer app. Otherwise the Orin’s CAN controller will retry the transmission and go into an error state. You should see error frames on the LA then. Things can get messy at this point.

I have overcome that error now @KevinFFF @fchkjwlsq . I hadn’t assigned the addres for the pins and after assigning them with 0x458 and 0x400, I dont see that issue anymore. Now I am facing a new error. Once I start the CAN connection with my motor, I send a message to the motor. it is not able to do candump or when I send cansend 000#0126 a built in motor message, the bus turns off
this is a curtis controller if you have worked with it

Do you mean that you could send the CAN packet to your motor successfully after configuring the pinmux register for CAN pins correctly?

What do you mean about “not able to”?

Does this command no need to specify which CAN interface to be used as following?

$ cansend can0 000#0126

Could you share the result of the following command at this moment?

sudo ip -d -s link show can0

I have configured the pinmux correctly, but no, I am not able to send any packets to or receive any packets properly from the CAN pins.

When I try candump I don’t get any messages from the motor. The motor is supposed to send a message every 100ms.

I apologize, yes it does need and I did send it as above. and when i send it status shows as off. in the next reply, I will post the output I get

I have an update.

I usually could communicate between the two Jetson I have by connecting the TX RX CAN0 pins of the two. I introduced the SN65 board in between, by connecting the SN65 transceiver board on each of the Jetson and trying to communicate between the two Jetson, and now I am not able to send any commands.

@KevinFFF if you have one available, could you please provide me with the steps or the link to the page for communicating using a CAN transceiver, specifically SN65 board since I am new to this.

0: can1: <NO-CARRIER,NOARP,UP,ECHO> mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 10
link/can promiscuity 0 minmtu 0 maxmtu 0
can state BUS-OFF (berr-counter tx 248 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
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 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 0 0 0

This is what I usually get though this error is for a different scenario

You may need some CAN Basics:

You may want to take the e-learning course.

  • Make sure to connect GND between all devices on the bus.
  • Use an oscilloscope to verify bus levels (2.5V on CAN_H and CAN_L for a silent bus)
  • Verifiy termination (120 ohm at each end). no star topology allowed, only a single chain.
  • Use a logic analyzer to decode the frames and verfify that the connect data is send and acknowdged.

fchk