free code which I have modified for the LPC1768 which and adapted it to use the SPI library.I uses a MCP2515 SPI to CAN IC and a MCP2551 CAN transceiver.has passed the test.
File list:
mbed.lib
mcp2515.cpp
mcp2515.h
mcp2515_bittime.h
mcp2515_can.h
mcp2515_defs.h