MCP2515
MCP2515
MCP2515
MCP2515
TX0RTS 4 15 SO
• Clock out pin with programmable prescaler:
TX1RTS 5 14 SI
- Can be used as a clock source for other
device(s) TX2RTS 6 13 SCK
• Start-of-Frame (SOF) signal is available for OSC2 7 12 INT
monitoring the SOF signal: 11
OSC1 8 RX0BF
- Can be used for time-slot-based protocols
Vss 9 10 RX1BF
and/or bus diagnostics to detect early bus
degredation
• Interrupt output pin with selectable enables
• Buffer Full output pins configurable as:
- Interrupt output for each receive buffer 20-LEAD TSSOP
- General purpose output
TXCAN 1 20 VDD
• Request-to-Send (RTS) input pins individually RXCAN 2 19 RESET
configurable as: CLKOUT/SOF 3 18 CS
- Control pins to request transmission for each TX0RTS 4 17 SO
MCP2515
RXCAN
CAN TX and RX Buffers SPI™ CS
Protocol Interface SCK SPI
Engine Masks and Filters Logic Bus
SI
TXCAN SO
Control Logic
OSC1
Timing
OSC2
Generation INT
CLKOUT
RX0BF
RX1BF
TX0RTS
Control TX1RTS
and
Interrupt TX2RTS
Registers RESET
TX RX TX RX TX RX
CANH
CANL
MESSAGE
MESSAGE
c Acceptance Filter Acceptance Filter e
TXREQ
TXREQ
TXREQ
TXERR
TXERR
TXERR
e RXF0 RXF4 p
MLOA
MLOA
MLOA
ABTF
ABTF
ABTF
p t
Acceptance Filter Acceptance Filter
t
RXF1 RXF5
R R
M
X Identifier Identifier X
Message A
B B
Queue B
0 1
Control
Transmit Byte Sequencer Data Field Data Field
Transmit ErrPas
Error BusOff
Counter
Transmit<7:0> Receive<7:0>
Shift<14:0>
{Transmit<5:0>, Receive<8:0>}
Comparator
Protocol
Finite SOF
State
CRC<14:0> Machine
Bit
Transmit
Timing Clock
Logic Logic Generator
TX RX
Configuration
Registers
SAM
REC
Sample<2:0> Receive
Error Counter
TEC
StuffReg<5:0>
Transmit
ErrPas
Majority Error Counter
Decision BusOff
BusMon
Comparator
CRC<14:0>
Protocol
FSM SOF
Comparator
Shift<14:0>
(Transmit<5:0>, Receive<7:0>)
Receive<7:0> Transmit<7:0>
RecData<7:0> TrmData<7:0>
Interface to Standard Buffer Rec/Trm Addr.
12 6 8N (0≤N≤8) 16 7
Arbitration Field Control Data Field CRC Field
Field End-of-
4 Frame
STANDARD DATA FRAME
11 8 8 15
CRC
Start-of-Frame
IFS
ACK Del
Ack Slot Bit
CRC Del
DLC3
ID 10
ID3
ID0
DLC0
IDE
RB0
RTR
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
Preliminary
Identifier Data
Length
Message Code
Filtering
Reserved Bit
Stored in Transmit/Receive Buffers
Stored in Buffers
Bit-stuffing
DS21801C-page 9
MCP2515
FIGURE 2-2:
DS21801C-page 10
MCP2515
IFS
ACK Del
Ack Slot Bit
ID10
ID3
SRR
IDE
EID17
EID0
RTR
RB1
RB0
DLC3
DLC0
ID0
CRC Del
Start-Of-Frame
0 11 000 1 11111111111
Identifier Data
Extended Identifier
Length
Preliminary
Message Code
Filtering
Reserved bits
Stored in Buffers Stored in Transmit/Receive Buffers
Bit-stuffing
ID10
ID3
SRR
IDE
EID17
EID0
RTR
RB1
RB0
DLC3
DLC0
CRC Del
ID0
Start-Of-Frame
0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1
Identifier Data
Extended Identifier
Preliminary
Length
Message Code
Filtering Reserved bits
No data field
DS21801C-page 11
MCP2515
FIGURE 2-4:
DS21801C-page 12
MCP2515
12 6 8N (0≤N≤8)
Arbitration Field Control Data Field
Field
4
11 8 8
Start-Of-Frame
DLC3
ID 10
ID3
ID0
DLC0
IDE
RB0
RTR
ACTIVE ERROR FRAME
0 0 0 0
Identifier Data
Length
Message Code
Filtering
Preliminary
Reserved Bit
Error Frame
Bit-stuffing 8
6 £6
Data Frame or
Error Echo Error Inter-Frame Space or
Remote Frame
Flag Error Delimiter Overload Frame
Flag
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0
12 6 16 7
Arbitration Field Control CRC Field
Field End-of-
OVERLOAD FRAME
4 Frame
11 15
CRC
Start-Of-Frame
ACK Del
Ack Slot Bit
CRC Del
DLC3
ID 10
ID0
IDE
DLC0
RB0
RTR
0 1 0 0 1 1 1 1 1 1 1 1 1
Overload Frame
Preliminary
End-of-Frame or Inter-Frame Space or
Error Delimiter or 6 8 Error Frame
Overload Delimiter
Overload Overload
Flag Delimiter
0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
DS21801C-page 13
MCP2515
MCP2515
NOTES:
Start
The message transmission
sequence begins when the
device determines that the
TXBnCTRL.TXREQ for any of
the transmit registers has been
Are any set.
No TXBnCTRL.TXREQ
bits = 1
?
Yes
Is is
CAN bus available No TXBnCTRL.TXREQ=0 No
to start transmission? or CANCTRL.ABAT=1
?
Yes Yes
Transmit Message
Message
Was No Message error
Error
Message Transmitted or
Successfully? Lost arbitration
? Set
TxBnCTRL.TXERR
Yes Lost
Clear TxBnCTRL.TXREQ Arbitration
Yes
CANINTE.MEERE?
Yes
Generate Set
CANINTE.TXnIE=1? TxBNCTRL.MLOA
Interrupt
No
Generate
Interrupt
No
Set Set
CANTINF.TXnIF CANTINF.MERRF
The CANINTE.TXnIE bit
determines if an interrupt
should be generated when
a message is successfully
transmitted.
GOTO START
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
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
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
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
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
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
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
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
Sample
Point
RXCAN
SOF
Glitch-Filtering
EXPECTED START-OF-FRAME BIT
Expected Sample
Point BUS IDLE
RXCAN
SOF
R R
Identifier M Identifier
X X
A
B B
B
0 1
Start
Detect
No
Start of
Message?
Yes
Valid
Generate No
Error Message
Frame Received?
Yes
Meets Meets
Yes No Yes
a filter criteria a filter criteria
for RXB0? for RXB1?
No
Go to Start
Determines if the receive
register is empty and able
to accept a new message
Is No Is Yes
CANINTF.RX0IF = 0? RXB0CTRL.BUKT = 1?
Yes No
No Is
Move message into RXB0 Generate Overflow Error: Generate Overflow Error: CANINTF.RX1IF = 0?
Set EFLG.RX0OVR Set EFLG.RX1OVR
No No
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
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
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
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
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
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
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
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
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
Extended Frame
* The two MSb (EID17 and EID16) mask and filter bits are not used.
RXFn0 RXMn0
RXMn1 RxRqst
RXFn1
RXFnn RXMnn
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
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
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
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
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
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
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
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
SYNCHRONIZATION SEGMENT
The Synchronization Segment (SyncSeg) is the first
segment in the NBT and is used to synchronize the
nodes on the bus. Bit edges are expected to occur
within the SyncSeg. This segment is fixed at 1 TQ.
Sample
Point
Nominal Bit Time (NBT), tbit
tOSC
TBRPCLK
TQ
(tTQ)
Input Signal (e = 0)
PhaseSeg2 (PS2)
SyncSeg PropSeg PhaseSeg1 (PS1)
SJW (PS2)
SJW (PS1)
Sample
Point
Input Signal
(e > 0)
PhaseSeg2 (PS2)
SyncSeg PropSeg PhaseSeg1 (PS1)
SJW (PS2)
SJW (PS1)
Sample
Point
Nominal Bit Time (NBT)
PhaseSeg2 (PS2)
SyncSeg PropSeg PhaseSeg1 (PS1)
SJW (PS2)
SJW (PS1)
Sample
Point
5.5.3 CNF3
The PHSEG2<2:0> bits set the length (in TQ’s) of PS2,
if the CNF2.BTLMODE bit is set to a ‘1’. If the
BTLMODE bit is set to a ‘0’, the PHSEG2<2:0> bits
have no effect.
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
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
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
RESET
Error-Passive
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
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
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
TABLE 7-1: ICOD<2:0> DECODE Note: The MCP2515 wakes up into Listen-only
mode.
ICOD<2:0> Boolean Expression
000 ERR•WAK•TX0•TX1•TX2•RX0•RX1 7.6 Error Interrupt
001 ERR When the error interrupt is enabled
010 ERR•WAK (CANINTE.ERRIE = 1), an interrupt is generated on
the INT pin if an overflow condition occurs or if the error
011 ERR•WAK•TX0 state of the transmitter or receiver has changed. The
100 ERR•WAK•TX0•TX1 Error Flag (EFLG) register will indicate one of the
following conditions.
101 ERR•WAK•TX0•TX1•TX2
110 ERR•WAK•TX0•TX1•TX2•RX0 7.6.1 RECEIVER OVERFLOW
111 ERR•WAK•TX0•TX1•TX2•RX0•RX1 An overflow condition occurs when the MAB has
Note: ERR is associated with CANINTE,ERRIE. assembled a valid receive message (the message
meets the criteria of the acceptance filters) and the
receive buffer associated with the filter is not available
for loading of a new message. The associated
EFLG.RXnOVR bit will be set to indicate the overflow
condition. This bit must be cleared by the MCU.
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
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
OSC1
C1 To internal logic
XTAL SLEEP
RF(2)
RS(1)
C2 OSC2
Note 1: A series resistor (RS) may be required for AT strip cut crystals.
2: The feedback resistor (RF ), is typically in the range of 2 to 10 MΩ.
Clock from
OSC1
external system
(1)
Open OSC2
Note 1: A resistor to ground may be used to reduce system noise. This may increase system current.
2: Duty cycle restrictions must be observed (see Table 12-2).
OSC1
0.1 mF
XTAL
VDD VDD
D R
R1
RESET
Note 1: The diode D helps discharge the capacitor quickly when VDD powers down.
2: R1 = 1 kΩ to 10 kΩ will limit any current flowing into RESET from external
capacitor C, in the event of RESET pin breakdown due to Electrostatic Discharge
(ESD) or Electrical Overstress (EOS).
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
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
Read Status 1010 0000 Quick polling command that reads several status bits for transmit
and receive functions.
RX Status 1011 0000 Quick polling command that indicates filter match and message
type (standard, extended and/or remote) of received message.
Bit Modify 0000 0101 Allows the user to set or clear individual bits in a particular regis-
ter. Note: Not all registers can be bit-modified with this command.
Executing this command on registers that are not bit-modifiable
will force the mask to FFh. See the register map in Section 11.0
“Register Map” for a list of the registers that apply.
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
SCK
SI 0 0 0 0 0 0 1 1 A7 6 5 4 3 2 1 A0 don’t care
data out
high-impedance
SO 7 6 5 4 3 2 1 0
CS
n m Address Points to Address
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
SCK
SI 0 0 0 0 0 0 1 0 A7 6 5 4 3 2 1 A0 7 6 5 4 3 2 1 0
high-impedance
SO
CS
0 1 2 3 4 5 6 7
SCK
instruction
SI 1 0 0 0 0 T2 T1 T0
high-impedance
SO
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
SCK
SI 0 0 0 0 0 1 0 1 A7 6 5 4 3 2 1 A0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
high-impedance
SO
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
SCK
instruction
SI 1 0 1 0 0 0 0 0 don’t care
repeat
data out data out
high-impedance
SO 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
CANINTF.RX0IF
CANINTFL.RX1IF
TXB0CNTRL.TXREQ
CANINTF.TX0IF
TXB1CNTRL.TXREQ
CANINTF.TX1IF
TXB2CNTRL.TXREQ
CANINTF.TX2IF
CS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
SCK
instruction
SI 1 0 1 1 0 0 0 0 don’t care
repeat
data out data out
high-impedance
SO 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
3
CS
11
1 6 10
Mode 1,1 7 2
SCK Mode 0,0
4 5
SI
MSB in LSB in
SO high-impedance
CS
2
8 9
SCK Mode 1,1
Mode 0,0
12
14
13
SO MSB out LSB out
don’t care
SI
† Notice: Stresses above those listed under “Maximum Ratings” may cause permanent damage to the device. This
is a stress rating only and functional operation of the device at those or any other conditions above those indicated in
the operational listings of this specification is not implied. Exposure to maximum rating conditions for extended periods
may affect device reliability.
Param.
No. Sym Characteristic Min Max Units Conditions
VOH TXCAN, RXnBF Pins VDD – 0.7 — V IOH = -3.0 mA, VDD = 4.5V
OSC1 Pin -5 +5 µA
IDDS Standby Current (Sleep mode) — 5 µA CS, TXnRTS = VDD, Inputs tied to
VDD or VSS, -40°C TO +85°C
16
RXCAN sample point
15
Param.
Sym Characteristic Min Max Units Conditions
No.
XXXXXXXXXXXXXXXXX MCP2515-I/P
XXXXXXXXXXXXXXXXX
YYWWNNN 0434256
XXXXXXXXXXXX MCP2515-E/SO
XXXXXXXXXXXX
XXXXXXXXXXXX
YYWWNNN 0434256
XXXXXXXX MCP2515
XXXXXNNN I/ST256
YYWW 0434
Note: In the event the full Microchip part number cannot be marked on one line, it will
be carried over to the next line thus limiting the number of available characters
for customer specific information.
* Standard device marking consists of Microchip part number, year code, week code, and traceability
code..
E1
n 1 α
E A2
c L
A1
B1
β
B p
eB
E
p
E1
2
B n 1
h
α
45°
c
A A2
φ
β L A1
p E1
D
B
2
n 1
α
A
φ
A2
β
L A1
Please specify which device, revision of silicon and Data Sheet (include Literature #) you are using.
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
10/20/04