Linux can drive and test summary __linux

Source: Internet
Author: User
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 = &LT;&AMP;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>, < &AMP;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.