CAN通訊協(xié)議介紹_第1頁
CAN通訊協(xié)議介紹_第2頁
CAN通訊協(xié)議介紹_第3頁
CAN通訊協(xié)議介紹_第4頁
CAN通訊協(xié)議介紹_第5頁
已閱讀5頁,還剩50頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

會計學(xué)1CAN通訊協(xié)議介紹2Agenda

Part1:LearnthehighlevelCANfeatures

Part2:UnderstandtheCANmessage

Part3:UnderstandhowmessagesarecommunicatedbetweenCANnodes第1頁/共62頁3Part1:

TheBigPicture第2頁/共62頁4WhatisCAN?Standsfor:Controller–AreaNetwork

DevelopmentoftheCAN-busstartedoriginallyin1983atRobertBoschGmbH

Theprotocolwasofficiallyreleasedin1986attheSocietyofAutomotiveEngineers(SAE)congressinDetroit第3頁/共62頁5CANKeyFeaturesSpeedupto1MbpsNon-destructivemessagearbitrationAllnodesreceiveallmessagesNoguaranteedmessagelatency第4頁/共62頁6CostvsDataRateLINCANFlexRayMOST12510RelativecostpernodeDatarate[bps]20K1M10M25M第5頁/共62頁7CANvsLINCANismuchfaster:upto1MbpsLINoffersatimedeterministicmodelCANoffersamorepowerfulchecksumUsesLDFinsteadofDBCfilesfordatabases第6頁/共62頁8CANvsFlexRayFlexRaynetworkstartupmorecomplicatedFlexRayofferstimedeterministiccommunicationsFlexRayoffersfaulttoleranceusingvariousmechanismsFlexRayofferslargerdataframesUsesFIBEXinsteadofDBCfiles第7頁/共62頁9CANvsMOSTMOSTistargetedatinfotainmentapplicationsMOSToffersdedicatedtransfersinaringnetworkat25MbpsOptical,50MbCopper,and150Mbpsopticalphysicallayers第8頁/共62頁10CANHardwareFeaturesModeratecostsiliconimplementationRequireshardwareCANcontrollerandCANtransceiverRequireshardwareCANtransceiverMicroprocessorCAN

TransceiverCANControllerCANHighCANLowGround第9頁/共62頁11Quiz11.CANguaranteesmessagelatency.

(TrueorFalse)?2.CANrequireshardwarecontrollers.

(TrueorFalse)?3.CANissimilartoLIN:bothhaveverydefinedmessagestructure.

(TrueorFalse)?4.Whatisthemaximumnumberofbytes

canbeinaCANmessage?第10頁/共62頁12CANPhysicalLayersHighSpeedCAN:upto1MbpsLowSpeedFaultTolerantCAN:

upto125kbpsSingleWireCAN:upto83.3kbps第11頁/共62頁132.53.5V1.5tCANHighCANLowRecessiveDominantCANDualWirePhysicalLayers

第12頁/共62頁14CANNode1CANNode2CANNode3120Ohm120OhmCANDualWireTermination第13頁/共62頁15SingleWirePlusGroundTwo120OhmterminationresistorsBuslengthto40meters@1Mbps,Slower=longer.SWPhysicalLayer第14頁/共62頁16DW/LSFTPhysicalLayerTwistedPair(CANH/CANL)plusGroundTwo120OhmterminationresistorsBuslengthto40meters@1Mbps,Slower=>longer.第15頁/共62頁17CANSupportMultipleversionsofCANaresupportedinValueCANandneoVIFIRE:HighSpeedCAN,LSFTCAN,SingleWireCANVehicleSpyprovidesfullCANsupport:

CANmessageandsignaldecoding,

logging,CANnodesimulation第16頁/共62頁18Lab1:ObjectivesGetfamiliarwithIntrepidCAN/LINboardFindUSBpowerconnectorFindCANandneoVIpowerconnectorLocateLINandCANtransceiverson

theboardConnectUSBandpowercablesConnectneoVItotheboard第17頁/共62頁19IntrepidCAN/LINBoardTwoidenticalconnectedCANnodesPowerissuppliedthroughUSBCANconnectorsforneoVIandValueCANPowerconnectorforneoVI第18頁/共62頁20IntrepidBoardTwoCANtransceiverswithtestpointsTworesetbuttons第19頁/共62頁21Quiz21.CANbusrequiresterminationof1200Ohm

(TrueorFalse)?2.CANrequiresthreelines:CANlow,CANHighandground

(TrueorFalse)?3.SinglewireCANisingeneraltheslowestCANtype.

(TrueorFalse)?第20頁/共62頁22Part2:

TheCANmessage第21頁/共62頁23CANDataFrameTypicalCANmessageiscalleddataframeNumberofdatabytes:0-8CANDataFrameProtocolOverheadDataBytesProtocolOverhead第22頁/共62頁24CANFrameFieldsArbitrationfieldrepresentsframeIDControlfieldhasdefinesframelengthCRCstandsforCyclicRedundancyCheck:

thisisCANframechecksumACKisacknowledgefield:confirmsframereceptionCANDataFrameDataBytesArbitrationFieldControl

FieldCRCACK第23頁/共62頁25ArbitrationFieldIdentifierassigns11bitIDtoCANframesRemoteTransmitRequest(RTR)bitCANnodesendsCANframewithrecessiveRTRbit(logical1)whenthenoderequestsdatafrom

othernodesDataBytesControl

FieldIdentifierRTR111ArbitrationFieldCRCACK第24頁/共62頁26CANRemoteFrameIdenticaltotheDataFrame,except

thereisnodatabytesRTRbitisrecessive(logical1)?Control

FieldCRCACKArbitrationField第25頁/共62頁27ControlFieldDLCspecifiesnumberofdatabytes:0-8RB0bitissettological0andreservedforthefutureprotocolsIDEbitdefinesdataframetype:standardIDorextendedIDdataframeIDEbits:dominantforstandardandrecessiveforextendeddataframeDataBytesIdentifierIDEControlField114RB0DLCCRCACK第26頁/共62頁28ExtendedDataFrameSimilartostandarddataframeIdentifieris29bitslongIdentifierissplitintotwoparts:ID1andID2Data

BytesSRR1111181IDEID1CRCACKID2RTRArbitrationFieldControl

Field第27頁/共62頁29StandardandExtendedFramesDataBytesControl

FieldIdentifierRTR111CRCACKData

BytesSRR1111181IDEID1CRCACKID2RTRArbitrationFieldControl

FieldArbitrationField第28頁/共62頁30CRCFieldCRC:CyclicRedundancyCheckCRCiscalculatedandputonthebusbytransmittingnodeCRCiscomputedagainbythereceivingnode:ifitdoesnotmatch,thenanerrorframeissentandthedataframeissentagainbythetransmitter.CRCfieldis15bitlongandhas1bitdelimiterDelimiteralwaysshouldbelogical1DataBytesArbitrationFieldControl

FieldCRCACKDel第29頁/共62頁31ACKFieldACK:AcknowledgefieldIfCANnodereceivedthemessagecorrectlyitshouldsetACKbitasdominantbit(logical0)AtleastonereceivershouldsetACKtodominantbit.Ifnot,anerrorframeifgeneratedand

thetransmitterresendstheframeACKdelimiter:1bitalwaysshouldbelogical1DataBytesArbitrationFieldControl

FieldCRCACKDelDel第30頁/共62頁32Lab2:ObjectivesGetfamiliarwithWaveBPSsoftwareConnectedWaveBPStoIntrepidboardusingtheoscilloscopeRunWaveBPSandmonitorCANwaveformscomingfromtheboardIdentifyCANhighandCANlowlinesMeasureonebitlengthintimeandcomputecorrespondingCANbaudrate第31頁/共62頁33Quiz3Whatisthemaindifferencebetweenaremoteframeandadataframe?ControlfieldcontainsthenumberofCANdatabytes(TrueorFalse)?3.WhatisthemaindifferencebetweenastandardandextendedCANframes?4.IfanodereceivedaCANframecorrectly,howwouldthisaffectACKfieldoftheframe?第32頁/共62頁34Part3:

Messagesendingandreceiving第33頁/共62頁35CANArbitrationAnynodecantransmitwhenbusisfreeMultiplenodetransmissionisresolvedbybitwisearbitrationusingIDfieldNondestructiveframearbitration第34頁/共62頁36CANArbitrationHigherpriorityframeswinarbitrationDataframeswinarbitrationoverremoteframesNodesalwaysmonitorthebusIfthereisadominantbitonthebus,andanodewantstosendarecessivebit,thenodelosesarbitration第35頁/共62頁371011001101110110010011LSBMSBNodewantstosendCANframewiththisID:OthernodeID:CANArbitrationExample第36頁/共62頁38StartandEndofFrameAlldataandremoteframeshavestartand

endwaveformsStartofframeis1dominantbitEndofframe(EOF)is7recessivebitsIntermissionfieldis3recessivebits:overloadframecanbesentduringthefirstintermissionbitCANDataorRemoteFrameStartBitEOFINTIdle

Bus第37頁/共62頁39OverloadFrameOverloadframeissentwhenreceiverrequires

adelay,orDominantbitwasdetectedduringintermissonAtmosttwooverloadframescanbegeneratedtodelaynextdataorremoteframeOverloadflagfromnodesis6bitshighOverloadframeSuperpositionofoverloadflagsfromnodes(6bitsdom.)?Delimiter6-12bits8bitsHighEOF第38頁/共62頁40ErrorFrameErrorframeissentwhenanodedetects

errorconditiononthebusActiveErrorflagfromnodesis6bitshighErrorframeSuperpositionofoverloadflagsfromnodes(6bitsdom.)?Delimiter6-12bits8bitsHighEOF第39頁/共62頁41ChecksumErrorCRCiscomputedbytransmitterandputonthebusReceivingnodecalculatesCRCandcomparesit

withCRCfieldIfCRCdoesnotmatch,errorframeisgeneratedandtransmitterresendsthemessageCANDataFrameDataBytesArbitrationFieldControl

FieldCRCACK第40頁/共62頁42AcknowledgeErrorAtleastonereceivermustsetACKbitdominantIfnot,anerrorframeisgeneratedandthetransmitterresendsthemessageDataBytesArbitrationFieldControl

FieldCRCDelACK第41頁/共62頁43FormErrorCondition:fixedformfieldshaveillegalbits:dominantbit(logical0)isdetectedinthedelimiters,EndofFrame(EOF)orinter-framespaceTransmitterthensenderrorframeandresendsthemessageCANDataorRemoteFrameEOFINTIdle

BusDelDel第42頁/共62頁44StuffErrorCondition:6consecutivebitsofthesamestateinnon-fixedformfieldsCANbitstuffingalgorithminsertsadditionalbitsintoCANframetomakesurethereisnomorethan5consecutivebitsofthesamelevelThetransmitterresendsthemessageCANDataFrameDataBytesArbitrationFieldControl

FieldCRCACK第43頁/共62頁45BitErrorCondition:transmittermonitorswhatitsendsanddetectsabitstateoppositetowhatitputonthebusExcludeArbitrationandACKfieldCANDataFrameDataBytesArbitrationFieldControl

FieldCRCACK第44頁/共62頁46FaultConfinement

Whathappenswhentransmitterdetectsanerrorandkeepssendingerrorframes?Endlessloopproblem:transmittersendsbadframeandthereceivererrorframesitSolution:nodefaultconfinement.ItmaintainsCANTXandRXerrorcounters,andisolatenodesfromthecommunicationaftercertainnumbersoferrors第45頁/共62頁47FaultConfinementStatesThreestatesErroractivenodes:takepartinthecommunicationandsenderroractiveflagswhenerrorsaredetectedErrorpassivenodes:takepartinthecommunicationbutcanonlysenderrorpassiveflagsAftertransmission,errorpassivenodessendadditional8recessivebitsafterintermissionfield–itiscalled“SuspendTransmission”fieldBusoffnodes:noinfluenceonthebus第46頁/共62頁FaultConfinementErrorCountersTEC:000REC:000ErrorActiveErrorActiveREC:001TEC:000REC:002TEC:001REC:003TEC:002REC:004TEC:004REC:010TEC:011REC:018TEC:026REC:029TEC:052REC:029TEC:097REC:031TEC:129REC:033TEC:185REC:042TEC:211REC:047TEC:233REC:051TEC:256ErrorCountersTEC:000REC:000REC:000TEC:000ErrorCountersTEC:000REC:000REC:001TEC:000REC:000TEC:000REC:001TEC:000REC:002TEC:000REC:001TEC:000REC:002TEC:0003ErrorStates:ErrorActive,ErrorPassive,BusOffCANNode1CANNode2CANNode3ErrorActiveErrorPassiveBUSOFF第47頁/共62頁49ReceiveErrorCounterIfreceiversendsanerrorframe:REC+1

Ifreceiverwasfirsttostartanerrorframe:

REC+8

IfreceivermonitorsaBITERRORwhilesendinganerrorframe:

REC+8

Aftersuccessfullyreceivingamessage:

REC-1

第48頁/共62頁50TransmitErrorCounterIftransmittersendsanerrorframe:TEC+8

IftransmittermonitorsaBITERRORwhilesendinganerrorframe:

TEC+8

Aftersuccessfullytransmittingamessage:

TEC-1

IfTECreaches127:

CannotsendErrorFrames,butcanTx/Rx第49頁/共62頁51Lab3:ObjectivesGetfamiliarwithVehicleSpysoftwareCreateamessagethatissentperiodicallyPutthatmessageintothe2ndnodeontheEVBFindourmessageamongstallthemessages第50頁/共62頁52Quiz4Overloadframeissentwhenreceiverrequiresadelay.

(TrueorFalse)?2.Underwhatconditionsdoesaformerroroccur?3.Stuffbitsareinsertedonlyifthereare5consecutivebitsofthesamestateonthebus.

(TrueorFalse)?第51頁/共62頁53CANArbitrationAnynodecantransmitwhenbusisfreeMultiplenodetransmissionisresolvedbybitwisearbitrationusingIDfieldNondestructiveframearbitration第52頁/共62頁54CANArbitrationHigherpriorityframeswinarbitrationDataframeswinarbitrationoverremoteframesNodesalwaysmonitorthebusIfthereisadominantbitonthebus,andanodewantstosendarecessivebit,thenodelosesarbitration第53頁/共62頁551011001101110110010011LSBMSBNodewantstosendCANframewiththisID:OthernodeID:CANArbitrationExampl

溫馨提示

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

評論

0/150

提交評論