On 05/13/2011 04:22 AM, seedshope wrote: > Hi all, > > Add socketcan-users and avolkov in the loop. > > 1. Kernel version 2.6.39-rc7 > > 2.CAN utils: > libsocketcan-0.0.8.tar.gz > canutils-4.0.6.tar.bz2
The first choice are the ip tools from iproute2 and the can-utils from the BerliOS Socketcan-Respository: http://svn.berlios.de/viewvc/socketcan/trunk/can-utils/ > 3. Test step: > (1) Do a cable to connect two fsl_imx25pdk board through CAN BUS interface, > The RX pin for The CAN BUS of baord1 connect to The TX pin > for the board2. The TX pin for The CAN BUS of baord1 connect to The RX pin > for the board2. as following: CAN does not have RX and TX pins but CAN high and CAN low and you should connect high<->high (Pin 2<->2) and low<->low (Pin 7<->7) and maybe also ground (Pinn 3<->3). See also: http://www.interfacebus.com/Can_Bus_Connector_Pinout.html You *also* need proper 120 Ohm termination on *both* sides of the CAN bus cable. > (2) start can0 device > root@localhost:/root> ip link set can0 type can bitrate 500000 > root@localhost:/root> ifconfig can0 up > root@localhost:/root> ifconfig > can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00- > 00-00-00-00-00-00 > UP RUNNING 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:64 > RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) > > eth1 Link encap:Ethernet HWaddr 00:04:9F:00:F6:85 > inet addr:128.224.163.143 Bcast:128.224.163.255 > Mask:255.255.254.0 > inet6 addr: fe80::204:9fff:fe00:f685/64 Scope:Link > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:32699 errors:0 dropped:0 overruns:0 frame:0 > TX packets:13310 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:1000 > RX bytes:32742183 (31.2 MiB) TX bytes:2294256 (2.1 MiB) > Interrupt:192 > > 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:8 errors:0 dropped:0 overruns:0 frame:0 > TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:560 (560.0 b) TX bytes:560 (560.0 b) > > root@localhost:/root> > > (3) The first board run candump to receive data. > root@localhost:/usr/canutils/bin> ./candump can0 > interface = can0, family = 29, type = 3, proto = 1 Please use "candump -e any,0:0,#FFFFFFFF" to realize bus errors and state changes as well. > (4) The other board run cansend to send can data > root@localhost:/usr/canutils/bin> cat /proc/net/dev > Inter-| Receive | Transmit > face |bytes packets errs drop fifo frame compressed multicast|bytes > packets errs drop fifo colls carrier compressed > lo: 560 8 0 0 0 0 0 0 > 560 8 0 0 0 0 0 0 > can0: 0 0 0 0 0 0 0 0 > 90 14 0 0 0 0 0 0 > eth0: 0 0 0 0 0 0 0 0 > 1180 2 0 0 0 0 0 0 > eth1: 34574162 42679 0 0 0 0 0 10215 > 3002895 17229 0 0 0 0 0 0 The command "ip -d -s link show can0" provides more information. > root@localhost:/usr/canutils/bin> ./cansend can0 123#1122334455667788 > interface = can0, family = 29, type = 3, proto = 1 > > root@localhost:/usr/canutils/bin> cat /proc/net/dev > Inter-| Receive | Transmit > face |bytes packets errs drop fifo frame compressed multicast|bytes > packets errs drop fifo colls carrier compressed > lo: 560 8 0 0 0 0 0 0 > 560 8 0 0 0 0 0 0 > can0: 0 0 0 0 0 0 0 0 > 91 15 0 0 0 0 0 0 > eth0: 0 0 0 0 0 0 0 0 > 1180 2 0 0 0 0 0 0 > eth1: 34581833 42758 0 0 0 0 0 10250 > 3009673 17266 0 0 0 0 0 0 > root@localhost:/usr/canutils/bin> > >>From above information, The CAN data have already sent successful, But the > receive CAN data board have not any response. > Thanks to everyone who answered my question. Please check your cabling, first. Wolfgang. _______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users
