Advertisement
Guest User

Untitled

a guest
Feb 18th, 2014
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
  2. www.systec-electronic.com
  3.  
  4. 2012-03-08
  5.  
  6. SocketCAN Driver for USB-CANmodul series
  7. =========================================
  8.  
  9. Requirements
  10. -------------
  11.  
  12. * Linux Kernel version >= 2.6.32
  13.  
  14. * Following kernel options have to be set:
  15.  
  16. CONFIG_CAN=m
  17. CONFIG_CAN_RAW=m
  18. CONFIG_CAN_BCM=m
  19. CONFIG_CAN_DEV=m
  20. CONFIG_CAN_CALC_BITTIMING=y
  21.  
  22. * CAN utilities from the SocketCAN repository for first tests
  23.  
  24. $ git clone git://gitorious.org/linux-can/can-utils.git
  25. $ cd can-utils
  26. $ make
  27.  
  28. Old repository on berlios:
  29. $ svn checkout svn://svn.berlios.de/socketcan/trunk socketcan
  30. $ cd socketcan/can-utils
  31. $ make
  32.  
  33.  
  34. Limitations
  35. ------------
  36.  
  37. * Firmware version >=4.06 must be installed on USB-CANmodul.
  38. In case of an older firmware version, please connect the USB-CANmodul to a
  39. Windows PC with a recent driver version.
  40. * There is currently no way to read out or set the digital I/Os of the
  41. user port or the CAN port (signals EN, /STB, /ERR, /TRM).
  42. * No support for the obsolete modules GW-002 and GW-001.
  43. This is not planned at all.
  44.  
  45.  
  46. Build the driver
  47. -----------------
  48.  
  49. Run make within the source directory
  50.  
  51. $ cd systec_can
  52. $ make
  53.  
  54.  
  55. Load the driver from the local source directory
  56. ------------------------------------------------
  57.  
  58. 1. Load basic CAN drivers
  59.  
  60. $ sudo modprobe can_raw
  61. $ sudo modprobe can_dev
  62.  
  63. 2. Install firmware
  64.  
  65. $ sudo make firmware_install
  66.  
  67. 3. Load USB-CANmodul driver
  68.  
  69. $ sudo insmod systec_can.ko
  70.  
  71. - OR -
  72.  
  73. Install the driver and firmware system-wide
  74. --------------------------------------------
  75.  
  76. $ sudo make modules_install
  77. $ sudo make firmware_install
  78.  
  79. The kernel module should now be loaded automatically by udev
  80. when the device is connected.
  81.  
  82.  
  83. Run basic tests
  84. ----------------
  85.  
  86. 1. Connect the USB-CANmodul to the PC
  87.  
  88. 2. Set up bitrate and start up the CAN interface
  89.  
  90. $ ip link set can0 type can bitrate 125000
  91. - OR if CONFIG_CAN_CALC_BITTIMING is undefined -
  92. $ ip link set can0 type can tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2
  93.  
  94. $ ifconfig can0 up
  95.  
  96. 3. Dump the traffic on the CAN bus
  97.  
  98. $ cd can-utils
  99. $ ./candump can0
  100.  
  101. to display error frames (option -e is supported in newer candump versions only):
  102.  
  103. $ ./candump -e can0,0:0,#FFFFFFFF
  104.  
  105. 4. Transmit one CAN frame
  106.  
  107. $ cd can-utils
  108. $ ./cangen -n 1 -I 640 -L 8 -D 4000100000000000 can0
  109.  
  110. 5. Print out some statistics
  111.  
  112. $ ip -details -statistics link show can0
  113.  
  114. 6. Restart CAN channel in case of bus-off (i.e. short circuit)
  115.  
  116. $ ip link set can0 type can restart
  117.  
  118.  
  119. Hardware address
  120. -----------------
  121.  
  122. The hardware address (like the MAC address of Ethernet controllers)
  123. of each CAN channel as shown with
  124. `ip link show can0` or `ifconfig can0` is formed the following way:
  125.  
  126. S0:S1:S2:S3:DN:CN
  127.  
  128. Sx - Serial Number in Hex with S0 contains the most significant byte
  129. DN - Device Number
  130. CN - Channel Number (00 - CAN1, 01 - CAN2)
  131.  
  132. The unique hardware address can be used by a special udev rule to
  133. assign stable interface names and numbers.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement