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.
- Use the CANRXPPS and appropriate RxyPPS registers to map the CANRX and CANTX functions to the desired pins of the device.
- Initialize LAT, TRIS and ANSEL bits for the selected CANRX and CANTX pins.
- Ensure that the CAN module is in Configuration mode.
- Set up Baud Rate registers.
- Ensure FIFOs are properly configured as transmit/receive.
- Set up Filter and Mask registers.
- If desired, populate transmit FIFOs with data to transmit.
- Set the CAN module to Normal or any other mode required by the application logic.