05-28-2013 12:09 AM
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?
05-28-2013 07:53 AM
There are two ways to interact with CAN bus under linux:
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
05-29-2013 10:37 AM
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.
05-29-2013 12:42 PM
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...
05-29-2013 01:41 PM
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.