can-utils接口测试方法

转载地址:http://www.embedsky.com/index.php?g=home&m=news&a=show&id=62

CAN(Controller Area Network)是ISO国际标准化的串行通信协议。广泛应用于汽车、船舶等。具有已经被大家认可的高性能和可靠性。CAN已经成为全球范围内最重要的总线之一 —— 甚至领导着串行总线。TQi.MX6UL开发板平台有2路CAN接口,具体测试方法如下:

1. 配置:

配置使用ip(route2)工具。

注意:busybox 里也有集成了ip 工具,但busybox 里的是阉割版本。不支持can 的操作。故使用

前请先确定ip 命令的版本:

# ip -Vip utility, iproute2-ss160314

以下是配置的命令

ifconfig can0 downip link set can0 type can bitrate 100000 triple-sampling onip link set can0 up

2.接收:

candump can0 

3. 发送:

cansend can0 123#DEADBEEF 

短接can0 与can1 的H 与L 以下是测试过程:

# ifconfig can0 down# ip link set can0 type can bitrate 1000000 triple-sampling on# ifconfig can0 upflexcan 2090000.can can0: writing ctrl=0x012320d4# ifconfig can1 down# ip link set can1 type can bitrate 1000000 triple-sampling on# ifconfig can1 upflexcan 2094000.can can1: writing ctrl=0x012320d4# candump can1& #监听can1# cansend can0 111#1122334455667788 #can0 发送数据can1 111 [8] 11 22 33 44 55 66 77 88 #can1 接收到的数据
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值