Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 34

Controller Area Network

CAN Fundamentals
User benefts
How it all began
Overview
Basic Concepts
CAN Data Lin La!er
Bus Access Arbitration
Frame Formats
"rror Detection
"rror Handling
#rotocol $ersions
%&tandard '"(tended)
CAN #*!sical La!er
+essage Coding
&!nc*roni,ation
Bit -iming ' Bit Construction
CAN Bus Lines
CAN .mplementations
-!pical .mplementations
Basic .mplementations
Full .mplementations
Building Large CAN Networs
CAN User Benefts
CAN is low cost
Fast serial bus wit* two wires/ good price'per0ormance ratio
Low cost protocol devices %controllers1 transceivers) available mainl! driven b! *ig* volume
production in t*e automotive maret
CAN is reliable
&op*isticated error detection and error *andling mec*anisms results in *ig* reliabilit!
transmission
"(ample/ 233 bit's1 425 bus load1 4333 *ours per !ear/
One undetected error ever! 6333 !ears
"rroneous messages are detected and repeated
&!stem7wide data consistenc! %ever! bus node is in0ormed about an error)
Fault! nodes automaticall! wit*draw 0rom bus communication
Hig* immunit! to "lectromagnetic .nter0erence
CAN means real7time
ma(imum data rate is 6 +Bit's 8 93m bus lengt*
%still about 93 Bit's 8 6333m bus lengt*)
&*ort message lengt* %3 to : data b!tes ' message)
%Larger data can be split up into several messages)
Low latenc! between transmission re;uest and actual start o0 transmission
Bus access *andled via C&+A'CD w' A+# met*od %message wit* t*e *ig*est priorit! wins
arbitration wit*out losing an! time)
CAN is <e(ible
CAN allows +ulti7+aster Operation
%ever! CAN node is able to access t*e bus individuall!)
CAN Nodes can easil! be connected ' disconnected
%i=e= plug > pla!)
Number o0 nodes not limited b! t*e protocol
CAN means +ulticast ' Broadcast Capabilit!
CAN is not node7oriented but message7oriented
+essage identifer specifes contents > priorit! o0 t*e message
+essages can be easil! sent to multiple ' all nodes simultaneousl!
All nodes simultaneousl! receive and wor on common data
CAN is standardi,ed
.&O766:?: %*ig* speed applications)
.&O76626?74 %low speed applications)
How it all began
@-*e development o0 CAN began w*en more and more electronic devices were implemented into modern motor
ve*icles= "(amples o0 suc* devices include engine management s!stems1 active suspension1 AB&1 gear control1
lig*ting control1 air conditioning1 airbags and central locing= All t*is means more sa0et! and more com0ort 0or
t*e driver and o0 course a reduction o0 0uel consumption and e(*aust emissions=
@-o improve t*e be*avior o0 t*e ve*icle even 0urt*er1 it was necessar! 0or t*e diAerent control s!stems %and
t*eir sensors) to e(c*ange in0ormation= -*is was usuall! done b! discrete interconnection o0 t*e diAerent
s!stems %i=e= point to point wiring)= -*e re;uirement 0or in0ormation e(c*ange *as t*en grown to suc* an e(tent
t*at a cable networ wit* a lengt* o0 up to several miles and man! connectors was re;uired= -*is produced
growing problems concerning material cost1 production time and reliabilit!=
@-*e solution to t*is problem was t*e connection o0 t*e control s!stems via a serial bus s!stem= -*is bus *ad to
0ulfll some special re;uirements due to its usage in a ve*icle=
@Bit* t*e use o0 CAN1 point7to7point wiring is replaced b! one serial bus connecting all control s!stems= -*is is
accomplis*ed b! adding some CAN7specifc *ardware to eac* control unit t*at provides t*e CrulesC or t*e
protocol 0or transmitting and receiving in0ormation via t*e bus=
Overview
@CAN or Controller Area Networ is an advanced serial bus s!stem t*at eDcientl! supports distributed control
s!stems= .t was initiall! developed 0or t*e use in motor ve*icles b! Eobert Bosc* FmbH1 Ferman!1 in t*e late
6?:3s1 also *olding t*e CAN license=
@CAN is internationall! standardi,ed b! t*e .nternational &tandardi,ation Organi,ation %.&O) and t*e &ociet! o0
Automotive "ngineers %&A")=
@-*e CAN protocol uses t*e Data Lin La!er and t*e #*!sical La!er in t*e .&O 7 O&. model= -*ere are also a
number o0 *ig*er level protocols available 0or CAN=
@CAN is most widel! used in t*e automotive and industrial maret segments= -!pical applications 0or CAN are
motor ve*icles1 utilit! ve*icles1 and industrial automation= Ot*er applications 0or CAN are trains1 medical
e;uipment1 building automation1 *ouse*old appliances1 and oDce automation= Due to t*e *ig* volume
production in t*e automotive and industrial marets1 low cost protocol devices are available=
@-*ere are about 43 million CAN nodes in use worldwide= B! t*e !ear 4333 t*e number o0 nodes is estimated to
be 693 million=
@"(amples o0 ve*icle bus s!stems1 ot*er t*an CAN1 are A7BU& 0rom $olswagen1 $AN or $e*icle Area Networ1
0rom #eugeot and Eenault1 and G6:23 0rom C*r!sler1 Feneral +otors and Ford=
@CAN is clearl! t*e leading ve*icle bus protocol in "urope=
Basic Concepts
@CAN is a multi7master bus wit* an open1 linear structure wit* one logic bus line and e;ual nodes= -*e number
o0 nodes is not limited b! t*e protocol=
@.n t*e CAN protocol1 t*e bus nodes do not *ave a specifc address= .nstead1 t*e address in0ormation is
contained in t*e identifers o0 t*e transmitted messages1 indicating t*e message content and t*e priorit! o0 t*e
message=
@-*e number o0 nodes ma! be c*anged d!namicall! wit*out disturbing t*e communication o0 t*e ot*er nodes=
@+ulticasting and Broadcasting is supported b! CAN=
@CAN provides sop*isticated error7detection and error *andling mec*anisms suc* as CEC c*ec1 and *ig*
immunit! against electromagnetic inter0erence= "rroneous messages are automaticall! retransmitted=
-emporar! errors are recovered= #ermanent errors are 0ollowed b! automatic switc*7oA o0 de0ective nodes=
-*ere is guaranteed s!stem7wide data consistenc!=
@-*e CAN protocol uses Non7Eeturn7to7Hero%NEH) bit coding= For s!nc*roni,ation purposes1 Bit &tuDng is used=
@-*ere is a *ig* data trans0er rate o0 6333 ilobits per second at a ma(imum bus lengt* o0 93 meters or 6I3
0eet w*en using a twisted wire pair w*ic* is t*e most common bus medium used 0or CAN= +essage lengt* is
s*ort wit* a ma(imum o0 : data b!tes per message and t*ere is a low latenc! between transmission re;uest
and start o0 transmission=
@-*e bus access is *andled via t*e advanced serial communications protocol Carrier Sense Multiple
Access/Collision Detection with NonDestructive Arbitration= -*is means t*at collision o0 messages is
avoided b! bitwise arbitration wit*out loss o0 time=
Basic Concepts
CAN Bus Characteristics !ire"AND
@-*ere are two bus states1 called CdominantC and CrecessiveC=
@-*e bus logic uses a CBired7ANDC mec*anism1 t*at is1 Cdominant bitsC %e;uivalent to t*e logic level CHeroC)
overwrite t*e CrecessiveC bits %e;uivalent to t*e logic level COneC)=
@Onl! i0 all nodes transmit recessive bits %ones)1 t*e Bus is in t*e recessive state=
@As soon as one node transmits a dominant bit %,ero)1 t*e bus is in t*e dominant state=
Bus Access an" Arbitration# CSMA/CD w/ AM$
@-*e CAN protocol *andles bus accesses according to t*e concept called JCarrier &ense +ultiple Access wit*
Arbitration on +essage #riorit!K= -*is arbitration concept avoids collisions o0 messages w*ose transmission was
started b! more t*an one node simultaneousl! and maes sure t*e most important message is sent frst
wit*out time loss= .n t*e picture above !ou see t*e trace o0 t*e transmit pins o0 t*ree bus nodes called A1 B and
C1 and t*e resulting bus state according to t*e wired7AND principle=
@.0 two or more bus nodes start t*eir transmission at t*e same time a0ter *aving 0ound t*e bus to be idle1
collision o0 t*e messages is avoided b! bitwise arbitration= "ac* node sends t*e bits o0 its message identifer
and monitors t*e bus level=
@At a certain time nodes A and C send a dominant identifer bit= Node B sends a recessive identifer bit but
reads bac a dominant one= Node B loses bus arbitration and switc*es to receive mode= &ome bits later node C
loses arbitration against node A= -*is means t*at t*e message identifer o0 node A *as a lower binar! value and
t*ere0ore a *ig*er priorit! t*an t*e messages o0 nodes B and C= .n t*is wa!1 t*e bus node wit* t*e *ig*est
priorit! message wins arbitration wit*out losing time b! *aving to repeat t*e message=
@Nodes B and C automaticall! tr! to repeat t*eir transmission once t*e bus returns to t*e idle state= Node B
loses against node C1 so t*e message o0 node C is transmitted ne(t1 0ollowed b! node BLs message=
@.t is not permitted 0or diAerent nodes to send messages wit* t*e same identifer as arbitration could 0ail
leading to collisions and errors=
%ra&e %or&ats ' Overview
@-*ese are t*e e(isting Frame 0ormats w*ic* are now discussed in t*e 0ollowing slides=
%ra&e %or&ats Data %ra&e
@A CData FrameC is generated b! a CAN node w*en t*e node wis*es to transmit data= -*e &tandard CAN Data
Frame is s*own above= -*e 0rame begins wit* a dominant &tart O0 Frame bit 0or *ard s!nc*roni,ation o0 all
nodes=
@-*e &tart o0 Frame bit is 0ollowed b! t*e Arbitration Field consisting o0 64 bits/ -*e 667bit .dentifer1 w*ic*
re<ects t*e contents and priorit! o0 t*e message1 and t*e Eemote -ransmission Ee;uest bit= -*e Eemote
transmission re;uest bit is used to distinguis* a Data Frame %E-E M dominant) 0rom a Eemote Frame %E-E M
recessive)=
@(he ne)t fel" is the Control %iel"* consisting o+ , bits= -*e frst bit o0 t*is feld is called t*e .D" bit
%.dentifer "(tension) and is at dominant state to speci0! t*at t*e 0rame is a &tandard Frame= -*e 0ollowing bit is
reserved and defned as a dominant bit= -*e remaining 9 bits o0 t*e Control Field are t*e Data Lengt* Code
%DLC) and speci0! t*e number o0 b!tes o0 data contained in t*e message %3 7 : b!tes)=
@-*e data being sent 0ollows in t*e Data Field w*ic* is o0 t*e lengt* defned b! t*e DLC above %31 :1 6N1 ====1 2N
or N9 bits)=
@-*e C!clic Eedundanc! Field %CEC feld) 0ollows and is used to detect possible transmission errors= -*e CEC
Field consists o0 a 62 bit CEC se;uence1 completed b! t*e recessive CEC Delimiter bit=
@-*e ne(t feld is t*e Acnowledge Field= During t*e ACO &lot bit t*e transmitting node sends out a recessive
bit= An! node t*at *as received an error 0ree 0rame acnowledges t*e correct reception o0 t*e 0rame b! sending
bac a dominant bit %regardless o0 w*et*er t*e node is confgured to accept t*at specifc message or not)=
From t*is it can be seen t*at CAN belongs to t*e Cin7bit7responseC group o0 protocols= -*e recessive
Acnowledge Delimiter completes t*e Acnowledge &lot and ma! not be overwritten b! a dominant bit=
@&even recessive bits %"nd o0 Frame) end t*e Data Frame=
%ra&e %or&ats -e&ote %ra&e
@Fenerall! data transmission is per0ormed on an autonomous basis wit* t*e data source node %e=g= a sensor)
sending out a Data Frame= .t is also possible1 *owever1 0or a destination node to re;uest t*e data 0rom t*e
source b! sending a Eemote Frame=
@(here are . "i/erences between a Data %ra&e an" a -e&ote %ra&e0 %irstl1 the -(-bit is
trans&itte" as a "o&inant bit in the Data %ra&e an" secon"l1 in the -e&ote %ra&e there is no
Data %iel"0 2n the ver1 unlikel1 event o+ a Data %ra&e an" a -e&ote %ra&e with the sa&e i"entifer
being trans&itte" at the sa&e ti&e* the Data %ra&e wins arbitration "ue to the "o&inant -(- bit
+ollowing the i"entifer0 2n this wa1* the no"e that trans&itte" the -e&ote %ra&e receives the
"esire" "ata i&&e"iatel1=
@.0 a node wis*es to re;uest t*e data 0rom t*e source1 it sends a Eemote Frame wit* an identifer t*at matc*es
t*e identifer o0 t*e re;uired Data Frame= -*e appropriate data source node will t*en send a Data Frame as a
response to t*is remote re;uest=
%ra&e %or&ats 3rror %ra&e
@ An "rror Frame is generated b! an! node t*at detects a bus error= -*e "rror Frame consists o0 4 felds1 an
"rror Flag feld 0ollowed b! an "rror Delimiter feld= -*e "rror Delimiter consists o0 : recessive bits and
allows t*e bus nodes to restart bus communications cleanl! a0ter an error= -*ere are1 *owever1 two 0orms o0
"rror Flag felds= -*e 0orm o0 t*e "rror Flag feld depends on t*e Jerror statusK o0 t*e node t*at detects t*e
error=
@.0 an Jerror7activeK node detects a bus error t*en t*e node interrupts transmission o0 t*e current message b!
generating an Jactive error <agK= -*e Jactive error <agK is composed o0 si( consecutive dominant bits= -*is bit
se;uence activel! violates t*e bit stuDng rule= All ot*er stations recogni,e t*e resulting bit stuDng error and in
turn generate "rror Frames t*emselves= -*e "rror Flag feld t*ere0ore consists o0 between si( and twelve
consecutive dominant bits %generated b! one or more nodes)= -*e "rror Delimiter feld completes t*e "rror
Frame= A0ter completion o0 t*e "rror Frame bus activit! returns to normal and t*e interrupted node attempts to
resend t*e aborted message=
@.0 an Jerror passiveK node detects a bus error t*en t*e node transmits an Jpassive "rror FlagK 0ollowed1 again1
b! t*e "rror Delimiter feld= -*e Jpassive "rror FlagK consists o0 si( consecutive recessive bits1 and t*ere0ore t*e
"rror Frame %0or an Jerror passiveK node) consists o0 69 recessive bits %i=e= no dominant bits)= From t*is it 0ollows
t*at1 unless t*e bus error is detected b! t*e node t*at is actuall! transmitting %i=e= is t*e bus master)1 t*e
transmission o0 an "rror Frame b! an Jerror passiveK node will not aAect an! ot*er node on t*e networ= .0 t*e
bus master node generates an Jerror passive <agK t*en t*is ma! cause ot*er nodes to generate error 0rames
due to t*e resulting bit stuDng violation=
%ra&e %or&ats Overloa" %ra&e
@An Overload Frame *as t*e same 0ormat as an JactiveK "rror Frame= An Overload Frame1 *owever can onl! be
generated during .nter0rame &pace= -*is is t*e wa! t*en an Overload Frame can be diAerentiated 0rom an "rror
Frame %an "rror Frame is sent during t*e transmission o0 a message)= -*e Overload Frame consists o0 4 felds1
an Overload Flag 0ollowed b! an Overload Delimiter= -*e Overload Flag consists o0 si( dominant bits 0ollowed b!
Overload Flags generated b! ot*er nodes %as 0or Jactive error <agK1 again giving a ma(imum o0 twelve
dominant bits)= -*e Overload Delimiter consists o0 eig*t recessive bits= An Overload Frame can be generated b!
a node i0 due to internal conditions t*e node is not !et able to start reception o0 t*e ne(t message= A node ma!
generate a ma(imum o0 4 se;uential Overload Frames to dela! t*e start o0 t*e ne(t message=
%ra&e %or&ats 2nter+ra&e Space
@.nter0rame &pace separates a preceeding 0rame %o0 w*atever t!pe) 0rom a 0ollowing Data or Eemote Frame=
.nter0rame space is composed o0 at least I recessive bits1 t*ese bits are termed t*e .ntermission= -*is time is
provided to allow nodes time 0or internal processing be0ore t*e start o0 t*e ne(t message 0rame= A0ter t*e
.ntermission1 0or error active CAN nodes t*e bus line remains in t*e recessive state %Bus .dle) until t*e ne(t
transmission starts=
@-*e .nter0rame &pace *as a slig*tl! diAerent 0ormat 0or error passive CAN nodes w*ic* were t*e transmitter o0
t*e previous message= .n t*is case1 t*ese nodes *ave to wait anot*er eig*t recessive bits called &uspend
-ransmission be0ore t*e bus turns into bus idle 0or t*em a0ter .ntermission and t*e! are allowed to send again=
Due to t*is mec*anism error active nodes *ave t*e c*ance to transmit t*eir messages be0ore t*e error passive
nodes are allowed to start a transmission=
3rror Detection ' Overview
@-*e CAN protocol provides sop*isticated error detection mec*anisms discussed in t*e 0ollowing slides=
3rror Detection C1clic -e"un"anc1 Check
@Bit* t*e C!clic Eedundanc! C*ec1 t*e transmitter calculates a c*ec sum 0or t*e bit se;uence 0rom t*e start
o0 0rame bit until t*e end o0 t*e Data Field=
@-*is CEC se;uence is transmitted in t*e CEC Field o0 t*e CAN 0rame=
@-*e receiving node also calculates t*e CEC se;uence using t*e same 0ormula and per0orms a comparison to
t*e received se;uence=
@.0 node B detects a mismatc* between t*e calculated and t*e received CEC se;uence 1 t*en a CEC error *as
occurred=
@Node B discards t*e message and transmits an "rror Frame to re;uest retransmission o0 t*e garbled 0rame=
3rror Detection ' Acknowle"ge
@Bit* t*e Acnowledge C*ec t*e transmitter c*ecs in t*e Acnowledge Field o0 a message to determine i0 t*e
Acnowledge &lot1 w*ic* is sent out as a recessive bit1 contains a dominant bit=
@.0 t*is is t*e case1 at least one ot*er node1 %*ere node B) *as received t*e 0rame correctl!=
.0 not1 an Acnowledge "rror *as occured and t*e message *as to be repeated= No "rror Frame is generated1
t*oug*=
"rror Detection 7 Frame C*ec
@Anot*er error detection mec*anism is t*e Frame C*ec= .0 a transmitter detects a dominant bit in one o0 t*e
0our segments/
CEC Delimiter1
Acnowledge Delimiter1
"nd o0 Frame or
.nter0rame &pace
t*en a Form "rror *as occurred and an "rror Frame is generated= -*e message will t*en be repeated=
3rror Detection Bit Monitoring
@All nodes per0orm Bit +onitoring/ A Bit "rror occurs i0 a transmitter sends a dominant bit but detects a
recessive bit on t*e bus line or1 sends a recessive bit but detects a dominant bit on t*e bus line=
@An "rror Frame is generated and t*e message is repeated=
@B*en a dominant bit is detected instead o0 a recessive bit1 no error occurs during t*e Arbitration Field or t*e
Acnowledge &lot because t*ese felds must be able to be overwritten b! a dominant bit in order to ac*ieve
arbitration and acnowledge 0unctionalit!=
3rror Detection Bit Stu4ng Check
@.0 si( consecutive bits wit* t*e same polarit! are detected between &tart o0 Frame and t*e CEC Delimiter1 t*e
bit stuDng rule *as been violated=
@A stuA error occurs and an "rror Frame is generated= -*e message is t*en repeated=
3rror Han"ling
@Detected errors are made public to all ot*er nodes via "rror Frames=
@-*e transmission o0 t*e erroneous message is aborted and t*e 0rame is repeated as soon as possible=
@"ac* CAN node is in one o0 t*ree error states Cerror activeC1 Cerror passiveC or Cbus oAC according to t*e value
o0 t*eir internal error counters=
@-*e error7active state is t*e usual state a0ter reset= -*e bus node can t*en receive and transmit messages
and transmit active "rror Frames %made o0 dominant bits) wit*out an! restrictions= During CAN communication1
t*e error counters are updated according to ;uite comple( rules= For eac* error on reception or transmission1
t*e error counters are incremented b! a certain value= For eac* success0ul transaction1 t*e error counters are
decremented b! a certain value= -*e error active state is valid as long as bot* error counters are smaller t*an
or e;ual to 64P=
@.0 eit*er t*e receive or t*e transmit error counter *as reac*ed t*e value o0 64:1 t*e node switc*es to t*e error7
passive state= .n t*e error7passive state1 messages can still be received and transmitted1 alt*oug*1 a0ter
transmission o0 a message t*e node must suspend transmission= .t must wait : bit times longer t*an error7
active nodes be0ore it ma! transmit anot*er message= .n terms o0 error signaling1 onl! passive "rror Frames
%made o0 recessive bits) ma! be transmitted b! an error7passive node=
@.0 bot* error counters go below 64: again due to success0ul bus communication1 t*e node switc*es bac to t*e
error7active state=
@One 0eature o0 t*e CAN protocol is t*at 0ault! nodes wit*draw 0rom t*e bus automaticall!= -*e bus7oA state is
entered i0 t*e transmit error counter e(ceeds t*e value o0 422= All bus activities are stopped w*ic* maes it
temporaril! impossible 0or t*e station to participate in t*e bus communication= During t*is state1 messages can
be neit*er received nor transmitted= -o return to t*e error active state and to reset t*e error counter values1 t*e
CAN node *as to be reinitiali,ed=
Un"etecte" 3rrors an 3)a&ple
@-o understand t*e error detection capabilities o0 CAN1 imagine a ve*icle e;uipped wit* CAN running 4333
*ours per !ear at a CAN bus speed o0 233 bps wit* 425 bus load=
@-*is will result in 6 undetected error ever! 6333 !ears=
CAN $rotocol 5ersions
@-*e original CAN specifcations %$ersions 6=31 6=4 and 4=3A) speci0! an 66 bit message identifer= -*is is nown
as C&tandard CANC=
@-*ose Data Frames and Eemote Frames1 w*ic* contain an 667bit identifer are t*ere0ore called &tandard
Frames=
@However1 t*e 6N messages wit* t*e lowest priorit! %43I47439P) are reserved=
@&pecifcation $4=3A *as since been updated %to version 4=3B) to remove t*is possible message number
limitation and meet t*e &A" G6?I? standard 0or t*e use o0 CAN in trucs=
@$ersion 4=3B CAN is re0erred to as C"(tended CANC=
@"(tended Frames1 according to CAN specifcation $4=3 part B1 contain a 4?7bit identifer w*ic* allows 44? %over
2IN +illion) message identifers=
@-*e 4?7bit identifer is made up o0 t*e 667bit identifer %CBase .DC) and t*e 6:7bit "(tended .dentifer %C.D
"(tensionC)=
@CAN specifcation $ersion 4=3B still allows message identifer lengt*s o0 66 bits to be used=
@-*ere are t*ree diAerent t!pes o0 CAN modules available=
4=3A 7 Considers 4? bit .D as an error
4=3B #assive 7 .gnores 4? bit .D messages
4=3B Active 7 Handles bot* 66 and 4? bit .D +essages
@CAN modules specifed a0ter CAN $4=3 part A are onl! able to transmit and receive &tandard Frames according
to t*e &tandard CAN protocol=
@+essages using t*e 4?7bit identifer sent to a &tandard CAN module cause errors=
@.0 a device is specifed a0ter CAN $4=3 part B1 t*ereQs one more distinction= +odules named C$4=3B #assiveC can
onl! transmit and receive &tandard Frames but tolerate "(tended Frames wit*out generating "rror Frames=
@C$4=3B ActiveC devices are able to transmit and receive bot* &tandard and "(tended Frames=
@&iemens oAers $4=3B Active and $4=3B #assive devices=
Message Co"ing
@-*e CAN protocol uses Non7Eeturn7to7Hero or NEH bit coding= -*is means t*at t*e signal is constant 0or one
w*ole bit time and onl! one time segment is needed to represent one bit=
@Usually, but not always, a "zero" corresponds to a dominant bit, placing the bus in the dominant state, and a
"one" corresponds to a recessive bit, placing the bus in the recessive state.
Bit Stu4ng
@One c*aracteristic o0 Non7Eeturn7to7Hero code is t*at t*e signal provides no edges t*at can be used 0or
res!nc*roni,ation w*en transmitting a large number o0 consecutive bits wit* t*e same polarit!=
@-*ere0ore Bit stuDng is used to ensure s!nc*roni,ation o0 all bus nodes=
@-*is means t*at during t*e transmission o0 a message1 a ma(imum o0 fve consecutive bits ma! *ave t*e
same polarit!=
@B*enever fve consecutive bits o0 t*e same polarit! *ave been transmitted1 t*e transmitter will insert one
additional bit o0 t*e opposite polarit! into t*e bit stream be0ore transmitting 0urt*er bits=
@-*e receiver also c*ecs t*e number o0 bits wit* t*e same polarit! and removes t*e stuA bits again 0rom t*e
bit stream= -*is is called CdestuDngC=
Bit S1nchroni6ation
@.n contrast to man! ot*er feld buses1 CAN *andles message trans0ers s!nc*ronousl!=
@All nodes are s!nc*roni,ed at t*e beginning o0 eac* message wit* t*e frst 0alling edge o0 a 0rame w*ic*
belongs to t*e &tart O0 Frame bit=
@-*is is called Hard &!nc*roni,ation=
@-o ensure correct sampling up to t*e last bit1 t*e CAN nodes need to re7s!nc*roni,e t*roug*out t*e entire
0rame= -*is is done on eac* recessive to dominant edge=
Bit Construction
@One CAN bit time %or one *ig* or low pulse o0 t*e NEH code) is specifed as 0our non7overlapping time
segments=
@"ac* segment is constructed 0rom an integer multiple o0 t*e -ime Ruantum=
@-*e -ime Ruantum or -R is t*e smallest discrete timing resolution used b! a CAN node=
@.ts lengt* is generated b! a programmable divide o0 t*e CAN nodeQs oscillator 0re;uenc!=
@-*ere is a minimum o0 : and a ma(imum o0 42 -ime Ruanta per bit=
@-*e bit time1 and t*ere0ore t*e bit rate1 is selected b! programming t*e widt* o0 t*e -ime Ruantum and t*e
number o0 -ime Ruanta in t*e various segments=
S1nchroni6ation Seg&ent
@-*e frst segment wit*in a CAN bit is called t*e &!nc*roni,ation &egment and is used to s!nc*roni,e t*e
various bus nodes=
@On transmission1 at t*e start o0 t*is segment1 t*e current bit level is output=
@.0 t*ere is a bit state c*ange between t*e previous bit and t*e current bit1 t*en t*e bus state c*ange is
e(pected to occur wit*in t*is segment b! t*e receiving nodes=
@-*e lengt* o0 t*is segment is alwa!s 6 -ime Ruantum=
$ropagation Seg&ent
@-*e #ropagation -ime &egment is used to compensate 0or signal dela!s across t*e networ=
@-*is is necessar! to compensate 0or signal propagation dela!s on t*e bus line and t*roug* t*e electronic
inter0ace circuits o0 t*e bus nodes=
@-*is segment ma! be 6 to : -ime Ruanta long=
$hase Bu/er Seg&ent ' 7
@#*ase BuAer &egment 6 is used to compensate 0or edge p*ase errors= -*is segment ma! be between 6 to :
-ime Ruanta long and ma! be lengt*ened during res!nc*roni,ation=
$hase Bu/er Seg&ent ' .
@#*ase BuAer &egment 4 is also used to compensate 0or edge p*ase errors= -*is segment ma! be s*ortened
during res!nc*roni,ation=
Bit 8engthening
@As a result o0 res!nc*roni,ation1 #*ase BuAer &egment 6 ma! be lengt*ened or #*ase BuAer &egment 4 ma!
be s*ortened to compensate 0or oscillator tolerances wit*in t*e diAerent CAN nodes=
@.01 0or e(ample1 t*e transmitter oscillator is slower t*an t*e receiver oscillator1 t*e ne(t 0alling edge used 0or
res!nc*roni,ation ma! be dela!ed= &o #*ase BuAer &egment 6 is lengt*ened===
@ in order to adSust t*e sample point and t*e end o0 t*e bit time=
Bit Shortening
@.01 on t*e ot*er *and1 t*e transmitter oscillator is 0aster t*an t*e receiver oscillator1 t*e ne(t 0alling edge used
0or res!nc*roni,ation ma! be too earl!= &o #*ase BuAer &egment 4 in bit N is s*ortened===
@ in order to adSust t*e sample point 0or bit NT6 and t*e end o0 t*e bit time
S1nchroni6ation 9u&p !i"th
@-*e limit to t*e amount o0 lengt*ening or s*ortening o0 t*e p*ase buAer segments is set b! t*e
Ees!nc*roni,ation Gump Bidt*=
@-*e Ees!nc*roni,ation Gump Bidt* ma! be between 6 and 9 -ime Ruanta1 but it ma! not be longer t*an #*ase
BuAer &egment 4=
Bit (i&ing
@For man! CAN module implementations1 t*e #ropagation -ime &egment and #*ase BuAer &egment 6 are
combined1 0or ease o0 programming1 into one segment o0ten called -iming &egment 6=
@#*ase BuAer &egment 4 is t*en nown as -iming &egment 4=
!h1 $rogra& the Sa&ple $osition
@#rogramming o0 t*e sample point allows CtuningC o0 t*e c*aracteristics to suit t*e bus=
@"arl! sampling allows more -ime Ruanta in t*e #*ase BuAer &egment 4 so t*e &!nc*roni,ation Gump Bidt*
can be programmed to its ma(imum o0 9 -ime Ruanta=
@-*is ma(imum capacit! to s*orten or lengt*en t*e bit time decreases t*e sensitivit! to node oscillator
tolerances1 so t*at lower cost oscillators suc* as ceramic resonators ma! be used=
@Late sampling allows more -ime Ruanta in t*e #ropagation -ime &egment w*ic* allows a poorer bus topolog!
and ma(imum bus lengt*=
-elation Between Bau" -ate an" Bus 8ength
@-*e ma(imum CAN bus speed is 6 +Baud1 w*ic* can be ac*ieved wit* a bus lengt* o0 up to 93 meters w*en
using a twisted wire pair=
@For bus lengt*s longer t*an 93 meters t*e bus speed must be reduced=
@A 6333 meter bus can still be realised wit* a 23 OBaud bus speed=
@For a bus lengt* above 6333 meters special drivers s*ould be used=
CAN Bus 8ine Characteristics ' !ire" AND
@CAN is serial bus s!stem wit* one logical bus line= .t *as an open1 linear bus structure wit* e;ual bus nodes=
-*e number o0 nodes on t*e bus is not restricted b! t*e protocol and ma! be c*anged d!namicall! wit*out
disturbing t*e communication o0 ot*er nodes= -*is allows eas! connection and disconnection o0 bus nodes1 e=g=
0or addition o0 s!stem 0unction1 error recover! or bus monitoring=
@-*e CAN bus line *as two logic states/ a JrecessiveK state and a JdominantK state= -*e actual bus state is
Jwire7ANDK o0 all node states= -*is means1 t*at recessive bits %mostl!1 but not necessaril! e;uivalent to t*e
logic level C6C) are overwritten b! dominant bits %mostl! logic level C3C)= As long as no bus node is sending a
dominant bit1 t*e bus line is in t*e recessive state1 but a dominant bit 0rom an! bus node generates t*e
dominant bus state=
2SO $h1sical 8a1er
@-*ere0ore1 0or t*e CAN bus line1 a medium must be c*osen t*at is able to transmit t*e two possible bit states
JdominantK and JrecessiveK= One o0 t*e most common and c*eapest wa!s is to use a twisted wire pair= -*e bus
lines are t*en called CCANUHC and CCANULC= -*e two bus lines CANUH and CANUL are driven b! t*e nodes wit* a
diAerential signal= -*e twisted wire pair is terminated b! terminating resistors at eac* end o0 t*e bus line1
t!picall! 643 O*ms=
@But also an optical medium would be possible 0or CAN= .n t*is case1 t*e recessive state would be represented
b! t*e signal Jlig*t oAK1 t*e dominant state b! t*e signal Jlig*t onK=
CAN an" 3M2
@Due to t*e diAerential nature o0 transmission CAN is insensitive to electromagnetic inter0erence1 because bot*
bus lines are aAected in t*e same wa! w*ic* leaves t*e diAerential signal unaAected=
@-o reduce t*e sensitivit! against electromagnetic inter0erence even more1 t*e bus lines can additionall! be
s*ielded= -*is also reduces t*e electromagnetic emission o0 t*e bus itsel01 especiall! at *ig* baudrates=
Stan"er"i6ation 2ssues
@$e*icle bus s!stem applications can be separated in t*ree diAerent categories according to t*eir real7time
capabilities=
@Class A 0or a low speed bus wit* bit rates up to 63 bps1 e=g 0or bod! control applications1
@Class B 0or a low speed bus wit* bit rates 0rom 63 bps to 642 bps1 e=g= 0or das*board and diagnostics1
@Class C 0or a *ig* speed bus wit* bit rates 0rom 642 bps to 6 +bps 0or real time applications lie engine
management1 Fearbo(1 AB& etc=
@For t*e use o0 CAN in ve*icles two standards *ave been defned 0or t*e bus inter0ace/
@CAN Hig* &peed according to .&O7.& 66:?: 0or bit rates between 642 bps and 6 +bps
@CAN Low &peed according to .&O7.& 6626?74 0or bit rates up to 642 bps
$h1sical 8a1er Accor"ing to 2SO2S 77:;:
@-*is is t*e structure o0 a Controller Area Networ according to .&O7.& 66:?:= -*e bus lines ma! be up to 93 m
%6I3 0t) long at t*e ma(imum speed o0 6 +baud and are terminated b! termination resistors o0 643 O*ms= -*e
bus lines ma! be longer w*en decreasing t*e baud rate= Up to I3 nodes can be connected wit* CAN drivers
according to t*is standard= For t*e connection o0 more nodes1 stronger drivers or repeaters *ave to be used= -o
avoid re<e(ions t*e connection 0rom t*e bus lines to t*e nodes s*ould not e(ceed 3=I m %6 0t) at 6 +bps=
Bus 8evel accor"ing to 2SO2S 77:;:
@-*ese are t*e bus levels according to .&O7.& 66:?:= A recessive bit is represented b! bot* CAN bus lines
driven to a level o0 about 4=2 $ so t*at t*e diAerential voltage between CANUH and CANUL is around 3 $=
@A dominant bit is represented b! CANUH going to about I=2 $ and CANUL going to about 6=2 $= -*is results in a
diAerential voltage 0or a dominant bit o0 about 4$=
CAN Bus connectors accor"ing to CiADS 7<.7
@-o be able to use CAN as a industrial feld bus in an open s!stem t*e CAN in Automation userLs group CiA
created a standard called CiA D& 63476 w*ic* is based on t*e 66:?:7standard= One important issue in t*is
standard is t*e proposal to use a ?7pole &UB7D connector 0or t*e connection o0 nodes to t*e CAN bus lines=
@-*e bus signals CANUH and CANUL are available on pins P and 4= -*e ot*er pins serve as power or ground
wires or are reserved 0or 0uture e(tensions o0 t*e standard=
(1pical CAN 2&ple&entation
@A t!pical CAN node used to control a certain application consists o0 diAerent devices=
@-*e application itsel0 is controlled b! a microcontroller1 e=g= t*e &iemens &AB :3C6NN=
@-o be able to participate in t*e CAN communication1 t*e microcontroller *as to be connected to a CAN protocol
controller1 e=g= t*e &iemens stand7alone Full7CAN controller :6C?3'?6=
@-o meet t*e re;uirements o0 e=g= t*e .&O 66:?: CAN standard1 a CAN transceiver c*ip is used to connect t*e
node to t*e CAN bus lines=
@A more sop*isticated wa! is to use a microcontroller w*ic* alread! *as a CAN protocol controller on7c*ip1 e=g=
one o0 t*e &iemens :3267compatible :7bit microcontrollers 0rom t*e C233 0amil! lie t*e C232C or t*e C262C=
For applications w*ic* need *ig*er per0ormance1 one o0 t*e 6N7bit C6NN70amil! members wit* integrated CAN
module could be used1 e=g= t*e C6N9C. or t*e C6NPCE= -*is saves costs as t*e printed circuit board space is
used more eDcientl! and t*e user does not *ave to worr! about setting up t*e communication between t*e
microcontroller and t*e CAN controller=
Basic CAN Controller
@-*ere is one more CAN c*aracteristic concerning t*e inter0ace between t*e CAN protocol controller and t*e
*ost C#U1 dividing CAN c*ips into CBasic7CANC and CFull7CANC devices= -*is *as not*ing to do wit* t*e used
protocol $ersion t*oug*1 w*ic* maes it possible to use bot* Basic7CAN and Full7CAN devices in t*e same
networ=
@.n t*e Basic7CAN devices1 onl! basic 0unctions concerning t*e fltering and management o0 CAN messages are
implemented in *ardware= A Basic7CAN controller t!picall! provides one transmit buAer 0or outgoing messages
and one or two receive buAers 0or incoming messages= .n t*e receive pat*1 an acceptance fltering is available
w*ic* allows t*at onl! certain CAN identifers are stored in t*e receive buAer=
@Because t*ere are onl! two buAers 0or t*e reception o0 messages t*e *ost controller is ;uite bus! reading and
storing t*e incoming messages be0ore t*e! get overwritten b! t*e 0ollowing ones w*ic* results in a ;uite *ig*
C#U load= Also t*e answering o0 Eemote Frames wit* t*e corresponding Data Frame *as to be *andled b! t*e
*ost controller= -*ere0ore Basic7CAN devices s*ould onl! be used at low baudrates and low bus loads wit* onl! a
0ew diAerent messages=
%ull CAN Controller
@Full7CAN devices provide t*e w*ole *ardware 0or convenient acceptance fltering and message management=
For eac* message to be transmitted or received t*ese devices contain one so called message obSect in w*ic*
all in0ormation regarding t*e message %e=g= identifer1 data b!tes etc=) are stored= During t*e initialisation o0 t*e
device1 t*e *ost C#U defnes w*ic* messages are to be sent and w*ic* are to be received= Onl! i0 t*e CAN
controller receives a message w*ose identifer matc*es wit* one o0 t*e identifers o0 t*e programmed %receive7)
message obSects t*e message is stored and t*e *ost C#U is in0ormed b! interrupt= Anot*er advantage is t*at
incoming Eemote Frames can be answered automaticall! b! t*e Full7CAN controller wit* t*e corresponding Data
Frame= .n t*is wa!1 t*e C#U load is strongl! reduced compared to t*e Basic7CAN solution= Using Full CAN
devices1 *ig* baudrates and *ig* bus loads wit* man! messages can be *andled=
@+an! Full7CAN controller provide a CBasic7CAN7FeatureC/ One o0 t*eir message obSects be*aves lie a Basic7
CAN Eeceive BuAer1 i=e= it can be programmed in a wa! t*at ever! message is stored t*ere t*at does not matc*
wit* one o0 t*e ot*er message obSects= -*is can be ver! *elp0ul in applications w*ere t*e number o0 message
obSects is not enoug* to receive all desired messages=
Buil"ing 5er1 8arge CANs
S$O-AD2C %-AM3 in 82N
A sporadic 0rame is a signal7carr!ing 0rame similar to unconditional 0rames1 but onl! trans0erred in its 0rame slot
i0 one o0 its signals is updated b! t*e publis*er
353N( (-2==3-3D %-AM3 in 82N
An event triggered 0rame is used as a Jplace*olderK to allow multiple slave nodes to provide its response= -*is
is use0ul w*en t*e signals involved are c*anged in0re;uentl!
82N =8OSSA->
82N =lossar1
active
-*e nodes o0 t*e cluster communicate wit* eac* ot*er
as a cluster=
bus inter0ace
-*e logic %transceiver1 UAE-1 etc=) o0 a node t*at is
connected to t*e p*!sical bus wire in a cluster=
b!te feld
"ac* b!te on t*e L.N bus is sent in a b!te feldV t*e
b!tefeld includes t*e start bit and stop bit transmitted=
c*ecsum model
-wo c*ecsum models are defnedV classic c*ecsum
and en*anced c*ecsum1 en*anced includes t*e
protected identifer in t*e c*ecsum1 classic does not=
classic c*ecsum
-*e c*ecsum used in earlier L.N versions and 0or
diagnostic0rames/ .t is summed over t*e data b!tes
onl!=
cluster A cluster is t*e L.N bus wire plus all t*e nodes=
data
-*e response o0 a L.N 0rame carries one to eig*t b!tes
o0 data1 collectivel! called data=
data b!te One o0 t*e b!tes in t*e data=
diagnostic 0rame
-*e master re;uest 0rame and slave response 0rame
are called diagnostic 0rames
en*anced c*ecsum
A new c*ecsum wit* slig*tl! better per0ormance/ .t
includes t*e protected identifer in t*e sum1 not onl!
data b!tes= -*e en*anced c*ecsum is used 0or
communication wit* L.N 4=3 slave nodes=
event triggered 0rame
An event triggered 0rame is used as a Jplace*olderK to
allow multiple slave nodes to provide its response= -*is
is use0ul w*en t*e signals involved are c*anged
in0re;uentl!=
0rame
All in0ormation is sent paced as 0ramesV a 0rame
consist o0 t*e *eader and a response=
0rame slot
-*e time period reserved 0or t*e trans0er o0 a specifc
0rame on t*e L.N bus= Corresponds to one entr! in t*e
sc*edule table=
go7to7sleep7command
A special diagnostic 0rame issued to 0orce slave nodes
to sleep mode=
b!te feld
"ac* b!te on t*e L.N bus is sent in a b!te feldV t*e
b!te feld includes t*e start bit and stop bit
transmitted=
*eader
A *eader is t*e frst part o0 a 0rameV it is alwa!s sent b!
t*e master tas=
identifer -*e identit! o0 a 0rame in t*e range 3 to NI=
L.N Description File
-*e LDF fle is created in t*e s!stem defnition and
parsed in t*e s!stem generation or b! debugging tools=
L.N #roduct .dentifcation A uni;ue number 0or eac* L.N node=
master node
-*e master node not onl! contains a slave tas1 but
alsot*e master tas t*at is responsible 0or sending all
0rame *eaders on t*e bus1 i=e= it controls t*e timing and
sc*edule table 0or t*e bus=
master re;uest 0rame
-*e master re;uest 0rame *as identifer N3 and is used
0or diagnostic 0rames issued b! t*e master node=
master tas
-*e master tas is responsible 0or sending all 0rame
*eaders on t*e bus1 i=e= it controls t*e timing and
sc*edule table 0or t*e bus=
message identifer
"ac* 0rame in a slave node *as a uni;ue 6N bit
messagenumber= During node confguration t*is
number is associated wit* a protected identifer1 w*ic*
is t*en used in t*e normal communication wit* t*e
node=
NAD
Node Address 0or Diagnostic= Diagnostic 0rames are
broadcastedand t*e NAD specifes t*e addressed slave
node= -*e NAD is bot* t*e p*!sical address and t*e
logical address=
Node
Loosel! speaing1 a node is an "CU %electronic control
unit)= However1 a single "CU ma! be connected to
multiple L.N clustersV in t*e latter case t*e term node
s*ould be replaced wit* bus inter0ace=
Node Capabilit! File
A NCF fle describes a slave node as seen 0rom t*e L.N
bus= .t is used in t*e s!stem defnition=
protected identifer -*e identifer %N bit) toget*er wit* its two parit! bits=
#ublis*
A signal %or an unconditional 0rame) *ave e(actl! one
publis*erV t*e node t*at is t*e source o0 t*e
in0ormation1 compare wit* subscribe=
Ee;uest
-*e master node puts re;uest on t*e slave nodes in
node confguration and in t*e diagnostic transport
la!er=
reserved 0rame
Eeserved 0rames *ave an identifer t*at s*all not be
used/ NI %3(I0)=
response
%6) A L.N 0rame consists o0 a *eader and a response=
Also called a Frame response=
%4) -*e repl! message 0or an .&O re;uest is a response=
Also called a Diagnostic response=
sc*edule table
-*e sc*edule table determines t*e traDc on t*e L.N
bus=
slave node
A node t*at contains a slave tas onl!1 i=e= it does not
contain a master tas=
slave response 0rame
-*e slave response 0rame *as identifer N6 and is used
0or diagnostic 0rames issued b! one o0 t*e slave nodes=
slave tas -*e slave tas is responsible 0or listening to all 0rame
*eaders on t*e bus and react accordingl!1 i=e= eit*er
publis* a 0rame response or subscribe to it %or ignore
it)=
sleep mode No communication occurs in t*e cluster=
signal
A signal is a value transported in t*e L.N cluster using a
signal7carr!ing 0rame=
signal7carr!ing 0rame
A 0rame t*at carries signals s*all *ave an identifer in
t*e range 3 to 2? %3(Ib)= unconditional 0rames1
sporadic 0rames and event triggered 0rames are signal7
carr!ing 0rames=
sporadic 0rame
A sporadic 0rame is a signal7carr!ing 0rame similar to
unconditional 0rames1 but onl! trans0erred in its 0rame
slot i0 one o0 its signals is updated b! t*e publis*er=
subscribe
&ubscribe is t*e opposite o0 publis*1 i=e= to receive a
signal %or a signal7carr!ing 0rame)=
s!stem defnition -*e process o0 creating t*e L.N Description File=
s!stem generation
-*e process o0 targeting one %or multiple) o0 t*e nodes
in t*e cluster to t*e L.N Description File
unconditional 0rame
A signal7carr!ing 0rame t*at is alwa!s sent in its
allocated 0rame slot=
user7defned 0rame
A 0rame wit* identifer N4= .ts purpose or usage is not
part o0 t*e L.N specifcation

You might also like