cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
5,085 Views
Registered: ‎01-18-2011

can4linux problem

Hey,

 

I want to use the CAN bus of zynq . To do that, I am using can4linux but when the module is installed into the OS, I can't activate the CAN interface (ifconfig can0 up). I think that the module is installed properly due to the CAN interface is configured into the next directories(proc/sys/dev/Can/*) (dev/can0) (/dev/can1).

 

Also, I read that to use the CAN bus, gpio9 must be 0. Is that true?

 

Someone has executed the can4linux examples (baud, can_send,etc) into zynq board successfully??And in this case. Can you tell me what I have to do for use the can4linux module properly?

 

Thanks.

 

Regards.

 

Asier

0 Kudos
5 Replies
Highlighted
Scholar
Scholar
5,072 Views
Registered: ‎05-28-2013

Hi alurrucea,

 

There are two ways to interact with CAN bus under linux:

  1. The can4linux driver (which provides char device access via /dev/can0), and
  2. The socketcan interface (which provides a network device, ifconfig can0 ...).

At this time, can4linux supports Zynq, while socketcan does not appear to. If anyone is working on sockcan for Zynq please let us know!

 

On the ZC702 board (I can't speak for others) yes you must set GPIO 9 to an output (it defaults to value 0) in order to enable the CAN transceiver. See the discussion here: http://sourceforge.net/p/can4linux/discussion/1013311/thread/07dd52cf/?limit=25

 

The example programs that come with can4linux can be compiled and used for testing. Baud rate setting depends on having the right clock defined in Planahead (see previous link). Then the actual bitrate can be set with:

 

echo 1000 1000 > /proc/sys/dev/Can/Baud

 

Regards,

-Ralph

0 Kudos
Highlighted
Adventurer
Adventurer
5,066 Views
Registered: ‎05-01-2012

I am using socketcan on the Zynq, and while I have the driver installed, I believe the only reason it isn't fully working is because I don't have iproute2 cross compiled for the Zynq, so I can't bring up the interface with the correct bittiming.  Other than that, I believe it should work.

0 Kudos
Scholar
Scholar
5,059 Views
Registered: ‎05-28-2013

That's very interesting... can you post (or PM/email to me) your kernel .config file, at least the CONFIG_CAN and CAN_ related portions? I don't see any Zynq-specific driver under drivers/net/can, and the can4linux driver does not support netlink. So I'm curious how it works...

0 Kudos
Highlighted
Adventurer
Adventurer
5,056 Views
Registered: ‎05-01-2012

I started with the at91_can.c driver and modified that with the sample code from Xilinx for a bare metal application.  Then you just add an entry in the Kconfig and Makefile files in drivers/net/can and enable CAN at the top level.  I just made my new item depend on CAN && ARCH_ZYNQ.

0 Kudos
Highlighted
Newbie
Newbie
4,903 Views
Registered: ‎07-26-2013

Could you post the code you have for the socketcan driver?  I would be very interested in looking at it.

 

Cheers.

0 Kudos