Blog Home

CAN Shield And A MCP2515 Library

Davide GombaDecember 16th, 2010

[DaveAK] shares his latest (uncompleted, never really complete, are they) CAN Shield.

Now I understand that there are a few CAN implementations out there, but the more the merrier, right?

This one uses the MCP2515/MCP2551 chips like most of them do. It has a switchable CS pin so that you can use other SPI shields with it that might have hardwired D10 as CS.  It has a switch to draw power from the CAN Bus if desired, if you wanted to add a WiFi or Bluetooth shield for example.  And for newbies like me it’s an entirely through hole design making it an easy DIY project.

I’ve also written a library that’s a complete implementation of the MCP2515 SPI command set.  It doesn’t yet have any wrappers for filters or masks, but these are all accessible through the read and write commands.  I have a simple Init function that takes a bus speed and clock frequency and calculates out all the necessary bit timing parameters, which makes it pretty straightforward to setup and use.

via [Arduino Forum]