38.1.1 Module Functionality

The CAN module consists of the CAN message/protocol handler and the device RAM devoted to CAN FIFOs. The protocol handler performs the needed CAN protocol actions, transferring data in and out of the FIFOs as defined by the firmware (see Figure 38-1).

The following sequence illustrates the necessary initialization steps before the CAN module can be used to transmit or receive a message. Steps can be added or removed depending on the requirements of the application.

  1. Use the CANRXPPS and appropriate RxyPPS registers to map the CANRX and CANTX functions to the desired pins of the device.
  2. Initialize LAT, TRIS and ANSEL bits for the selected CANRX and CANTX pins.
  3. Ensure that the CAN module is in Configuration mode.
  4. Set up Baud Rate registers.
  5. Ensure FIFOs are properly configured as transmit/receive.
  6. Set up Filter and Mask registers.
  7. If desired, populate transmit FIFOs with data to transmit.
  8. Set the CAN module to Normal or any other mode required by the application logic.
Figure 38-1. CAN Module Simplified Block Diagram