CAN Bus Protocol Implementation

Developing CAN library is relatively easy as compared to I2C or SPI. This is because CAN Controller of your Cortex will take care of most of complex things.

To transmit the data, You have to write ID and Data in designated registers and set bit to transmit data.

This Application note from NXP can be very useful for you.

I would recommend you to implement following functions:

  1. InitCAN - This should set specified Baud Rate of CAN.
  2. SetFilters - Most CAN Controllers come with Acceptance Filters, So it's good to have that
  3. SendData - Make sure you accept Parameters like ID_Type and RTRs etc.
  4. RecieveData - This can be blocking or Interrupt based.

Before beginning, do read CAN Basics to understand. Application notes AN713 and AN754 from Microchip is a good source. Also Vector's site and Wikipedia Article.

Plus, You can always post your doubts here or on Electronics.StackExchange.com :)