TT3201 CAN Cape User's Manual
Prerequisites
A good knowledge of Linux and SocketCAN is suggested before operating the TT3201.
Hardware
The TT3201 has an 8 pin spring-cage connector on the front side. Pin 1 is marked on the PCB, on the left side when looking at the cape from the front. The connector accepts AWG 26-20 rigid wires. The cables must be pushed in the round holes, while the rectangular holes are used to unlock the spring and allow cable removal.
Notice CAN bus controllers will report an error if
there is only one device on the bus or the termination is not appropriately set.
Warning Do not try to remove the cable from
the connector by force or the board will be damaged. Insert an appropriate tool, or a paper clip,
in the rectangular holes on the connector to remove the corresponding cable.
pin | signal | device (kernel 3.2) | device (kernel 3.8+) |
---|---|---|---|
1 | GND | ||
2 | NC | ||
3 | CAN3L | can0 | can2 |
4 | CAN3H | ||
5 | CAN2L | can2 | can1 |
6 | CAN2H | ||
7 | CAN1L | can1 | can0 |
8 | CAN1H |
Notice The binding between the device name and the hardware interface could change if you modify the kernel or if there are hardware failures, so be prepared for that. You might want to employ udev to rename the interfaces.
Dip-switch S1 allows to enable the 120ohm termination resistor of each CAN channel. Termination must be enabled on the first and last physical device on the bus. If you are snooping an existing bus, keep the termination off. Use termination appropriately or the bus will not work.
Dip-switch S2 can be used to set the address of the configuration eeprom, from 0x54 to 0x57. Factory default is 0x57.
Installing the drivers
Notice The Angstrom distribution is not supported anymore
- Be sure to install the latest Debian image from BeagleBoard.org
- Verify that your BeagleBone boots with the updated image
- Use ssh to login into your board
-
Download the drivers using the provided link, unpack and follow the included
README.txt
- Verify that the BeagleBone still boots
- Turn it off, install the TT3201 and you'll be ready to go
- You might want to remove the packages you don't need, like
apache2
Software
Warning
To configure the CAN controllers you need a recent version of the ip
command,
from the iproute2 package. The version bundled with Debian should be ok.
- CAN bus tutorial: http://www.computer-solutions.co.uk/info/Embedded_tutorials/can_tutorial.htm
- SocketCAN documentation: https://www.kernel.org/doc/Documentation/networking/can.txt
Runtime detection
# cat /sys/devices/bone_capemgr.*/slots | grep TT3201 0: 54:P---L TT3201 CAN Cape,01,TowerTech,TT3201-001 # ip link | grep can[0-9] 3: can0:mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 10 4: can1: mtu 16 qdisc noop state DOWN mode DEFAULT qlen 10 5: can2: mtu 16 qdisc noop state DOWN mode DEFAULT qlen 10 # dmesg | grep mcp251x [ 7.170413] mcp251x spi1.0: mode 0, irq 259, awake 1, clkout 1, oscillator freq 16000000 [ 7.186391] mcp251x spi1.0 can1: probed [ 7.257289] mcp251x spi1.1: mode 0, irq 261, awake 1, clkout 0, oscillator freq 16000000 [ 7.371486] mcp251x spi1.1 can2: probed # dmesg | grep c_can [ 6.712145] c_can_platform 481d0000.d_can: invalid resource [ 6.718084] c_can_platform 481d0000.d_can: control memory is not used for raminit [ 6.799197] c_can_platform 481d0000.d_can: c_can_platform device registered (regs=fa1d0000, irq=71)
Notice
The invalid resource
and the other warning are normal.
Examples
ip link set can0 type can bitrate 125000 ip link set can1 type can bitrate 125000 ip link set can0 up ip link set can1 up cansend can1 00000104#02aa candump can0 ...
Notice
Don't mix bitrate
with up
in the same ip link
command.
Links and downloads
- can-utils: https://gitorious.org/linux-can/can-utils
- CAN bus tutorial: http://www.computer-solutions.co.uk/info/Embedded_tutorials/can_tutorial.htm
- SocketCAN documentation: https://www.kernel.org/doc/Documentation/networking/can.txt
- BeagleBoard.org latest images: http://beagleboard.org/latest-images