Project

General

Profile

CAN support

Kernel support

In order to use the CAN bus on the Industrial I/O board, the kernel must be compiled with driver support for the Microchip MCP251x device. If the kernel driver has been loaded and the device has been successfully probed, you should see a can0 device listed in ifconfig -a. If you do not see it, your kernel configuration may not include the driver or it may not be loaded if it was built as a kernel module. If the driver is present, it is also possible that the device probe failed. Search the output of dmesg for mcp251x.

Userspace support

Several userspace packages must be installed to support the CAN protocol family:
  • The Busybox package's implementation of ip does not support CAN. The real iproute2 package must be installed.
  • To use CAN test utilities like cansend and candump you need packages libsocketcan2 and canutils.
  • iptables seems to be an unlisted dependency of iproute2, so you may need to install that as well.

These packages can be found in the Angstrom package database and may be installed using opkg.

Configuring CAN

The following commands bring up the CAN interface:
  • ip link set can0 type can bitrate your-desired-bitrate-in-hz triple-sampling on
  • ifconfig can0 up

Add these to your init scripts to automatically bring up the CAN interface during boot.

Testing CAN

The canutils package provides utilities for basic CAN functionality tests. candump will listen for incoming CAN messages and dump them to the console. cansend can0 message-byte-string will transmit a message (message-byte-string is a string of hex octets separated by spaces, eg. 0x12 0x34 0x56 0x78).

Add picture from clipboard (Maximum size: 600 MB)