UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Participant btsavage
Participant
7,552 Views
Registered: ‎11-09-2015

CAN on Zynq running Linux

Attempting to implement CAN bus on the Zynq (ZC706 Evaluation board) running Ubuntu.  The OS recognizes the CAN devices. but I can not enable them or set the bitrate.  I have a test application that creates and binds a socket type connection, which succeeds, but when I attempt to write to the connection, the error returned is  errno 100 "Network is down".

 

Any advice on getting the CAN interface working???

 

Thanks

 

root@zynq:~/test# ifconfig -a
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:22

can1      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:23

eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:01:22
          inet addr:192.168.1.100  Bcast:192.168.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3802 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1209 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5157320 (4.9 MiB)  TX bytes:179862 (175.6 KiB)
          Interrupt:149 Base address:0xb000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

root@zynq:~/test#
root@zynq:~/test# ip link set can0 type can bitrate 125000
ip: either "dev" is duplicate, or "type" is garbage
root@zynq:~/test# ^C
root@zynq:~/test# ip link set can0 up
xilinx_can e0008000.can can0: bit-timing not yet defined
ip: SIOCSIFFLAGS: Invalid argument
root@zynq:~/test# ip link set can1 type can bitrate 125000
ip: either "dev" is duplicate, or "type" is garbage
root@zynq:~/test# ip link set can1 up
xilinx_can e0009000.can can1: bit-timing not yet defined
ip: SIOCSIFFLAGS: Invalid argument
root@zynq:~/test#

0 Kudos
5 Replies
Community Manager
Community Manager
7,540 Views
Registered: ‎07-23-2012

Re: CAN on Zynq running Linux

See if http://www.wiki.xilinx.com/Linux+CAN+driver will be of some help.
-----------------------------------------------------------------------------------------------
Please mark the post as "Accept as solution" if the information provided answers your query/resolves your issue.

Give Kudos to a post which you think is helpful.
0 Kudos
Participant btsavage
Participant
7,534 Views
Registered: ‎11-09-2015

Re: CAN on Zynq running Linux

After some hacking around, I was able to get it to kindof work.  I ran the canconfig utility that is referenced in the tutorial above.  I had to set LD_LIBRARY_PATH to a local directory.  I was then able to set the bitrate and enable the CAN device. 

 

My environment has some restrictions on the use of shared libraries.  So, I took the libsocketcan.a file from the tar file, along with the header files and tried to compile it into my application.  The linker is failing with unresolved externals, for example can_do_start().

 

How can I build this into my application? 

0 Kudos
Participant btsavage
Participant
7,528 Views
Registered: ‎11-09-2015

Re: CAN on Zynq running Linux

The kernel was built from the xilinx github repository, tag 2015.3.  From the information I can find, it appears that this includes busybox and does not include iproute2?  So, all of the Xilinx tutorials that indicate the use of the ip command do not apply to this kernel?

0 Kudos
Participant btsavage
Participant
7,498 Views
Registered: ‎11-09-2015

Re: CAN on Zynq running Linux

I was able to debug the PL and found that when I run my test application which sits in a loop and writes a fixed message to can0 every second, that only the first message is written to the can controller.  Any advise? 

0 Kudos
Newbie clarkzhu
Newbie
1,240 Views
Registered: ‎03-20-2018

Re: CAN on Zynq running Linux

Has been solved this problem? I get this problem agin!
0 Kudos