CAN总线物理层.docx
《CAN总线物理层.docx》由会员分享,可在线阅读,更多相关《CAN总线物理层.docx(9页珍藏版)》请在冰豆网上搜索。
CAN总线物理层
CANPhysicalLayer
TheControllerAreaNetwork(CAN)protocoldefinesthedatalinklayerandpartofthephysicallayerintheOSImodel,whichconsistsofsevenlayers.TheInternationalStandardsOrganization(ISO)definedastandard,whichincorporatestheCANspecificationsaswellasapartofphysicallayer:
thephysicalsignaling,whichcomprisesbitencodinganddecoding(NonReturntoZero,NRZ)aswellasbit-timingandsynchronization.
Bitencoding
NRZcomparedwithManchesterbitrepresentation
InthechosenNonReturntoZero(NRZ)bitcodingthesignallevelremainsconstantoverthebittimeandthusjustonetimeslotisrequiredfortherepresentationofabit(othermethodsofbitencodingaree.g.ManchesterorPulse-width-modulation).Thesignallevelcanremainconstantoveralongerperiodoftime;thereforemeasuresmustbetakentoensurethatthemaximumpermissibleintervalbetweentwosignaledgesisnotexceeded.Thisisimportantforsynchronizationpurposes.Bitstuffingisappliedbyinsertingacomplementarybitafterfivebitsofequalvalue.Ofcoursethereceiverhastoun-stuffthestuff-bitssothattheoriginaldatacontentisprocessed.
Bit-timingandsynchronization
Nominalbit-time
Onthebit-level(OSIlayer1,physicallayer)CANusessynchronousbittransmission.Thisenhancesthetransmittingcapacitybutalsomeansthatasophisticatedmethodofbitsynchronizationisrequired.Whilebitsynchronizationinacharacter-orientedtransmission(asynchronous)isperformeduponthereceptionofthestartbitavailablewitheachcharacter,asynchronoustransmissionprotocolthereisjustonestartbitavailableatthebeginningofaframe.Toenablethereceivertocorrectlyreadthemessages,continuousresynchronizationisrequired.Phasebuffersegmentsarethereforeinsertedbeforeandafterthenominalsamplepointwithinabitinterval.
TheCANprotocolregulatesbusaccessbybit-wisearbitration.Thesignalpropagationfromsendertoreceiverandbacktothesendermustbecompletedwithinonebit-time.Forsynchronizationpurposesafurthertimesegment,thepropagationdelaysegment,isneededinadditiontothetimereservedforsynchronization,thephasebuffersegments.Thepropagationdelaysegmenttakesintoaccountthesignalpropagationonthebusaswellassignaldelayscausedbytransmittingandreceivingnodes.
Twotypesofsynchronizationaredistinguished:
hardsynchronizationatthestartofaframeandresynchronizationwithinaframe.
∙Afterahardsynchronizationthebittimeisrestartedattheendofthesyncsegment.Thereforetheedge,whichcausedthehardsynchronization,lieswithinthesyncsegmentoftherestartedbittime.
∙Resynchronizationshortensorlengthensthebittimesothatthesamplepointisshiftedaccordingtothedetectededge
Thedevicedesignermayprogramthebit-timingparametersintheCANcontrollerbymeansoftheappropriateregisters.
Interdependencyofdatarateandbuslength
Dependingonthesizeofthepropagationdelaysegmentthemaximumpossiblebuslengthataspecificdatarate(orthemaximumpossibledatarateataspecificbuslength)canbedetermined.Thesignalpropagationisdeterminedbythetwonodeswithinthesystemthatarefarthestapartfromeachother.Itisthetimethatittakesasignaltotravelfromonenodetotheonefarthestapart(takingintoaccountthedelaycausedbythetransmittingandreceivingnode),synchronizationandthesignalfromthesecondnodetotravelbacktothefirstone.Onlythencanthefirstnodedecidewhetheritsownsignallevel(recessiveinthiscase)istheactuallevelonthebusorwhetherithasbeenreplacedbythedominantlevelbyanothernode.Thisfactisimportantforbusarbitration.
Somemoderntransceiverssupportnolowdatarates.Thereforeonacquisitionoftransceiversthemaximalrequirednetworklengthmustbeconsidered.
Physicalmedia
Thisclauseismostinterestingforsystemdesigners.
ThebasisfortransmittingCANmessagesandforcompetingforbusaccessistheabilitytorepresentadominantandarecessivebitvalue.Thisispossibleforelectricalandopticalmediasofar.Alsopowerlineandwirelesstransmissionispossible.
ForelectricalmediathedifferentialoutputbusvoltagesaredefinedinISO11898-2andISO11898-3,inSAEJ2411,andISO11992(seebelow).
Withopticalmediatherecessivelevelisrepresentedby"dark"andthedominantlevelby"light".
ThephysicalmediamostcommonlyusedtoimplementCANnetworksisadifferentiallydrivenpairofwiredwithcommonreturn.Forvehiclebodyelectronicssinglewirebuslinesarealsoused.SomeeffortshavebeenmadetodevelopasolutionforthetransmissionofCANsignalsonthesamelineasthepowersupply.
Theparametersoftheelectricalmediumbecomeimportantwhenthebuslengthisincreased.Signalpropagation,thelineresistanceandwirecrosssectionsarefactorswhendimensioninganetwork.Inordertoachievethehighestpossiblebitrateatagivenlength,ahighsignalspeedisrequired.Forlongbuslinesthevoltagedropsoverthelengthofthebusline.Thewirecrosssectionnecessaryiscalculatedbythepermissiblevoltagedropofthesignallevelbetweenthetwonodesfarthestapartinthesystemandtheoverallinputresistanceofallconnectedreceivers.Thepermissiblevoltagedropmustbesuchthatthesignallevelcanbereliablyinterpretedatanyreceivingnode.
Theconsiderationofelectromagneticcompatibilityandchoiceofcablesandconnectorsbelongsalsotothetasksofasystemintegrator.
assumedlinelength100m
Specificsignalpropagationtime(ns/m)
Maximumbitrate(kbit/s)
5.0
80
5.5
73
6.0
67
6.5
62
7.0
58
Networktopology
Thisclauseismostinterestingforsystemdesigners.
Electricalsignalsonthebusarereflectedattheendsoftheelectricallineunlessmeasuresagainstthathavebeentaken.Forthenodetoreadthebuslevelcorrectlyitisimportantthatsignalreflectionsareavoided.Thisisdonebyterminatingthebuslinewithaterminationresistoratbothendsofthebusandbyavoidingunnecessarilylongstubslinesofthebus.Thehighestpossibleproductoftransmissionrateandbuslengthlineisachievedbykeepingascloseaspossibletoasinglelinestructureandbyterminatingbothendsoftheline.Specificrecommendationsforthiscanbefoundintheaccordingstandards(i.e.ISO11898-2and-3).
Itispossibletoovercomethelimitationsofthebasiclinetopologybyusingrepeaters,bridgesorgateways.Arepeatertransfersanelectricalsignalfromonephysicalbussegmenttoanothersegment.Thesignalisonlyrefreshedandtherepeatercanberegardedasapassivecomponentcomparabletoacable.Therepeaterdividesabusintotwophysicallyindependentsegments.Thiscausesanadditionalsignalpropagationtime.However,itislogicallyjustonebussystem.
Abridgeconnectstwologicallyseparatednetworksonthedatalinklayer(OSIlayer2).ThisissothattheCANidentifiersareuniqueineachofthetwobussystems.Bridgesimplementastoragefunctionandcanforwardmessagesorpartsthereofinanindependenttime-delayedtransmission.Bridgesdifferfromrepeaterssincetheyforwardmessages,whicharenotlocal,whilerepeatersforwardallelectricalsignalsincludingtheCANidentifier.
Agatewayprovidestheconnectionofnetworkswithdifferenthigher-layerprotocols.Itthereforeperformsthetranslationofprotocoldatabetweentwocommunicationsystems.Thistranslationtakesplaceontheapplicationlayer(OSIlayer7).
Busaccess
TheconnectionbetweenaCANcontrollerchipandatwo-wiredifferentialbusavarietyofCANtransceiverchipsaccordingtodifferentphysicallayerstandardsareavailable(seebelowISO11898-2and-3,etc.).
Thisinterfacebasicallyconsistsofatransmittingamplifierandareceivingamplifier(transceiver=transmitandreceive).Asidefromtheadaptationofthesignalrepresentationbetweenchipandbusmediumthetransceiverhastomeetaseriesofadditionalrequirements.Asatransmitteritprovidessufficientdriveroutputcapacityandprotectstheon-controller-chipdriveragainstoverloading.Italsoreduceselectromagneticradiation.AsareceivertheCANtransceiverprovidesadefinedrecessivesignallevelandprotectstheon-controller-chipinputcomparatoragainstover-voltagesonthebuslines.ItalsoextendsthecommonmoderangeoftheinputcomparatorintheCANcontrollerandprovidessufficientinputsensitivity.Furthermoreitdetectsbuserrorssuchaslinebreakage,shortcircuits,shortstoground,etc.AfurtherfunctionofthetransceivercanalsobethegalvanicisolationofaCANnodeandthebusline.
Physicallayerstandards
ISO11898-2highspeed
ISO11898-2isthemostusedphysicallayerstandardforCANnetworks.Itdescribesthebusaccessunit(implementedasCANhigh-speedtransceiver)functionsaswellassomemedium-dependentinterfacefeatures.
Inthisstandardthedatarateisdefinedupto1Mbit/swithatheoreticallypossiblebuslengthof40mat1Mbit/s.Thehigh-speedstandardspecifiesatwo-wiredifferentialbuswherebythenumberofnodesislimitedbytheelectricalbusload.Thecharacteristiclineimpedanceis120Ohm,thecommonmodevoltagerangesfrom-2VonCAN_Lto+7VonCAN_H.Thenominalspecificpropagationdelayofthetwo-wirebuslineisspecifiedat5ns/m.Allthesefiguresarevalidonlyfora1Mbit/stransferrateandamaximumnetworklengthof40m.
Inordertoachievephysicalcompatibilityallnodesinthenetworkmustusethesameorasimilarbit-timing.ForautomotiveapplicationstheSAEpublishedtheSAEJ2284specification.Forindustrialandothernon-automotiveappl