Platform: Zynq-7010 Core: Linux3.14.52 Xilinx official website CAN Drive Related: http://www.wiki.xilinx.com/Linux+CAN+driver
1, the kernel open can bus: 1 into the kernel source top directory cd/opt/hzzd/linux/linux-xlnx-xilinx-v2014.2.01/2) make Arch=arm Cross_compile=arm-xili Nx-linux-gnueabi-menuconfig
3) Select "Networking Support"-> "Can bus subsystem support"-> "can device drivers"-> "Xilinx can", save exit;
2. Add in Device tree:
For Zynq Canps Dts file:zynq_can_0:can@e0008000 {compatible = "xlnx,zynq-can-1.0"; clocks = <&CLKC 19> <& AMP;CLKC 36>; Clock-names = "Can_clk", "PCLK"; Reg = <0xe0008000 0x1000>; Interrupts = <0 4>; Interrupt-parent = <&intc>; Tx-fifo-depth = <0x40>; Rx-fifo-depth = <0x40>; }; For Axi CAN Dts file:axi_can_0:axi-can@40000000 {compatible = "xlnx,axi-can-1.00.a"; clocks = <&clkc 0>, < &CLKC 1>; Clock-names = "Can_clk", "S_AXI_ACLK"; Reg = <0x40000000 0x10000>; Interrupt-parent = <&intc>; Interrupts = <0 1>; Tx-fifo-depth = <0x40>; Rx-fifo-depth = <0x40>; };
3, the above Xilinx website Download Test lib package, note the need to copy libsocketcan.so.2.2.0 to the target Board/lib folder, and establish a shortcut: Ln-s libsocketcan.so.2.2.0 Libsocketcan.so.2 4, write can socket transceiver test program Canapp 5, the following steps refer to the target board operation: root@hzzd:/mnt/zynq_canutils#./canconfig can0 Bitrate 200000 xilinx_can e0008000.can can0:bitrate error 0.0% can0 bitrate:199999, sample-point:0.750 ro ot@hzzd:/mnt/zynq_canutils#./canconfig can0 start Xiao ' s open can0 state:error-active ils# CD ... root@hzzd:/mnt#./canapp 1 2 can frame sent 0