I played with the MCP25625 (CAN controler and driver) using the SPI peripheral on the 18F57Q53 a while back (just looked, turns out it's 4 years ago now, bloody hell...).
My intention was to make a "universal" driver for it and it looks like I did get most of the way but then lost interest it (which is what usually happens) since I didn't really had a need and/or use for it at the time.
You could
Code:
#DEFINE CAN_OSCILLATOR 20
#DEFINE CAN_BITRATE 125000
And it would automatically set the CNF1-3 registers (to reasonable values) based on bitrate and oscillator speed. Low level read/write/modify register routines, medium level Load_Tx_Buffer & Read_Rx_Buffer routines and higher level like GetCANMessage seems to have been implemented. I need an actual project to finish it.
Bookmarks