Use the internal loopback feature of the CAN controller. This allows the controller to receive what it transmits without the bus being used. Typically this mode is enabled by setting a bit in the control register before enabling the CAN controller.
"FAQ contribution from Embedded Systems Academy, experts in CAN bus. For more information visit www.esacademy.com"