CANopenSocket 测试

本文档详细介绍了CANopenSocket的测试过程与效果,包括设置波特率、启动CAN设备、发送测试数据等步骤,并记录了在atmel9260平台上使用Linux SocketCAN和MCP2515进行CAN总线调试的经验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/*************************************************************************
 *                       CANopenSocket 测试
 * 说明:
 *     测试一下CANopenSocket的运行效果,效果还是不错的。
 *
 *                                     2017-3-23 深圳 南山平山村 曾剑锋
 ************************************************************************/

一、参考文档:
    1. atmel9260上linux socketcan MCP2515调试笔记即CAN总线调试总结
        http://velep.com/archives/348.html

二、遇到问题:
    1. write: No buffer space available
        echo 1000 > /sys/class/net/can0/tx_queue_len

三、测试步骤:
    1. 设置波特率:
        ip link set can0 type can bitrate 1000000 triple-sampling on
    2. up can设备:
        ifconfig can0 up 
    3. 测试数据发送:
        cansend can0 111#1122334455667788
    4. 测试canopend:
        [zengjf@root ~]#  ./canopend can0 -i 4 -c /tmp/CO_command_socket &
        ./canopend - starting CANopen device with Node ID 4(0x04), count=1 ...
        ./canopend - communication reset ...
        ./canopend - Command interface on socket '/tmp/CO_command_socket' started ...
        ./canopend - running ...
    5. 测试canopencomm命令:
        ./canopencomm 4 stop                             # [1] OK
    6. 测试index为1的设备心跳包:
        ./canopencomm [1] 1 write 0x1017 0 i16 5000      # [1] OK
    7. 以上需要一个普通的无协议的设备来观察CAN总线上的数据。

 

转载于:https://www.cnblogs.com/zengjfgit/p/6606651.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值