车载网络课件:CAN报文传输new_第1页
车载网络课件:CAN报文传输new_第2页
车载网络课件:CAN报文传输new_第3页
车载网络课件:CAN报文传输new_第4页
车载网络课件:CAN报文传输new_第5页
已阅读5页,还剩136页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

车载网络CAN数据连路层基本概念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通讯中有特殊的内涵:首先它是一个位流序列有限的长度并且有固定的格式;FrameFormatsTherearetwodifferentformatswhichdifferinthelengthoftheIDENTIFIERfield:StandardFrames--Frameswiththenumberof11bitIDENTIFIERExtendedFrames--framescontaining29bitIDENTIFIERFrameTypesfourdifferentframetypesDATAFRAMEREMOTEFRAMEERRORFRAMEOVERLOADFRAME示波器采集的

CAN总线数据帧DATAFRAMESTARTOFFRAMEARBITRATIONFIELDARBITRATIONFIELD

---------StandardFormatARBITRATIONFIELD

---------ExtendedFormatExtendedFormatStandardFormatARBITRATIONFIELD

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

aswellasExtendedFormat)DATALENGTHCODE(StandardFormataswellasExtendedFormat)DATAFIELDCRCFIELD

将要发送的数据比特序列当作一个多项式f(x)的系数,在发送方用收发双方预先约定的生成多项式G(x)去除,求得一个余数多项式。

将余数多项式加到数据多项式之后发送到接收端。CRC校验基本工作原理

接收端用同样的生成多项式G(x)去除接收数据多项式f’(x),得到计算余数多项式。

如果计算余数多项式与接收余数多项式相同,则表示传输无差错;如果计算余数多项式不等于接收余数多项式,则表示传输有差错,由发送方重发数据,直至正确为止。CRC校验基本工作原理CRC生成多项式G(x)由协议规定,生成多项式的结构和检错效果要经过严格的数学分析和试验后确定。CRC校验基本工作原理发送方接收方发送数据f(x)数据字段校验字段接收数据f’(x)CRC校验基本工作原理实际发送生成多项式生成多项式接收正确接收出错CRC校验的工作过程描述:

在发送端,将发送数据多项式,k为生成多项式的最高幂值。

将除以生成多项式,得到:为余数多项式。将作为整体,从发送端通过通信信道传送到接收端。CRC校验基本工作原理接收端对接收整体除以生成多项式如果可以整除,则认定传输正确,如果不能整除,认定传输错误。CRC校验基本工作原理CRC校验码生成过程举例:

发送数据比特序列为:110011(6比特)

生成多项式比特序列11001(5比特,K=4)将发送的数据比特序列乘以24,产生的乘积为:1100110000CRC校验基本工作原理将乘积用生成多项式比特序列去除,得到:模二算法减法不借位加法不进位CRC校验基本工作原理将余数序列加到乘积当中得到1100111001如果在数据传输过程中没有发生传输错误,则接收端收到的带有CRC校验码的接收数据比特序列能被相同的生成多项式整除,即:CRC校验基本工作原理CRCFIELDgenerator-polynomial生成多项式ACKFIELD(StandardFormataswellasExtendedFormat)ENDOFFRAME(StandardFormataswellasExtendedFormat)REMOTEFRAMEERRORFRAMEERRORFLAGERRORDELIMITEROVERLOADFRAMEOVERLOADFRAME发出时刻OVERLOADFLAGOVERLOADDELIMITERINTERFRAMESPACINGINTERFRAMESPACINGINTERFRAMESPACINGINTERMISSIONINTERFRAMESPACINGBUSIDLEINTERFRAMESPACINGSUSPENDTRANSMISSIONINTERFRAMESPACINGDefinitionof

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

ERRORdoesnotmonitora’dominant’bitduringtheACKSLOTErrorSignalling谁来发送类型时刻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:同步指两个或两个以上随时间变化的量在变化过程中保持一定的相对关系。当两个设备一起工作并对时间有精确要求的时候,就需要在它们之间进行同步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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论