zoukankan      html  css  js  c++  java
  • canutils上板测试问题记录

    ltp-ddt运行can_loopback时出错

    pan(1881): Must supply a file collection or a command

    原因runtest/ddt/can_loopback

    CAN_S_FUNC_LOOPBACK_CAN0_1000000前多了一个空格

    还要进行以下改动:

    将do_cmd "cansequence -p $interface &"; suspend -i 10 -p "mem";改为

    do_cmd "cansequence -p $interface &"; do_cmd "sleep 10";

    suspend是ltp-ddt中的涉及电源管理的函数,执行会出错,类似rtc0有问题之类。

     

    ltp-ddt运行can_loopback时出错

    canconfig: error while loading shared libraries: libsocketcan.so.2: cannot open shared object file: No such file or directory

    类似:

    error while loading shared libraries: libgsl.so.0: cannot open shared object file: No such file or directory

     

     解决方法如下:

     

    First, you need to locate the file (libgsl.so.0). You can do this, for example, by using the find command:

    sudo find / -name "libgsl.so.0"
    

    Let us assume, the file is located in /usr/local/lib. (If the file has not been found, install the corresponding package or download the source, build it and install it.) Now, you have two options:

    (1) Quick & Dirty:

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    export LD_LIBRARY_PATH
    

    This adds the path of the library to an environment variable. The disadvantage of this option is, that it is only valid for the current session. It will not work for other users. It will not work once you log off and on again.

    (2) Permanent:

    Review your /etc/ld.so.conf. If /usr/local/lib is not listed there, add it. Now, run ldconfig to detect the shared object file and add it to some system-wide index.

     

    candump -d $interface #-d守护进程

    cansequence -p $interface & #后台运行

     

    source 'functions.sh';
    interface='can0';
    bitrate=1000000;
    do_cmd "do_can_loopback.sh -i  $interface -b $bitrate";
    init_txf=`get_can_stats.sh -s 'TXF'`;
    init_rxf=`get_can_stats.sh -s 'RXF'`;
    do_cmd "candump -d $interface";
    do_cmd "cansequence -p $interface &"; do_cmd "sleep 10";
    prefinal_txf=`get_can_stats.sh -s 'TXF'`;
    prefinal_rxf=`get_can_stats.sh -s 'RXF'`;
    do_cmd "sleep 20";
    final_txf=`get_can_stats.sh -s 'TXF'`;
    final_rxf=`get_can_stats.sh -s 'RXF'`;
    do_cmd "killall candump";
    do_cmd "killall cansequence";
    do_cmd "ip link set $interface down";
    echo "TX init=$init_txf, prefinal=$prefinal_txf, final=$final_txf";
    echo "RX init=$init_rxf, prefinal=$prefinal_rxf, final=$final_rxf";
    if [ "$final_rxf" -gt "$prefinal_rxf" ] && [ "$prefinal_rxf" -gt "$init_rxf" ] && [ "$final_txf" -gt "$prefinal_txf" ] && [ "$prefinal_txf" -gt "$init_txf" ];
    then exit 0;
    else exit 1;
    fi

    需要将canutils的路径加入PATH

    PATH=/usr/sbin/out_canutils/bin:/usr/sbin/out_canutils/sbin:$PATH

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/sbin/lib_libsocketcan

    export LD_LIBRARY_PATH

     

    get_can_stats.sh通过cat /proc/net/can/stats 读取can收发数据包的数量

    发现RX是TX的两倍(loopback时候)

    ifconfig -a 是正常的。

    貌似ifconfig -a是通过sys目录下的信息得到数据的。

    # cat /sys/class/net/can0/statistics/tx_packets

  • 相关阅读:
    Java第四章课后整理
    java第三章课后作业1
    Java第三章整理
    JAVA第二章课后作业
    JAVA第二章整理
    java课后作业1
    JAVA第一章整理实验
    JAVA大道至简第一章伪代码
    文本数据特征选取的四种方法
    时域分析与频率分析的比较
  • 原文地址:https://www.cnblogs.com/idyllcheung/p/10647342.html
Copyright © 2011-2022 走看看