linux CANopenSocket 初试

/**************************************************************************************
 *                            linux CANopenSocket 初试
 * 说明:
 *     最近需要了解CANopen上的一些东西,于是找到这个资源来学一下,确实是个好东西。
 *                 
 *                                                  2016-8-12 深圳 南山平山村 曾剑锋
 *************************************************************************************/

一. 参考文档:
    https://github.com/CANopenNode/CANopenSocket

二. 测试一下: 
    1. 下载源码:
        1. git clone https://github.com/CANopenNode/CANopenSocket.git
        2. cd CANopenSocket
        3. git submodule init
        4. git submodule update
    2. 生成Linux虚拟设备:
        1. sudo modprobe vcan
        2. sudo ip link add dev vcan0 type vcan
        3. sudo ip link set up vcan0
    3. 安装can-utils,并运行candump:
        4. sudo apt-get install can-utils
        5. candump vcan0
    4. 另外开一个终端运行canopend:
        1. cd CANopenSocket/canopend
        2. make
        3. ./canopend --help
        4. ./canopend vcan0 -i 4 -s od4_storage -a od4_storage_auto

三. 输出结果:
    1. canopend输出:
        zengjf@zengjf:~/os/CANopenSocket/canopend/app$ ./canopend vcan0 -i 3 -c ""
        ./canopend - starting CANopen device with Node ID 3(0x03), count=1 ...
        ./canopend - communication reset ...
        ./canopend - Command interface on socket '/tmp/CO_command_socket' started ...
        ./canopend - running ...
        ^C./canopend on vcan0 (nodeId=0x03) - finished.
    2. candump获取的数据:
        zengjf@zengjf:~/os/CANopenSocket$ candump vcan0
          vcan0  704   [1]  00
          vcan0  084   [8]  00 50 01 2F F3 FF FF FF
          vcan0  704   [1]  7F
          vcan0  704   [1]  7F
          vcan0  704   [1]  7F
          vcan0  704   [1]  7F
          vcan0  704   [1]  7F
          vcan0  704   [1]  7F

 

posted on 2016-08-12 21:04  zengjf  阅读(4051)  评论(0编辑  收藏  举报

导航