How_to_configure_and_use_CAN_bus

https://www.ridgerun.com/developer/wiki/index.php/How_to_configure_and_use_CAN_bus



Socket CAN utilities

The BerliOS Socket CAN package is an implementation of CAN protocols for Linux. It uses the Berkeley socket API, the Linux network stack and implements the CAN device drivers as network interfaces. In addition, the package provides user space utilities and test programs suggested as a reference for CAN interface evaluation and testing. The socketCAN package is available for downloading using SVN or HTTP protocols from the BerliOS Socket CAN SVN repository website.Download the package and compile can-utils directory using an appropriate cross-compiler. For information on cross tool-chain, please read Cross-Compiler chapter. After the build process is complete, copy the application binaries to the CM-T3517 file system (e.g. /usr/local/can-utils/).Use cansend and candump utilities to send and receive packets via CAN interface.

Send standard CAN frame (on the first device):

root@cm-debian:/# cd /usr/local/can-utils/
root@cm-debian:/usr/local/can-utils# ./cansend can0 111#1122334455667788
root@cm-debian:/usr/local/can-utils# 

Send extended CAN frame (on the first device):

root@cm-debian:/usr/local/can-utils# ./cansend can0 11111111#1122334455667788
root@cm-debian:/usr/local/can-utils# 

Dump all received data frames as well as error frames (on the second device):

root@cm-debian:/usr/local/can-utils# ./candump any,0:0,#FFFFFFFF
  can0  111  [8] 11 22 33 44 55 66 77 88
  can0  11111111  [8] 11 22 33 44 55 66 77 88

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值