Skip to main content

Windows CE Library - CANLIB-MCP2515


this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.


This library interfaces to the MCP2515 Stand-Alone CAN Controller throuh an SPI interface.

Current Version


Application Notes

The MCP2515 is available on the following Toradex hardware

Toradex HardwareNotes
Colibri Evaluation BoardThe Evaluation Board contains the MCP2515 along with electrical isolation and line drivers.
Any Colibri module can control the MCP2515 through the regular SPI interface
Apalis T30The Apalis T30 contains 2x MCP2515 CAN controllers.
The matching line drivers and electrical isolation are not part of the module, but are for example implemented on the Apalis Evaluation Board.

The library supports up to four instances of the interface on Colibri modules and up to five instances on Apalis modules.

The current implementation of the MCP2515 library is based on a generic SPI implementation.
Along with the fact, that the MCP2515 only provides buffers for 2 CAN messages, the system may loose messages in an environment, where the CAN bus is running at high speed, and 3 or more messages are transmitted over the CAN bus in short intervals.


CANMCP2515 and Colibri PXAxxx
The CAN support for Colibri PXAxxx modules is broken. If you require a fix, please contact the Colibri support. The fix would reduce the performance of the SPI library.

Library API

The library API can be viewed here.

Other Resources

Windows CE Libraries Overview

Data Sheet

Revision History

DateRevChange Notes
29/06/2015V2.0Fixed pin configuration (was an issue on PXA300 only).
Fixed SPI port assignments for Apalis T30
Add support for additional SPI channels on Apalis T30
Performance improvements by using cached memory for read buffers.
Fixed unwanted debug output "CANLibMCP2515 DestroyMessageBuffer - Cannot free Message Buffer"
Fix issue that caused message loss when transmitting CAN messages.
CANLibMCP2515ISRDll.dll is not required anymore
10/30/2014V1.9Add support for 2nd MCP2515 CAN controller used in the same system.
09/07/2014V1.8Minor performance improvement in SetMode()
Remove unused declarations and code from mcp2515.h and mcp2515.c
Removed dependency to IsrDll.dll. IsrDll.dll is not required anymore
Support for two coexistent MCP2515 controllers
Fix wrong parameter validation for parameter "device" in various functions
Fix McpCanLib for PXA procesors
Fix wrong generation of CAN IDs when transmitting a message
27/05/2014V1.7Add support for Apalis on-board CAN interfaces
For CAN device 0, use SPI1 on Colibri T30 (was SPI4)
Fixed bug that caused Bit 23 of extended message IDs to be cleared to 0.
15/04/2014V1.6CANLibMCP2515TransmitMessage(): add timeout parameter
Use SPI busy-loop polling to minimize latency
Support 2nd CAN interface
Fix wrong interpretation of function result in CANLibMCP2515Init()
23/09/2013V1.5Change default SDK to Colibri600
Workaround for Silicon Erratum that could lead to duplicated CAN messages (use RTS command to send messages)
12/08/2013V1.4.1Changed MCP2515 Interrupt to be level triggered rather than edge triggered.

Send Feedback!