Can Can (Cont Rol L Erareanet Work)
Can Can (Cont Rol L Erareanet Work)
CAN(
Cont
rol
lerAr
ea Net
wor
k):CAN i
sa Aut
omot
ivest
andar
d pr
otocol
.Iti
sa ser
ial
asynchronous(InCAN thedat
at r
ansmissi
onisnotbasedonCl ock( l
ikeinSPI)soCAN is
asynchronous.I
nsteadofCl
ockitisbasedonTimequanta)prot
ocol.Bitrat
eisupto1Mbps
and lengthisup to 40m. wheneverspeed i
s500 kbpst hen l
engthi s100m,250kbps-
200m…………upt o10kbps-
6km.
Ifi
tis1Mbpst
hen40m,500Kbps-100m………………. 10Kbps-
6km whyt
her easoni
sDuet oRLCi n
thecir
cui
tL(I
nduct
ance)doesn’
tallow suddenchangesi nt
hecurrentandC( Capaci
tance)
doesn’
tal
lowt
hesuddenchangesinthevoltages.
Thesingl
eframecancar r
ydataupt o7bytes.Ift
hedat aismoret
han7byt esthef i
rstfr
ame
canindi
catetheremainingdat
aal ongwiththecarryofthesomeinit
ialdat
a.Theflowcont r
ol
i
sresponsefrom therecei
veracknowledgi
ngt hefi
rstfr
amealongwiththeindi
cat
ionofBl ock
si
zeandmi nimum separati
onti
mebet weent heconsecuti
vef
rames.Theconsecut
ivef r
amei s
afr
amecont aini
ngthesubsequentdata.
CAN whyi
tis2-wir
einter
face:fordif
ferenti
al voltage.CAN i
stwowi r
einter
facethedata
tr
ansmi
ssi
onison2wi resi.
e.,CAN_HandCAN_ L.Ifthedat
aistransmit
ti
ngb/wt wowires
someamountofnoi
seisaddedinwi r
ei.e.,
CAN_Ht hesameamountwi l
lbeaddedont heot
her
si
dewit
hopposi
te.
I
nCAN_
Hthenoi
se+dat
a +a
I
nCAN_
Lthenoi
se+dat
a +b
Thedi
ff
erent
ialvol
tage( +a)
-( +b)
=a-
b
Pl
andat
awewi
llgett
hat
’swhyCANi
s2-
wir
eint
erf
ace.
CANphysi
call
ayervol
tages:
CANdomi
nantvol
tagesar
efr
om 1.
5vt
o3.
5v.
CANr
ecessi
vevol
tage2.
5v.
Whyl ikethi
swheni tisindominant1.
5-3.
5whenr ecessive2.5andthe2wi r
esar eCAN_Hand
CAN_ Lar e2.5vwhen r ecessi
ve.Ther eason i
sever yCAN t r
ansceiverishaving i
nternal
transi
storthet r
ansist
orsaredoesn’tall
ow thevoltage/powertransmissi
onswheni tisi n
recessive(i
.e.
,1).I
tall
owsonl ywhendomi nant(i
.e.
,0).Andt hevoltagedif
ferencebetween
CAN_ H andCAN_ Liswhenever>0.9thenonlyitidenti
fiest
hebi ttr
ansmissionisdomi nant
otherwise(i
.e.
,
<0.9)iti
srecessi
ve.
CANi
stwof
ormat
s:St
andar
dfor
mat(
11-
bitI
dent
if
ier
)andExt
endedf
ormat(
29-
BitI
dent
if
ier
).
CANFr
amef
ormat
:
Dat
aFr
ame:
I
tcar
ri
esdat
afr
om t
ransmi
tt
ert
other
ecei
ver
.
SOF:I sal
waysdominant(
low(0)
).
,becauseal
lnodesaresynchr
onizedwit
hinthissegment
only.Onedgei
sexpectedt
oliewit
hinthi
ssegmentonl
y.TheHardsynchr
onizat
ionisdonein
theSOF.
Ar
bit
rat
ion:t
hei
dent
if
ieroft
hemessage.
Whati
smeanbyar
bit
rat
ion?
InCANi fbusisidleanynodecant r
ansmitdatai
ftwoormor
enodest ransmitti
ngthedataat
thesamet i
met hebusconf li
ctwil
loccuraccordi
ngtothearbi
trat
iont hehighestpri
ori
ty
messagewi l
lbet r
ansmitt
edfir
st.Hi
ghestpri
ori
tymeanst
helowestnumer icvaluewi
llbethe
highestpr
ior
ityi
.e.
,dominantbi
t.
RTR:(
remot
etr
ansmi
ssi
onr
equest
)iszer
o(domi
nant
)fordat
afr
ame1(
recessi
ve)f
orr
emot
e
fr
ame.
I
fwetransmitt
ingdat
aandremotef
ramet hendataf
ramewi
llbet
ransmi
tt
edf
ir
stbecause
RTRi
s0f ordatafr
amewhi
chist
hehighestpr
ior
it
y.
IDE:( I
denti
fi
erExt
ensi
on Bi
t)I
s0(
domi
nant
)forst
andar
dfor
matand 1(
recessi
ve)f
or
extendedformat
.
I
fwetransmit
ti
ngSt
andardandext
endeddataf
ramethenstandar
df r
amewi
llbet
ransmi
tt
ed
f
ir
stbecauseI
DEis0forst
andar
dformatwhi
chi
sthehighestpr
ior
it
y.
Domi
nanti
sthest
andar
dfor
matandr
ecessi
vei
stheext
endedf
ormat
.
Contr
olfi
eld:Totalof6bi
tsinthis4bit
sareusedforDLC(Dat
alengt
hcode)fr
om 0000to
1000accor
dingto8421code(possibl
eupto8byt
es)
.Reser
ved2bit
sarer1andr
0instandar
d
for
matr1isforIDEandr0i
sreserved.
Dat
afi
eld:
isupt
o8byt
esdat
atr
ansmi
ssi
on.Fr
om 0t
o64bi
tsofdat
atr
ansmi
ssi
on.
CRC:(Cycl
icredundancycheck)i
sof16bi
ts.15bi
tCRCand1del
imi
ter
.Pol
ynomi
ali
sused
forCRCchecking.
ACK:2bi t
s.ACK Sl
otandACK del i
miter
.InACK f i
eldthetransmit
ti
ngnodesendst wo
recessi
vebitsi
ftherecei
vingnodesuccessf
ulrecept
ionofmessagei twil
lindicat
etothe
t
r ansmi
tti
ngnodebysendi
ngdominantbi
ttotheACKsloti.
e.,
suppressi
onoft
her ecessi
vebi
t.
EOF:(
Endoff
rame)7r
ecessi
vebi
ts.
I
FS:(
Int
erf
rameSpace)3bi
tsl
ong.
Theset
wof
iel
dsEOFandI
FSar
etoi
ndi
cat
etheBUSI
dlecondi
ti
on.
Remot
efr
ame:RTRi
s1(
recessi
ve)
.Int
hist
her
eisnodat
afi
eld.
To requestthe transmissi
on ofthe dat
af r
ame wi t
ht he same i
dent
if
ier.Mostoft hem
recommendedt hatdon’tusetheremotefr
ameinsteadofrequestt
hedataputtheresponsei
n
thebus.Ifweareput ti
ngthedataonthebusthenanynodeneedst hedat
at hent
hatnodecan
takeiteasi
lyunnecessarytr
ansmissi
onofremotef
r ame.
Er
rorFr
ame:
I
tist
ransmi
tt
edbyanynodebydet
ect
ingt
heer
roront
hebus.
Ifer
rorisdet
ecteditcanput6err
orfl
agsonthebus.Upt
o12err
orf
lagsispossi
ble.Af
ter6
dominantbit
sdon’ tputtheerr
orframeifalso t
heerr
orf
rameisdetect
ed waitforthe
successf
ultr
ansmissi
onofthemessage.
Err
orCounters:TECandREC(transmiter
rorcounterandrecei
veerr
orcounter
)wheni ti
sin96
warni
ngli
mi tandTECandRECar e>127thenitisinerr
orpassivest
ate.TEC>256thenitisin
busoffst
ate.Anodei nbusof
ftocomebackt oer r
oracti
vestatewai
tforthe128occurrences
of11consecutivebi
ts.
ORmostprefer
ableanswerf
ort
heinter
vieweri
swecanr
esetbyt
hesof
twar
ei.
e.,
CAN_
Reset
APIi
nthedri
verdevel
opmentmodul
e.
TypesofEr
ror
s:
BitErr
or:Wheneveranodet r
ansmi tt
ingt hedat
aiti
salsomoni
torsthedat
aunt i
ltherecei
ver
recei
vesthedata.Itisexpectedt hatt hedatatobesameunt i
lthereceiverr
eceives.For
exampleifthenodeistr
ansmi tt
ing0( dominant
)tothebusanditisdet
ected1(recessi
ve)in
thebustheniti
sbiter
ror
.
ACKErr
or:whenevert
het
ransmi
tt
ingnodedoesn’
tmoni
tort
hedomi
nantbi
tint
heACKsl
ot
t
heni
tisACKerror.
St
uffErr
or:Af
ter5consecut
ivebi
t he6thbi
st twi
llbei
nver
t(opposi
t he5thbi
e)oft tot
her
wisei
t
wi
llbeStuf
fErr
or.
Normal
lythedatafr
amewi l
lbe108bi t
sforst
andar
dformatand108+18fort
heext
ended
for
matbutthet
wostandar
dandextendedfor
matsar
evar
ied(t
otalbi
tsi
nbot
hfor
mat
s)based
onnumberofst
uffbi
tsi
nsert
ed.
Thestuffbi
tsi
nser
tedbecausef
ortheer
rordet
ect
ion.Af
ter5consecut
ivebi
tsi
fweare
t
h t
h
i
nsert
ingthe6 bitopposi
tetothe5 bi
tonedgei soccurr
edtheResynchr
oni
zat
ioni
s
possi
ble.
TheResynchr
oni
zat
ioni
sfort
heer
rordet
ect
ion.
Synchr
oni
zat
ion:I
tist
heco-
ordi
nat
ionofevent
s.
CANisbasedonNRZsi
gnal
ingwhybecauset
hebi
tti
mei
sconst
antf
ort
he1successf
ulbi
t
l
evel
.
I
nRZsignal
ingsynchroni
zat
ionpossi
blei
sveryeasybutCANischosenonl
yNRZ.Becausei
n
CANbi
tti
mecalculat
iontheenti
rebi
tti
meisconstantf
oronebi
tlevel
.
Form Err
or:InCANf ormatsthefi
xedformatsbit
sar eCRCDel i
mi t
er,ACKDel
imit
erandEOF
thesearefixedformatfiel
dsalwaysrecessi
vefortheresynchr
onizati
on.I
fanyofthebi
tsar
e
dominantthenitisform er
ror
.
CRCErr
or:Ther
esul
toftheCRCcal
cul
ati
onbyt
ransmi
tt
ingsi
deandr
ecei
vingsi
dei
snot
samet
heniti
sCRCer
ror
.
Over
loadf
rame:
I
tisl
ikeI
FS(
int
erf
ramespace)t
opr
ovi
det
hedel
aybet
weent
he2dat
afr
ames.
Bi
tti
mingCal
cul
ati
oni
nCAN:
I
nbi
tti
mingcal
cul
ati
ont
heCANbi
tti
mingi
sCompr
isedi
ntof
oursegment
s.
Synchroni
zati
onsegment
:thi
sis1TQl ong.Anedgei
sli
ewi
thi
nthi
ssegmentonl
y.TheHar
d
synchr
onizat
ioni
sdonewit
hinthi
ssegmentonly.
TQ:(
Timequant
a)I
tisaf
ixeduni
toft
imeder
ivedf
rom t
hemast
ercl
ock.
1Ti
mequant
aisequalto1clockper
iod.I
tis1f ort
hesynchr
oni
zat
ionsegmentand1TQt
o8
TQf
orPr
opagat
ionsegmentandPhasebuffersegment
s.
Ift
heCANbitrat
eis1MbpsthenTQi
s12ot
hert
hanal
lbi
trat
es(
500kbpst
o10kbps)t
het
ime
quant
ais12anditi
sfi
xed.
Pr
opagat
ionSegment
:Thephysi
cal
del
ayadj
ust
ment
s.
Phase Buff
erSegment -
1 and Phase Buff
erSegment -
2:The phase er
roradj
ust
ment
s
l
engthenedorshor
thandbasedont
heSJW (synchr
oni
zat
ionjumpwidt
h).
SamplePoint:I
tist
oindi
catewherethebusl
eveli
sread.I
tisaft
ert
hephasebuf
fersegment-
1andbef orethephasebuffersegment-
2.I
tistobeadj ust
edbasedont hephasebuffer
segment
-1andphasebuffersegment
-2.