Thursday, October 14, 2010

CAN-USB/2 start-up process

Reference:
../can-usb2/SocketCAN/socketcan-trunk-r1110/kernel/2.6/Documentation/networking/can.txt 6.5.3

Install SocketCAN plugin
% cd ~max/src/can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/
% make
% ./install.sh
% cd iproute2/iproute2-2.6.31
% make

Start CAN-USB/2
% cd ~max/src/can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/iproute2/iproute2-2.6.31/ip

Start device
% ./ip link set can0 up type can bitrate 250000 

Display device status-1
% ./ip -details -statistics link show can0

Display device status-2
% cd /sys/class/net/can0/statistics



Paths
/sys/class/net/can0

Documents
../can-usb2/SocketCAN/socketcan-trunk-r1110/kernel/2.6/Documentation/networking/can.txt

Device working status
#1
% cd /sys/class/net/can0
% cat operstate
#2
% ../can-usb2/SocketCAN/socketcan-trunk-r1110/test/canecho

Device properties
Reference:../can-usb2/SocketCAN/socketcan-trunk-r1110/kernel/2.6/Documentation/networking/can.txt 
Chapter6
% cd ~max/src/can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/iproute2/iproute2-2.6.31/ip/
% ./ip link set can0 type can tq 16 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
% ./ip link set can0 type can bitrate 250000
% ./ip -details -statistics link show can0
% ./ip -details link show can0

Device operation
Start CAN interface
% ../can-usb2/SocketCAN/socketcan-trunk-r1110/etc/can_if start

Device testing
% ../can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/cantest/cantest
% ../can-usb2/SocketCAN/socketcan-trunk-r1110/can-utils/cangen interface

Programming reference
% ../can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/doc

3 comments:

麥克斯 said...

+ Programming reference
~max/src/can-usb2/SocketCAN/socketcan-trunk-r1110/TODO

麥克斯 said...

Source:
http://svn.berlios.de/wsvn/socketcan/trunk/test/?#ac1fc86aa7d1e395a6af808545468aca3

麥克斯 said...

Update iproute2
http://linux.org/pub/linux/utils/net/iproute2