码迷,mamicode.com
首页 > 系统相关 > 详细

zynq+linux+ramdisk can调试

时间:2018-02-13 13:34:12      阅读:420      评论:0      收藏:0      [点我收藏+]

标签:技术分享   分享   pos   opp   zynq   jpg   misc   ber   address   

由于采用ramdisk文件系统,自带的ip工具版本太旧无法配置can,需要自行编译ip,具体参见参考文献2

1.vivado配置ps

技术分享图片

技术分享图片

2.设备树增加can0,一般开发板均已提供此配置

can@e0008000 {
			compatible = "xlnx,zynq-can-1.0";
			status = "okay";
			clocks = <0x1 0x13 0x1 0x24>;
			clock-names = "can_clk", "pclk";
			reg = <0xe0008000 0x1000>;
			interrupts = <0x0 0x1c 0x4>;
			interrupt-parent = <0x3>;
			tx-fifo-depth = <0x40>;
			rx-fifo-depth = <0x40>;
		};

3.kernel配置,一般已配好,具体参见参考文献1

4.测试

# 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

eth0      Link encap:Ethernet  HWaddr 00:0A:35:00:01:22
          inet addr:192.168.0.120  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:397 errors:0 dropped:0 overruns:0 frame:0
          TX packets:242 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:476490 (465.3 KiB)  TX bytes:18536 (18.1 KiB)
          Interrupt:148 Base address:0xb000

lo        Link encap:Local Loopback
          LOOPBACK  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)

设置can0的波特率,这里设置的是100k
#./ip link set can0 type can bitrate100000
启用can0
#./ip link set can0 up
显示can0状态信息
#./ip -d -s link show can0

Z-turn# ./ip link set can0 type can bitrate 100000
xilinx_can e0008000.can can0: bitrate error 0.0%
Z-turn#./ip link set can0 up
Z-turn#./ip -d -s link show can0
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
    link/can  promiscuity 0
    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
          bitrate 99999 sample-point 0.750
          tq 2500 prop-seg 1 phase-seg1 1 phase-seg2 1 sjw 1
          xilinx_can: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..256 brp-inc 1
          clock 99999999
          re-started bus-errors arbit-lost error-warn error-pass bus-off
          0          0          0          0          0          0         numtxqueues 1 numrxqueues 1
    RX: bytes  packets  errors  dropped overrun mcast
    0          0        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    0          0        0       0       0       0

未完待续。。。

参考文献:

1.http://xilinx.eetrend.com/blog/12062

2.http://www.cnblogs.com/hujianhua/p/8446291.html

zynq+linux+ramdisk can调试

标签:技术分享   分享   pos   opp   zynq   jpg   misc   ber   address   

原文地址:https://www.cnblogs.com/hujianhua/p/8446344.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!