I just received an email notification from EMS (http://ems-wuensche.com/) that support for their CAN controllers is now in mainline Linux kernels. The EMS PCI products are supported in 2.6.31, and the CPC-USB product will be supported in 2.6.32. I’ve used various Linux CAN stacks in the past, but none were as well integrated as the SocketCAN solution that has been merged into the mainline Linux kernel. Though I’ve not used the EMS products yet, the fact that support is in the mainline kernel source provides a good indication that they know how to do things correctly, and that the software is of good quality.
The Microchip MCP2515 is another option for interfacing CAN with a Linux system, but uses the SPI bus so it typically requires a custom hardware design. The availability of a USB adapter provides an easy way for CAN to be used with about any existing Linux system including small embedded systems. From looking at the kernel source code, it appears that EMS solutions use the SJA1000 CAN controller, which has been an industry standard controller for many years.
Message buffering is an important consideration when selecting a Linux CAN solution. Often in a system, the Linux computer is responsible for data processing, user interface, and other CPU intensive operations. The real-time control is often relegated to a separate microcontroller. The CAN bus is then just a convenient and robust way to get data from the control part of the system to the data processing part. The amount of hardware buffering in the CAN controller determines how quickly the system needs to respond to process the CAN data, so the CAN controller has space to receive new data. The SJA1000 provides a 64-byte receive fifo, or roughly space for 4 CAN messages. This provides a little more buffering than the 2 messages in the MCP2515. Dealing with full bandwidth CAN data in a Linux system can be a challenge with small amounts of buffering as you typically have to implement the Linux RT patch, and spend some time tuning it. Another upcoming CAN solution that looks nice is the TI High End CAN Controller (HECC) found in the new Sitara CPUs. This controller provides 32 hardware mailboxes which should provide even more buffering, which makes it even better suited for operating systems like Linux. As with any technology, there are tradeoffs, so its nice to have options.
One area the EMS solution may be very useful is for prototyping and development. The ideal development flow when developing an Embedded Linux product is to development as much as possible on a PC. The EMS product allows you to easily implement SocketCAN functionality on a PC so you can talk to the rest of your system directly from a PC. The final embedded solution may be based on a more cost effective solution like the MCP2515 or the TI HECC, but being able to interface to the rest of the system directly from a PC has the potential to improve development efficiency. This is part of the “Big Win” with Embedded Linux where the same technology scales from the embedded system, to the PC, to the server.
All of the Phytec development systems are Linux based and include CAN support. They support over 20 different CPUs. Their CAN software is done by http://www.pengutronix.com/
The PEAK PCAN-USB Adapter is my favorite and cost only $264 and has SocketCAN support too.
Just received information from TI that the driver for the TI HECC is now in both net-next and linux-next trees and should go mainline in 2.6.33.