TowerTech a lighthouse background

TT3201 CAN Cape

User's Manual

Prerequisites

A good knowledge of SocketCAN is strongly suggested before operating the TT3201.

Notice Support for the TT3201 has been included on recent BeagleBones (Apr 2012 onward), so you don't need to compile kernels or copy files on those units.

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 name can interface
1 GND
2 NC
3 CAN3L can0
4 CAN3H
5 CAN2L can2
6 CAN2H
7 CAN1L can1
8 CAN1H

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.

Software

To configure the CAN controllers you need a recent version of the ip command, from the iproute2 package

opkg update
opkg install iproute2

CAN bus tutorial: http://www.computer-solutions.co.uk/info/Embedded_tutorials/can_tutorial.htm

Runtime detection


# dmesg | grep TT3201
[    0.400644] BeagleBone cape: TowerTech TT3201 CAN Cape
[    0.400659] BeagleBone cape partnumber: TT3201-001
[    0.400684] TowerTech TT3201 CAN Cape

# dmesg | grep mcp251x
[    0.653840] mcp251x spi2.0: CANSTAT 0x80 CANCTRL 0x07
[    0.654351] mcp251x spi2.0: can1: probed
[    0.664697] mcp251x spi2.1: CANSTAT 0x80 CANCTRL 0x07
[    0.665183] mcp251x spi2.1: can2: probed

# dmesg | grep d_can
[    0.643174] d_can d_can: d_can device registered (irq=55, irq_obj=56)

# ip addr | grep 'can[0-9]'
2: can0:  mtu 16 qdisc noop state DOWN qlen 10
3: can1:  mtu 16 qdisc noop state DOWN qlen 10
4: can2:  mtu 16 qdisc noop state DOWN qlen 10

Examples

ip link set can0 up type can bitrate 125000
ip link set can1 up type can bitrate 125000

cansend can1 00000104#02aa
candump can0

...

Links and downloads

Custom kernels

Notice Support for the TT3201 has been included on recent BeagleBones (Apr 2012 onward), so you don't need to compile kernels or copy files on those units.

If you have a custom - non Angstrom derived - kernel, it must be patched with tt3201-can-cape.patch and the following config options must be enabled in your .config:

CONFIG_CAN_PM_TRACE=y
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_DEV=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_MCP251X=y
CONFIG_CAN_D_CAN=y
CONFIG_CAN_D_CAN_PLATFORM=y
CONFIG_CAN_DEBUG_DEVICES=y