2.1 PIC® Microcontroller Features

The primary feature used for this automatic bit rate detection method is the Listen-Only mode of the CAN module. This mode causes the CAN module to listen to the bus and detect errors with its communication while simultaneously not transmitting those errors to the rest of the CAN bus. When using the CAN/ECAN modules found on PIC18 devices, Listen-Only mode is accessed by setting the REQOP bits of the CANCON register (CANCON<7:5>) to 0b011, then waiting for the OPMODE bits of CANSTAT (CANSTAT<7:5>) to similarly be 0b011. Further description of the Listen-Only mode can be found in the PIC18F26K83 data sheet.

The other key feature used in this automatic bit rate detection method is the CAN Bus Message Error Interrupt Flag (PIR5 bit 7 on the PIC18F26K83). This interrupt flag is set whenever an invalid message on the CAN bus is detected by the module. In normal modes, this condition is something that would be handled by the CAN engine and would not require an Interrupt condition or software intervention. However, in Listen-Only mode, it can be used to detect that the connected CAN bus is not running at the same rate as the application device, and thus can be used to determine when a change of CAN baud rate is required.