设置CAN波特率时出现问题

来源:互联网 发布:化学编辑软件 编辑:程序博客网 时间:2024/06/14 10:08

参考方案:http://velep.com/archives/1186.html

http://blog.csdn.net/lizhu_csdn/article/details/51490958  

1)can0未启动,启动CAN0接口:
               # ifconfig can0 up
               ifconfig: SIOCSIFFLAGS: Invalid argument
           不能启动,且DEBUG串口中打印如下错误信息。这两条信息应该是linux内核打印出来的错误信息

               mcp251x spi1.0: bit-timing not yet defined
               mcp251x spi1.0: unable to set initial baudrate!
          2)但是使用IP命令后,出现如下信息:
               # ip link set can0 type can bitrate 125000(或者# /sbin/ip link set can0 type can bitrate 125000
               ip: either “dev” is duplicate, or “type” is garbage
          3)查看ip文件存放的位置:
               #which ip
               /sbin/ip 不是/bin/ip
          4)解决方案,复制一份完整的可以设置的ip文件到sbin目录下,即可正常使用。不需要使用libsocketcan重新编写程序。