Getting CAN interface working

Hello,

I am trying to connect the IMU_CAN interface and run ./sample_can_interpreter using a real CAN device. I am running into problem when trying to interface CAN bus on linux with slcand. Candump doesn’t print any data.

I did two experiments with two different transceiver and the issue persisted, while on RaspberryPi it seems to be working alright with PyCAN board and same IMU device.

Experiment 1:
I used CANalyst-ii transciver which is USB-CAN. Usb connecting to the host. This device doesn’t have documentation to work with linux but from other online resources (mainly this link: CANalyst II - dankwiki, the wiki of nick black) I got to the point where I can see slcan0 when in ifconfig.

slcan0: flags=193<UP,RUNNING,NOARP>  mtu 16
        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 1
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

When i do candump slcan0, i see the cursor blinking and not printing anything. Maybe this is a bit rate issue. CAN device baudrate is 250000.
I used following commands to get this far,

sudo modprobe can

sudo modprobe can-raw

sudo modprobe slcan

sudo modprobe usbserial vendor=0x04d8 product=0x0053

sudo slcand -o -s5 -t hw -S 2500000 /dev/ttyUSB0

sudo ip link set up slcan0

 ./candump slcan0

Experiment 2:
I am using CANUSB tool (LAWICEL CANUSB | canusb.com) and get that to work with slcan0 (using these steps: All miscellanous tech articles: Step-by-step guide: Installing the Lawicel CANUSB adapter on Linux) and same problem, don’t see any data on candump slcan0. output of ip addr is as follows:
4: slcan0: <NOARP,UP,LOWER_UP> mtu 16 disc fq_codel state UNKNOWN group default qlen10
link/can

Maybe this is not the right thread to post this but clearly you guys know more than I do, so I thought posting here might help.

Thanks in advence.

Regrds,
Rishit

HI Rishit,

May I know which Jetson platform and JetPack version you’re using?

I am not using Jetson board. I am using Linux Host PC with Ubuntu 18.4 LTS with T1000 gpu. Working with Driveworks2.2. If that helps.

Thanks for the reply.

Regards,
Rishit

Moving to DRIVE platform forum for the resolution.

Hello @rborad,

can you please provide the following information:
Hardware Platform: [Example: DRIVE AGX Xavier™ Developer Kit, DRIVE AGX Pegasus™ Developer Kit]
Software Version: [Example: DRIVE Software 10,]
Host Machine Version: [Example: native Ubuntu 18.04]
SDK Manager Version: [Example: 1.0.1.5538]

and also please elaborate on what part of DriveWorks documentation are you trying to follow that fails?

thanks

Thank you for replying.

Hardware Platform: Developing External sensor plugin on the host machine. Will be tested on Xavier
Software Version: Drive Software 2.2
Host Machine Version: Ubuntu 18.04.4 LTS (Bionic Beaver)
SDK Manager Version: 1.1.0.6343

I am trying to follow run CAN interpret sample through real CAN interface can0. using this webpage in Nvidia documentation: …/DRIVE_SW_10/DRIVE_Software/DRIVE_AV_doxy_files/dwx_canbus_message_sample.html

I am able to run the sample_can_interpreter using virtual can. I am trying to setup SocketCAN slcan0 and I am facing this issue.

Let me know if you need more information.

Regards,
Rishit

Hello @rborad,

  • I guess you are referring to Drive Software 10, right?

  • To make sure the problem is clear, you are not able to receive any CAN bus traffic for your CAN device (IMU) on your host (either through candump nor a CANUSB tool you found) regardless of DriveWorks, right?

  • Have you tried executing the sample? what was the execution command you used?

  • regarding:

does your USB-CAN have a SocketCAN driver that is installed in the system?

  • regarding:

can you please elaborate more on this?

  • have you testes that your USB-CAN device is working in another way? have you tested another converter (for example a PCAN USB SocketCAN device)?

Yes sorry I should have been more clear.

Yes it has not to do with the Driveworks, its my can driver not behaving right. I am just trying to run sample_can_logger/interpreter on my Host PC using real CAN device.
Just to be clear CANUSB is a USB-CAN transceiver that appear as ttyUSB0 on my machine and I am binding that to slcan0 socket. Once binded and changed the state to UP, I run candump on slcan0 socket and should see traffic. And that’s my problem, I don’t see the traffic.

Yes, I ran sample_can_interpreter with the pre-logged sample data as well as VirtualCan by creating virtual can interface and sending data through cansend. I even used my own .dbc file to parse the CAN data in same sample. I followed the steps on this doc …/DRIVE_SW_10/DRIVE_Software/DRIVE_AV_doxy_files/dwx_canbus_message_sample.html.
I ran following examples

  1. offline CAN messages,
  2. DBC Interpreter,
  3. Virtual CAN Bus on Linux and
  4. Virtual CAN Bus on Linux with my own DBC file.

Command used :./sample_canbus_interpreter --driver=can.socket --dbc=/home/aceinna/Documents/MTLT305D.dbc --params=device=vcan0

I am unsure of the term installing SocketCAN driver for USB-CAN but if you are talking about the process I mentioned in the question above in Experiment1, yes I am installing SocketCAN for USB-CAN
by using sudo slcand -o -c -f -s5 /dev/ttyUSB0 slcan0 and sudo ifconfig slcan0 up commands.

PyCAN board is a CAN transceiver board that sits on top of raspberryPi and connect my device through CAN interface, provides Native CAN interface. Uses similar concept as SocketCAN, create an IP link and runs using candump. This experiment just shows that my device is working alright.

As I mentioned in this response, I am trying two different CAN transceivers (CANalyst-ii & CANUSB) I tried running CANalyst-ii on windows and I can see the bus traffic. I haven’t tried CANUSB on windows yet, I will do that next just to make sure.

One observation:
This is the syslog after I try to bind the socket and there is one problem, no ifupdown configuration found (last line)

May 26 10:15:57 username slcand[3923]: starting on TTY device /dev/ttyUSB0
May 26 10:15:57 username slcand[3923]: attached TTY /dev/ttyUSB0 to netdevice slcan0
May 26 10:15:57 username slcand[3923]: netdevice O#015 renamed to slcan0
May 26 10:15:57 username NetworkManager[1543]: <info>  [1590513357.4839] manager: (slcan0): new Generic device (/org/freedesktop/NetworkManager/Devices/4)
May 26 10:15:57 username systemd-udevd[3925]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
May 26 10:15:57 username NetworkManager[1543]: <info>  [1590513357.4957] devices added (path: /sys/devices/virtual/net/slcan0, iface: slcan0)
May 26 10:15:57 username NetworkManager[1543]: <info>  [1590513357.4958] device added (path: /sys/devices/virtual/net/slcan0, iface: slcan0): no ifupdown configuration found.

I am looking for pointers on where to look for the solution. My problem has to do with Linux CAN configuration I think and I am new to this. I really appreciate you taking out time to help me solve this problem.

Hi @rborad,

Please take a look at this post about our PCAN USB to SocketCAN testing to see if it helps on yours.

Thank you for the reply @VickNV.

I found the solution at least for one CAN Transceiver I was trying to work with. Dint check the other one. The problem was CAN termination resistor. I needed to enable the resistor in my CAN device. Once the termination resistor was on it was very simple to setup can using this link I share in my question.

Thank you @shayNV and @VickNV for the reply and taking time. I really appreciate it. You can close this now.

Thanks for letting us know! :)