39.6.2.8 Test Modes

To enable write access to the TEST register, the CCCR bit has to be set to ‘1’. This allows the configuration of the test modes and test functions.

Four output functions are available for the CAN transmit pin (CANx_TX) by programming TEST.TX. Additionally to its default function, the serial data output, it can drive the CAN Sample Point signal to monitor the CAN’s bit timing and it can drive constant dominant or recessive values. The actual value at the CANx_RX pin can be read from TEST.RX. Both functions can be used to check the CAN bus physical layer.

Due to the synchronization mechanism between GCLK_CANx and GCLK_CANx_AHB domains, there may be a delay of several GCLK_CANx_AHB periods between writing to TEST.TX until the new configuration is visible at output pin CANx_TX. This also applies when reading the CANx_RX input pin through TEST.RX.

Note: Test modes must be used for production tests or self test only. The software control for the CANx_TX pin interferes with all CAN protocol functions. It is not recommended to use test modes for application.

External Loop-Back Mode

The CAN can be set in External loop-back mode by programming TEST.LBCK to ‘1’. In loop-back mode, the CAN treats its own transmitted messages as received messages and stores them (if they pass acceptance filtering) into an Rx Buffer or an Rx FIFO. The figure below shows the connection of CANx_TX and CANx_RX signals to the CAN in external loop-back mode.

This mode is provided for hardware self-test. To be independent from external stimulation, the CAN ignores acknowledge errors (recessive bit sampled in the acknowledge slot of a data/remote frame) in loop-back mode. In this mode the CAN performs an internal feedback from its Tx output to its Rx input. The actual value of the CANx_RX input pin is disregarded by the CAN. The transmitted messages can be monitored at the CANx_TX pin.

Internal Loop-Back Mode

Internal loop-back mode is entered by programming the TEST.LBCK and CCCR.MON bits to ‘1’. This mode can be used for a ‘Hot Selftest’, meaning the CAN can be tested without affecting a running CAN system connected to the CANx_TX and CANx_RX pins. In this mode, the CANx_RX pin is disconnected from the CAN and the CANx_TX pin is held recessive. The figure below shows the connection of the CANx_TX and CANx_RX pins to the CAN in case of internal loop-back mode.

Figure 39-4. Pin Control in Loop-Back Modes