車載網(wǎng)絡(luò)課件:CAN報文傳輸new_第1頁
車載網(wǎng)絡(luò)課件:CAN報文傳輸new_第2頁
車載網(wǎng)絡(luò)課件:CAN報文傳輸new_第3頁
車載網(wǎng)絡(luò)課件:CAN報文傳輸new_第4頁
車載網(wǎng)絡(luò)課件:CAN報文傳輸new_第5頁
已閱讀5頁,還剩136頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

車載網(wǎng)絡(luò)CAN數(shù)據(jù)連路層基本概念MessagesInformationRoutingBitratePrioritiesRemoteDataRequestMultimasterArbitrationSafetyErrorSignallingandRecoveryTimeFaultConfinementConnectionsSingleChannelBusvaluesAcknowledgmentSleepMode/Wake-upOscillatorToleranceMessagesInformationonthebusissentinfixedformatmessagesofdifferentbutlimitedlengthWhenthebusisfreeanyconnectedunitmaystarttotransmitanewmessage.InformationRoutingInCANsystemsaCANnodedoesnotmakeuseofanyinformationaboutthesystemconfiguration(e.g.stationaddresses).Thishasseveralimportantconsequences:(1)SystemFlexibility:NodescanbeaddedtotheCANnetworkwithoutrequiringanychangeinthesoftwareorhardwareofanynodeandapplicationlayer.

InformationRouting(2)MessageRouting:ThecontentofamessageisnamedbyanIDENTIFIER.TheIDENTIFIERdoesnotindicatethedestinationofthemessage,butdescribesthemeaningofthedata,sothatallnodesinthenetworkareabletodecidebyMessageFilteringwhetherthedataistobeacteduponbythemornot.InformationRouting (3)Multicast:AsaconsequenceoftheconceptofMessageFilteringanynumberofnodescanreceiveandsimultaneouslyactuponthesamemessage.InformationRouting (4)DataConsistency:WithinaCANnetworkitisguaranteedthatamessageissimultaneouslyacceptedeitherbyallnodesorbynonode.Thusdataconsistencyofasystemisachievedbytheconceptsofmulticastandbyerrorhandling.BitrateThespeedofCANmaybedifferentindifferentsystems.However,inagivensystemthebit-rateisuniformandfixed.PrioritiesTheIDENTIFIERdefinesastaticmessagepriorityduringbusaccess.RemoteDataRequestBysendingaREMOTEFRAMEanoderequiringdatamayrequestanothernodetosendthecorrespondingDATAFRAME.

TheDATAFRAMEandthecorrespondingREMOTEFRAMEarenamedbythesameIDENTIFIER.MultimasterWhenthebusisfreeanyunitmaystarttotransmitamessage.Theunitwiththemessageofhigherprioritytobetransmittedgainsbusaccess.ArbitrationWheneverthebusisfree,anyunitmaystarttotransmitamessage.If2ormoreunitsstarttransmittingmessagesatthesametime,thebusaccessconflictisresolvedbybitwisearbitrationusingtheIDENTIFIER.ArbitrationThemechanismofarbitrationguaranteesthatneitherinformationnortimeislost.IfaDATAFRAMEandaREMOTEFRAMEwiththesameIDENTIFIERareinitiatedatthesametime,theDATAFRAMEprevailsovertheREMOTEFRAME.ArbitrationDuringarbitrationeverytransmittercomparesthelevelofthebittransmittedwiththelevelthatismonitoredonthebus.Iftheselevelsareequaltheunitmaycontinuetosend.Whena’recessive’levelissentanda’dominant’levelismonitored(seeBusValues),theunithaslostarbitrationandmustwithdrawwithoutsendingonemorebit.SafetyInordertoachievetheutmostsafetyofdatatransfer,powerfulmeasuresforerrordetection,signalingandself-checkingareimplementedineveryCANnode.SafetyErrorDetection:Fordetectingerrorsthefollowingmeasureshavebeentaken:(1)Monitoring(transmitterscomparethebitlevelstobetransmittedwiththebitlevelsdetectedonthebus) (2)CyclicRedundancyCheck (3)BitStuffingSafetyTheerrordetectionmechanismshavethefollowingproperties:

(1)upto5randomlydistributederrorsinamessagearedetected.(2)bursterrorsoflengthlessthan15inamessagearedetected.Safety (3)errorsofanyoddnumberinamessagearedetected. (4)Totalresidualerrorprobabilityforundetectedcorruptedmessages:lessthanmessageerrorrate*4.7*10-11.ErrorSignalingand

RecoveryTimeCorruptedmessagesareflaggedbyanynodedetectinganerror.Suchmessagesareabortedandwillberetransmittedautomatically.ErrorSignallingand

RecoveryTimeTherecoverytimefromdetectinganerroruntilthestartofthenextmessageisatmost31bittimes,ifthereisnofurthererror.FaultConfinementCANnodesareabletodistinguishshortdisturbancesfrompermanentfailures.Defectivenodesareswitchedoff.ConnectionsTheCANserialcommunicationlinkisabustowhichanumberofunitsmaybeconnected.Thisnumberhasnotheoreticallimit.Practicallythetotalnumberofunitswillbelimitedbydelaytimesand/orelectricalloadsonthebusline.SingleChannelThebusconsistsofasinglechannelthatcarriesbits.Fromthisdataresynchronizationinformationcanbederived.SingleChannelThewayinwhichthischannelisimplementedisnotfixedinthisspecification.E.g.singlewire(plusground),twodifferentialwires,opticalfibres,etc.BusvaluesThebuscanhaveoneoftwocomplementarylogicalvalues:’dominant’or’recessive’.Duringsimultaneoustransmissionof’dominant’and’recessive’bits,theresultingbusvaluewillbe’dominant’.

BusvaluesForexample,incaseofawired-ANDimplementationofthebus,the’dominant’levelwouldberepresentedbyalogical’0’andthe’recessive’levelbyalogical’1’.Physicalstates(e.g.electricalvoltage,light)thatrepresentthelogicallevelsarenotgiveninthisspecification.AcknowledgmentAllreceiverschecktheconsistencyofthemessagebeingreceivedandwillacknowledgeaconsistentmessageandflaganinconsistentmessage.SleepMode/Wake-upToreducethesystem’spowerconsumption,aCAN-devicemaybesetintosleepmodewithoutanyinternalactivityandwithdisconnectedbusdrivers.Thesleepmodeisfinishedwithawake-upbyanybusactivityorbyinternalconditionsofthesystem.SleepMode/Wake-upOnwake-up,theinternalactivityisrestarted,althoughtheMACsublayerwillbewaitingforthesystem’soscillatortostabilizeanditwillthenwaituntilithassynchronizeditselftothebusactivity(bycheckingforelevenconsecutiverecessivebits),beforethebusdriversaresetto"on-bus"again.OscillatorToleranceTheBitTimingrequirementsallowceramicresonatorstobeusedinapplicationswithtransmissionratesofupto125kbit/sasaruleofthumb;ForthefullbusspeedrangeoftheCANprotocol,aquartzoscillatorisrequired.MESSAGETRANSFERMessage一詞在CAN通訊中有特殊的內(nèi)涵:首先它是一個位流序列有限的長度并且有固定的格式;FrameFormatsTherearetwodifferentformatswhichdifferinthelengthoftheIDENTIFIERfield:StandardFrames--Frameswiththenumberof11bitIDENTIFIERExtendedFrames--framescontaining29bitIDENTIFIERFrameTypesfourdifferentframetypesDATAFRAMEREMOTEFRAMEERRORFRAMEOVERLOADFRAME示波器采集的

CAN總線數(shù)據(jù)幀DATAFRAMESTARTOFFRAMEARBITRATIONFIELDARBITRATIONFIELD

---------StandardFormatARBITRATIONFIELD

---------ExtendedFormatExtendedFormatStandardFormatARBITRATIONFIELD

---------ExtendedFormatCONTROLFIELD(StandardFormat

aswellasExtendedFormat)DATALENGTHCODE(StandardFormataswellasExtendedFormat)DATAFIELDCRCFIELD

將要發(fā)送的數(shù)據(jù)比特序列當作一個多項式f(x)的系數(shù),在發(fā)送方用收發(fā)雙方預先約定的生成多項式G(x)去除,求得一個余數(shù)多項式。

將余數(shù)多項式加到數(shù)據(jù)多項式之后發(fā)送到接收端。CRC校驗基本工作原理

接收端用同樣的生成多項式G(x)去除接收數(shù)據(jù)多項式f’(x),得到計算余數(shù)多項式。

如果計算余數(shù)多項式與接收余數(shù)多項式相同,則表示傳輸無差錯;如果計算余數(shù)多項式不等于接收余數(shù)多項式,則表示傳輸有差錯,由發(fā)送方重發(fā)數(shù)據(jù),直至正確為止。CRC校驗基本工作原理CRC生成多項式G(x)由協(xié)議規(guī)定,生成多項式的結(jié)構(gòu)和檢錯效果要經(jīng)過嚴格的數(shù)學分析和試驗后確定。CRC校驗基本工作原理發(fā)送方接收方發(fā)送數(shù)據(jù)f(x)數(shù)據(jù)字段校驗字段接收數(shù)據(jù)f’(x)CRC校驗基本工作原理實際發(fā)送生成多項式生成多項式接收正確接收出錯CRC校驗的工作過程描述:

在發(fā)送端,將發(fā)送數(shù)據(jù)多項式,k為生成多項式的最高冪值。

將除以生成多項式,得到:為余數(shù)多項式。將作為整體,從發(fā)送端通過通信信道傳送到接收端。CRC校驗基本工作原理接收端對接收整體除以生成多項式如果可以整除,則認定傳輸正確,如果不能整除,認定傳輸錯誤。CRC校驗基本工作原理CRC校驗碼生成過程舉例:

發(fā)送數(shù)據(jù)比特序列為:110011(6比特)

生成多項式比特序列11001(5比特,K=4)將發(fā)送的數(shù)據(jù)比特序列乘以24,產(chǎn)生的乘積為:1100110000CRC校驗基本工作原理將乘積用生成多項式比特序列去除,得到:模二算法減法不借位加法不進位CRC校驗基本工作原理將余數(shù)序列加到乘積當中得到1100111001如果在數(shù)據(jù)傳輸過程中沒有發(fā)生傳輸錯誤,則接收端收到的帶有CRC校驗碼的接收數(shù)據(jù)比特序列能被相同的生成多項式整除,即:CRC校驗基本工作原理CRCFIELDgenerator-polynomial生成多項式ACKFIELD(StandardFormataswellasExtendedFormat)ENDOFFRAME(StandardFormataswellasExtendedFormat)REMOTEFRAMEERRORFRAMEERRORFLAGERRORDELIMITEROVERLOADFRAMEOVERLOADFRAME發(fā)出時刻OVERLOADFLAGOVERLOADDELIMITERINTERFRAMESPACINGINTERFRAMESPACINGINTERFRAMESPACINGINTERMISSIONINTERFRAMESPACINGBUSIDLEINTERFRAMESPACINGSUSPENDTRANSMISSIONINTERFRAMESPACINGDefinitionof

TRANSMITTER/RECEIVERTRANSMITTERRECEIVERMESSAGEFILTERINGMessagefilteringisbaseduponthewholeIdentifiermaskregistersMESSAGEFILTERINGMESSAGEFILTERINGMESSAGEVALIDATIONThepointoftimeatwhichamessageistakentobevalid,isdifferentforthetransmitterandthereceiversofthemessage.Transmitter:Receivers:CODINGArbitrationERRORHANDLINGThereare5differenterrortypesBITERRORSTUFFERRORCRCERRORFORMERRORACKNOWLEDGMENTERRORBITERRORmonitorsthebusdifferentfromthebitvalueSTUFFERROR6thconsecutiveequalbitlevelCRCERRORnotthesameasthatreceivedintheCRCsequenceFORMERRORoneormoreillegalbitsinafixed-formbitfieldExceptionACKNOWLEDGMENT

ERRORdoesnotmonitora’dominant’bitduringtheACKSLOTErrorSignalling誰來發(fā)送類型時刻FAULTCONFINEMENTWithrespecttofaultconfinementaunitmaybeinoneofthreestates:erroractiveerrorpassivebusoffHowtoconfine(界定)Forfaultconfinementtwocountsareimplementedineverybusunit:1)TRANSMITERRORCOUNT2)RECEIVEERRORCOUNT1.WhenaRECEIVERdetectsanerror,theRECEIVEERRORCOUNTwillbeincreasedby1,2.WhenaRECEIVERdetectsa’dominant’bitasthefirstbitaftersendinganERRORFLAGtheRECEIVEERRORCOUNTwillbeincreasedby8.3.WhenaTRANSMITTERsendsanERRORFLAGtheTRANSMITERRORCOUNTisincreasedby8.4.IfanTRANSMITTERdetectsaBITERRORwhilesendinganACTIVEERRORFLAGoranOVERLOADFLAGtheTRANSMITERRORCOUNTisincreasedby8.5.IfanRECEIVERdetectsaBITERRORwhilesendinganACTIVEERRORFLAGoranOVERLOADFLAGtheRECEIVEERRORCOUNTisincreasedby8.6.Anynodetoleratesupto7consecutive’dominant’bitsaftersendinganACTIVEERRORFLAG,PASSIVEERRORFLAGorOVERLOADFLAG.Afterdetectingthe14thconsecutive’dominant’bit(incaseofanACTIVEERRORFLAGoranOVERLOADFLAG)orafterdetectingthe8thconsecutive’dominant’bitfollowingaPASSIVEERRORFLAGandaftereachsequenceofadditionaleightconsecutive’dominant’bitseveryTRANSMITTERincreasesitsTRANSMITERRORCOUNTby8andeveryRECEIVERincreasesitsRECEIVEERRORCOUNTby8.7.Afterthesuccessfultransmissionofamessage(gettingACKandnoerroruntilENDOFFRAMEisfinished)theTRANSMITERRORCOUNTisdecreasedby1unlessitwasalready0.8.Afterthesuccessfulreceptionofamessage(receptionwithouterroruptotheACKSLOTandthesuccessfulsendingoftheACKbit),theRECEIVEERRORCOUNTisdecreasedby1,9.Anodeis’errorpassive’whentheTRANSMITERRORCOUNTequalsorexceeds128,orwhentheRECEIVEERRORCOUNTequalsorexceeds128.10.Anodeis’busoff’whentheTRANSMITERRORCOUNTisgreaterthanorequalto256.11.An’errorpassive’nodebecomes’erroractive’againwhenboththeTRANSMITERRORCOUNTandtheRECEIVEERRORCOUNTarelessthanorequalto127.12.Annodewhichis’busoff’ispermittedtobecome’erroractive’(nolonger’busoff’)withitserrorcountersbothsetto0after128occurrenceof11consecutive’recessive’bitshavebeenmonitoredonthebus.OSCILLATOR

TOLERANCEAmaximumoscillatortoleranceof1.58%isgiventhereforetheuseofaceramicresonatoratabusspeedofupto125Kbits/sasaruleofthumb;ForthefullbusspeedrangeoftheCANprotocol,aquartzoscillatorisrequired.BITTIMING

REQUIREMENTSNOMINALBITRATETheNominalBitRateisthenumberofbitspersecondtransmittedintheabsenceofresynchronizationbyanidealtransmitter.NOMINALBITTIMENOMINALBITTIME=1/NOMINALBITRATEBITTIMING

REQUIREMENTSTheNominalBitTimecanbethoughtofasbeingdividedintoseparatenon-overlappingtimesegments.ThesesegmentsBITTIMING

REQUIREMENTS-SYNCHRONIZATIONSEGMENT(SYNC_SEG)-PROPAGATIONTIMESEGMENT(PROP_SEG)-PHASEBUFFERSEGMENT1(PHASE_SEG1)-PHASEBUFFERSEGMENT2(PHASE_SEG2)BITTIMING

REQUIREMENTSSYNCSEGThispartofthebittimeisusedtosynchronizethevariousnodesonthebus.Anedgeisexpectedtoliewithinthissegment.PROPSEGThispartofthebittimeisusedtocompensateforthephysicaldelaytimeswithinthenetwork.Itistwicethesumofthesignal’spropagationtimeonthebusline,theinputcomparatordelay,andtheoutputdriverdelay.PHASESEG1

PHASESEG2ThesePhase-Buffer-Segmentsareusedtocompensateforedgephaseerrors.Thesesegmentscanbelengthenedorshortenedbyresynchronization.SAMPLEPOINTTheSAMPLEPOINTisthepointoftimeatwhichthebuslevelisreadandinterpretedasthevalueofthatrespectivebit.It’slocationisattheendofPHASE_SEG1.INFORMATION

PROCESSINGTIMETheINFORMATIONPROCESSINGTIMEisthetimesegmentstartingwiththeSAMPLEPOINTreservedforcalculationthesubsequent(這一位)bitlevel.TIMEQUANTUMTheTIMEQUANTUMisafixedunitoftimederivedfromtheoscillatorperiod.Lengthof

TimeSegmentsSYNC_SEGis1TIMEQUANTUMlong.PROP_SEGisprogrammabletobe1,2,...,8TIMEQUANTAlong.PHASE_SEG1isprogrammabletobe1,2,...,8TIMEQUANTAlong.PHASE_SEG2isthemaximumofPHASE_SEG1andtheINFORMATIONPROCESSINGTIMELengthof

TimeSegmentsTheINFORMATIONPROCESSINGTIMEislessthanorequalto2TIMEQUANTAlong.ThetotalnumberofTIMEQUANTAinabittimehastobeprogrammableatleastfrom8to25.Lengthof

TimeSegmentssamplepointThepositionofthesamplepoint,however,shouldbeselectedincommonforallnodes.ThereforethebittimingofSLIOdevicesmustbecompatibletothefollowingdefinitionofthebittime:同步指兩個或兩個以上隨時間變化的量在變化過程中保持一定的相對關(guān)系。當兩個設(shè)備一起工作并對時間有精確要求的時候,就需要在它們之間進行同步HARD

SYNCHRONIZATIONAfteraHARDSYNCHRONIZATIONtheinternalbittimeisrestartedwithSYNC_SEG.ThusHARDSYNCHRONIZATIONforcestheedgewhichhascausedtheHARDSYNCHRONIZATIONtoliewithintheSYNCHRONIZATIONSEGMENToftherestartedbittime.RESYNCHRONIZATION

JUMPWIDTHAsaresultofRESYNCHRONIZATIONPHASE_SEG1maybelengthenedorPHASE_SEG2maybeshortened.TheamountoflengtheningorshorteningofthePHASEBUFFERSEGMENTshasanupperboundgivenbytheRESYNCHRONIZATIONJUMPWIDTH.TheRESYNCHRONIZATIONJUMPWIDTHshallbeprogrammablebetween1andmin(4,PHASE_SEG1).RESYNCHRONIZATION

JUMPWIDTHClockinginformationmaybederivedfromtransitionsfromonebitvaluetotheother.Thepropertythatonlyafixedmaximumnumberofsuccessivebitshavethesamevalueprovidesthepossibilityofresynchronizingabusunittothebitstreamduringaframe.Themaximumlengthbetweentwotransitionswhichcanbeusedforresynchronizationis29bittimes.PHASEERROR

ofanedgeThePHASEERRORofanedgeisgivenbythepositionoftheedgerelativetoSYNC_SEG,measuredinTIMEQUANTA.ThesignofPHASEERRORisdefinedasfollows:PHASEERROR

ofanedgee=0iftheedgelieswithinSYNC_SEG.e>0iftheedgeliesbeforetheSAMPLEPOINT.e<0iftheedgeliesaftertheSAMPLEPOINTofthepreviousbit.RESYNCHRONIZATIONTheeffectofaRESYNCHRONIZATIONisthesameasthatofaHARDSYNCHRONIZATION,whenthemagnitudeofthePHASEERRORoftheedgewhichcausestheRESYNCHRONIZATIONislessthanorequaltotheprogrammedvalueoftheRESYNCHRONIZATIONJUMPWIDTH.RESYNCHRONIZATIONWhenthemagnitudeofthePHASEERRORislargerthantheRESYNCHRONIZATIONJUMPWIDTH,andifthePHASEERRORispositive,thenPHASE_SEG1islengthenedbyanamountequaltotheRESYNCHRONIZATIONJUMPWIDTH.andifthePHASEERRORisnegative,thenPHASE_SEG2isshortenedbyanamountequaltotheRESYNCHRONIZATIONJUMPWIDTH.RESYNCHRONIZATIONRESYNCHRONIZATIONSYNCHRONIZATION

RULESHARDSYNCHRONIZATIONandRESYNCHRONIZATIONarethetwoformsofSYNCHRONIZATION.Theyobeythefollowingrules:1.OnlyoneSYNCHRONIZATIONwithinonebittimeisallowed.SYNCHRONIZATION

RULES2

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論