can总线配置

来源:互联网 发布:onavo mac版 编辑:程序博客网 时间:2024/04/30 21:45

CAN

总线配置

Linux

系统中,

CAN

总线接口

备作为网络

系统进行统一

理。在控制

台下

, 

CAN

总线

的配置和以

网的配置使用相

命令

在控制

上输

入命令:

ifconfig –a 

可以得到以下结果:

can0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 

        NOARP  MTU:16  Metric:1 

        RX packets:0 errors:0 dropped:0 overruns:0 frame:0 

        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 

        collisions:0 txqueuelen:10  

        RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)         Interrupt:18  

 eth0   Link encap:Ethernet  HWaddr 00:50:c2:22:3b:0e   

        UP BROADCAST MULTICAST  MTU:1500  Metric:1 

        RX packets:0 errors:0 dropped:0 overruns:0 frame:0 

        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 

        collisions:0 txqueuelen:1000  

        RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B) 

 eth1   Link encap:Ethernet  HWaddr 00:50:c2:22:3b:60   

        UP BROADCAST MULTICAST  MTU:1500  Metric:1 

        RX packets:0 errors:0 dropped:0 overruns:0 frame:0 

        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 

        collisions:0 txqueuelen:1000  

        RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B) 

        Interrupt:41 Base address:0xe000   lo     Link encap:Local Loopback   

 inet addr:127.0.0.1  Mask:255.0.0.0  inet6 addr: ::1/128 Scope:Host 

 UP LOOPBACK RUNNING  MTU:16436  Metric:1 

 RX packets:256 errors:0 dropped:0 overruns:0 frame:0 

 TX packets:256 errors:0 dropped:0 overruns:0 carrier:0 

 collisions:0 txqueuelen:0   RX bytes:19952 (19.9 KB)  TX bytes:19952 (19.9 KB) 

 

在上面的

结果

中,

eth0

eth1

备为以

网接口,

can0

备为

CAN

总线接口。接

来使用

ip

来配置

CAN

总线的位速

率:

ip link set can0 type cantq 125 prop-seg 6phase-seg1 7 phase-seg2 2 sjw 1 

可以使用

ip

命令直

定位速

率:

ip link set can0 type can bitrate 125000 

成后,可以通过

面的

命令查询

can0

备的

ip -details link show can0 

成后,可以使用

面的

命令

使能

can0

ifconfig can0 up 

使用

面的

命令取消

can0

备使能

ifconfig can0 down 


0 0
原创粉丝点击