Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Ilker Demirkol

ilker.demirkol@upc.edu
 Sublayer: Medium Access Control (MAC)
 Message framing
 Arbitration
 Acknowledgement
 Error detection, error signaling

 Sublayer: Logical Link Control (LLC)


 Error recovery
▪ Automatic retransmission of frames
▪ that lost arbitration or was erroneous
© ISO 11898
 Short messages: Up to 8 bytes. GQ: Why?

 CAN identifiers do not specify the destination of the message


but the content! GQ: Why?
 CAN2.0A (standard format): 11 bit identifier
 CAN2.0B (extended format): 29 bit identifier
 Data frame: Transport of data
 Periodic or event-driven broadcast of data (e.g. temperature, yaw rate)

 Remote frame: Request of data


 Empty payload

 Error frame: Sent when an error is detected

 Overload frame: Request of supplementary time interval between


preceding and following data frames
S R
11-bit Control Data End of
O T CRC ACK
F Identifier R Field Field Frame

1 11 1 6 0..64 15+1 1+1 7

 SOF (Start of Frame): single dominant bit


 RTR (Remote Transmission Request):
 Dominant for data frames, Recessive for remote frames
 CRC (Cyclic Redundancy Check) + CRC delimiter (1 recessive bit)
 ACK (Acknowledgement) + ACK delimiter (1 recessive bit)
 1 bit ACK: dominant overwriting
 End of Frame
 7 recessive bits
IDE R0 DLC3 DLC2 DLC1 DLC0
1 1 1 1 1 1

 IDE (IDentifier Extension)


 Distinction between standard (CAN2.0A) and extended
Data Length Code
format (CAN2.0B) Number of
Data Bytes DLC3 DLC2 DLC1 DLC0
▪ Bit-0 indicates an 11 bit message identifier, Bit-1 indicates a 29 bit 0 dominant dominant dominant dominant
identifier 1 dominant dominant dominant recessive
2 dominant dominant recessive dominant

 R0 (reserved) 3 dominant dominant recessive recessive


4 dominant recessive dominant dominant
5 dominant recessive dominant recessive
 DLC3-0 (Data Length Code) 6 dominant recessive recessive dominant
 Size of the data field: 0..8 bytes 7 dominant recessive recessive recessive
8 recessive dominant dominant dominant
 Meaning of ID and Data?
 Not straightforward
▪ many proprietary data coding

 Many tools for reverse engineering


 SavvyCAN
 CAN DBC format
▪ Example CAN data format databases
 Linux tools
▪ can-utils
▪ …
 …
7
 After 5 consecutive bits with same value, a bit with complementary value will
be inserted
 GQ: Why?
 Receiver filters the “stuffed” bits, i.e., not visible to higher layers, e.g., to app
 Note: previous stuff bits are also considered for stuffing decision
Bit sequence before
1 bit stuffing (at sender)

Stuff bit inserted


Bit sequence
2 after bit stuffing

Stuff bit removed


Bit sequence after filtering
3 stuff bit (at receiver)
 Bit-wise
 Arbitration bits: Identifier & RTR
 Sender with lowest identifier & RTR (=highest priority) wins the arbitration

 Non-destructive CSMA/CR (Carrier Sense Multiple Access/Collision


Resolution)
 message is not destroyed unlike CSMA/CD (Ethernet) or CSMA/CA (WiFi,
Bluetooth, …)
Message Identifier
11 Bit – MSB First
10 9 8 7 6 5 4 3 2 1 0

Node A Bus Idle Receiving Mode Bus Idle

S
Node B Bus Idle O
F
Receiving Mode Bus Idle

S R
Node C Bus Idle O T Receiving Mode Bus Idle
F R

S R
Node D Bus Idle O
F
T
R
Transmission Mode Bus Idle

Bus Bus Idle Bus Idle


11
S S I R
11-bit 18-bit R R Data End of
O R D T DLC CRC ACK
F Identifier R E Identifier R
0 1 Field Frame

1 11 1 1 18 1 1 1 4 0..64 15+1 1+1 7

 IDE (Identifier extension (IDE) bit: indicates that an 18-bit extension identifier follows
 Recessive for extended frames

 R1: an additional reserve bit


 SRR (substitute remote request): replaces the RTR bit in the standard frame location
 Recessive
S S I R
O
11-bit R D
18-bit T
R R
DLC
Data
CRC ACK
End of CAN2.0B Data/Remote
F Identifier R E Identifier R
0 1 Field Frame
Frame
1 11 1 1 18 1 1 1 4 0..64 15+1 1+1 7

S
11-bit R I
R Data End of CAN2.0A Data/Remote
O T D DLC CRC ACK
F Identifier R E
0 Field Frame
Frame

1 11 1 1 1 4 0..64 15+1 1+1 7

 GQ: What happens if a standard frame and extended frame with identical 11 bit base identifier
competes for the medium? They can co-exist!
 GQ: What is the effect of setting the SRR to recessive? What would happen if it was dominant or
using that bit as part of ID?
 GQ: Why to move RTR?
 Carrier Sense Multiple Access / Idle for IFS after a
frame tx?
Collision Resolution (CSMA/CR) yes

 Contention-free
Transmit
SOF

 If collision, arbitration is used to resolve Transmit next Switch to


arbitration Bit Receiving Mode

no
 High bus capacity utilization (up to 100%)
Arbitration Bit
== Bus Level? no

 Allows prioritization of messages no


yes
Arbitration Dominant Bit
bits finished? transmitted?

yes yes
Transmit rest Error Status
of message

You might also like