Messageframing
MessagesinCANaresentinaformatcalledframes.Aframeisdefinedstructure,carryingmeaningfulsequenceofbit
orbytesofdatawithinthenetwork.FramingofmessageisdonebyMACsublayerofDataLinkLayer.Therearetwo
typeofframesstandardorextended.Theseframescanbedifferentiatedonthebasisofidentifierfields.ACANframe
with11bitidentifierfieldscalledStandardCANandwith29bitidentifierfieldiscalledextendedframe.
Standardframe
VariousfieldsinstandardCANareasfollows-
SOF-StartofFramebit.Itindicatesstartofmessageandusedtosynchronizethenodesonabus.Adominantbit
inthefieldmarksthestartofframe.
IDENTIFIER-Itservesdualpurposeone,todeterminewhichnodehasaccesstothebusandsecondtoidentifythe
typeofmessage.
RTR-RemoteTransmissionRequest.Itidentifieswhetherit’sadataframeoraremoteframe.RTRisdominantwhen
itisadataframeandrecessivewhenitisaremoteframe.
IDE–IdentifierExtension.Itisusedtospecifytheframeformat.Dominantbitisforstandardframeandrecessivefor
extendedframe.
R0-Reversedbit.Notusedcurrentlyandkeptforfutureuse.
DLC–DataLengthCode.Itis4bitdatalengthcodethatcontainsthenumberofbytesbeingtransmitted.
DATA–Usedtostoreupto64databitsofapplicationdatatobetransmitted.
CRC–CyclicRedundancyCheck.The16-bit(15bitsplusdelimiter)cyclicredundancycheck(CRC)containsthe
checksumoftheprecedingapplicationdataforerrordetection.
ACK–Acknowledge(ACK)field.ItcompromisesoftheACKslotandtheACKdelimiter.Whenthedataisreceived
correctlytherecessivebitinACKslotisoverwrittenasdominantbitbythereceiver.
EOF–EndofFrame(EOF).The7-bitfieldmarkstheendofaCANframe(message)anddisables
Bit-stuffing,indicatingastuffingerrorwhendominant.
IFS-InterFrameSpacethatspecifiesminimumnumberofbitsseparatingconsecutivemessages.Itprovidesthe
intermissionbetweentwoframesandconsistsofthreerecessivebitsknownasintermissionbits.Thistimeallowsnodes
forinternalprocessingbeforethestartofnextframe.
EXTENDEDCAN
Itissameas11-bitidentifierwithsomeaddedfields
SRR-SubstituteReverseRequest.TheSRRbitisalwaystransmittedasarecessivebittoensurethat,inthecaseof
arbitrationbetweenaStandardDataFrameandanExtendedDataFrame,theStandardDataFramewillalwayshave
priorityifbothmessageshavethesamebase(11bit)identifier.
R1-Itisanotherbitnotusedcurrentlyandkeptforfutureuse.
Messageframe
Therearefourdifferentframeswhichcanbeusedonthebus.
Dataframes-Thesearemostcommonlyusedframeandusedwhenanodetransmitsinformationtoanyorallother
nodesinthesystem.DataFramesconsistoffieldsthatprovideadditionalinformationaboutthemessageasdefinedby
theCANspecification.EmbeddedintheDataFramesareArbitrationFields,ControlFields,DataFields,CRCFields,a
2-bitAcknowledgeFieldandanEndofFrame.
·Remoteframes-Thepurposeoftheremoteframeistoseekpermissionforthetransmissionofdatafrom
anothernode.ThisissimilartodataframewithoutdatafieldandRTRbitisrecessive.Forexample,themicroprocessor
controllingthecentrallockingonyourcarmayneedtoknowthestateofthetransmissiongearselectorfromthepower
traincontroller.
·Errorframes–Iftransmittingorreceivingnodedetectsanerror,itwillimmediatelyaborttransmissionandsend
errorframeconsistingofanerrorflagmadeupofsixdominantbitsanderrorflagdelimitermadeupofeight
recessivebits.TheCANcontrollerensuresthatanodecannottieupabusbyrepeatedlytransmittingerrorframe.
·Overloadframe-Itissimilartoerrorframebutusedforprovidingextradelaybetweenthemessages.An
Overloadframeisgeneratedbyanodewhenitbecomestoobusyandisnotreadytoreceive.
Arbitration
Itisamechanismwhichresolvestheconflictwhentwoormorenodestrytosendthemessageatthesame
time.Inthistechniquewheneverthebusisfreeanyunitcantransmitamessage.Iftwoormoreunitsstartstransmitting
atthesametimeaccesstothebusisconflicted,butthisproblemcanbesolvedbyarbitrationusingidentifier.During
arbitrationeverytransmittercomparesthevalueoftransmittedbitwithbitvalueonthebus.Ifthebitvalueissame,the
nodecontinuestosendthebits.Butatanytimeiftransmittedbitvalueisdifferentfrombusvaluethedominantbit
overwritestherecessivebits.ThearbitrationfieldoftheCANmessageconsistsofan11-or29-bitidenti?eranda
remotetransmission(RTR)bit.Theidentifierhavinglowestnumericalvaluehasthehighestpriority.RTRsimply
distinguishesbetweenremoteframeforwhichRTRisrecessiveanddataframeforwhichRTRisdominant.Ifbothdata
frameandremoteframewiththesameidentifierisinitiatedatthesametimedataframewillprevailoverremoteframe.
Withtheconceptofarbitrationneitherinformationnortimeislost.
CANasaCSMAprotocol
CSMAisacarriersense,multiple-accessprotocolinwhichnodeverifiestheabsenceoftrafficbefore
transmittingonasharedmediumsuchaselectricalbus.InCSMAeachnodeonabuswaitsforaspecifictime
beforesendingthemessage.Oncethiswaitperiodisovereverynodehasequalopportunitytosendthemessage.
Basedonpre-programmedpriorityofeachmessageinidentifierfieldi.e.highestpriorityidentifierwinsthebusaccess.
ItisimplementedonthephysicallayerofOSImodel.LetusunderstandCSMAwithanexample.Inadiscussionevery
persongetsanequalopportunitytovoicetheirthoughtshoweverwhenapersonistalkingotherskeepquietandlistens
andwaitsfortheirchancetospeak(carriersense).Butiftwoormorepeoplestartspeakingatthesametimethenthey
detectthefactandquitspeaking(collisiondetection).
|
|