Datasheet

MCP2515
DS20001801J-page 60 2003-2019 Microchip Technology Inc.
10.4 Loopback Mode
Loopback mode will allow internal transmission of
messages from the transmit buffers to the receive
buffers without actually transmitting messages on the
CAN bus. This mode can be used in system
development and testing.
In this mode, the ACK bit is ignored and the device will
allow incoming messages from itself, just as if they
were coming from another node. The Loopback mode
is a silent mode, meaning no messages will be trans-
mitted while in this state (including error flags or
Acknowledge signals). The TXCAN pin will be in a
recessive state.
The filters and masks can be used to allow only
particular messages to be loaded into the Receive
registers. The masks can be set to all zeros to provide
a mode that accepts all messages. The Loopback
mode is activated by setting the Request Operation
Mode bits in the CANCTRL register.
10.5 Normal Mode
Normal mode is the standard operating mode of the
MCP2515. In this mode, the device actively monitors all
bus messages and generates Acknowledge bits, error
frames, etc. This is also the only mode in which the
MCP2515 will transmit messages over the CAN bus.
REGISTER 10-1: CANCTRL: CAN CONTROL REGISTER (ADDRESS: XFh)
R/W-1 R/W-0 R/W-0 R/W-0 R/W-0 R/W-1 R/W-1 R/W-1
REQOP2 REQOP1 REQOP0 ABAT OSM CLKEN CLKPRE1 CLKPRE0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-5 REQOP[2:0]: Request Operation Mode bits
000 = Sets Normal Operation mode
001 = Sets Sleep mode
010 = Sets Loopback mode
011 = Sets Listen-Only mode
100 = Sets Configuration mode
All other values for the REQOPn bits are invalid and should not be used. On power-up, REQOP[2:0] = b’100’.
bit 4 ABAT: Abort All Pending Transmissions bit
1 = Requests abort of all pending transmit buffers
0 = Terminates request to abort all transmissions
bit 3 OSM: One-Shot Mode bit
1 = Enabled; messages will only attempt to transmit one time
0 = Disabled; messages will reattempt transmission if required
bit 2 CLKEN: CLKOUT Pin Enable bit
1 = CLKOUT pin is enabled
0 = CLKOUT pin is disabled (pin is in high-impedance state)
bit 1-0 CLKPRE[1:0]: CLKOUT Pin Prescaler bits
00 =F
CLKOUT
= System Clock/1
01 =F
CLKOUT
= System Clock/2
10 =F
CLKOUT
= System Clock/4
11 =F
CLKOUT
= System Clock/8