I've written up a cross platform CAN library that builds on some of the excellent work out there done on individual CAN controllers. This library allows you to communicate with multiple types of CAN controllers using a consistent API, making CAN communications across development platforms easier through Arduino.
The idea behind this CAN library is to use a similar approach to Adafruit's Unified Sensor library by standardizing CAN function calls, frame structure, filters, masks, buffers, etc to be used with a wide variety of CAN controllers. This library currently supports the following controllers:
- Microchip MCP2510 & MCP2515 through the SPI interface
Tested using both the SparkFun CAN-BUS Shield as well as the Seeed Studio CAN-BUS Shield - Atmel SAM3X family of MCU
Tested using the SAM3X8E on the Arduino Due - Freescale Kinetis K2x family of MCU
Tested using the MK20DX256VLH7 on the PJRC Teensy 3.1
The library is available at GitHub - McNeight/CAN_Library: Multiplatform Arduino library for supporting the native CAN controller on Due (SAM3X) and Teensy 3.1 (K2X) as well as MCP2515 through SPI. If you use it, feel free to drop me a line.
-Neil
