转自学习笔记(一)1.总线布局2.差分信号线J1939通讯传输的是一系列的“1”或“0”。1代表在J1939(+)与J1939(-)之间是高电压差。0代表在J1939(+)与J1939(-)之间是低电压差250K波特率时,在J1939高、低导线间的电压从0到1每秒变化250K次是可能的。用一个高频示波器可以看到此电压变化。3.ISO标准对应–Layer1–J1939/11:物理层,物理介质,总线的设计,长度,节点,等等.–Layer2–J1939/21:数据层,定义分类PGN信息/传输协议.–Layer3–J1939/31:网络层,定义不同网络互连之间的转换技术。–Layer7–J1939/71:应用层,信息分享、解析。J1939/73:应用层,故障信息。4.术语SPN–特定参数–特定参数对应的号码,例如:SPN190=发动机转速SPN513=%扭矩PGN–参数组号码–总线上的信息被以“组”的形式广播,例如:PGN61444=发动机控制器#1(EEC1)PGN61444=SPN190,SPN513,等等.发动机转速和扭矩百分比都属于PGN61444参数组。优先级–告诉ECM接收的信息的重要性:0=最重要6=最不重要例如:如果变速箱用优先级3请求发动机升速,而牵引控制器用优先级0请求发动机降速,最终发动机会选择降速。源地址和目的地址–指示信息是从哪一个控制器发出,或发送到哪一个控制器。00h–发动机控制器--主机01h–发动机控制器--辅机03h–变速箱5.CAN标准帧和扩展帧标准帧只有11位的标识符(ID)扩展帧有11+18=29位标识符(ID)以后均以扩展帧作介绍。6.协议数据单元(PDU)标识符+数据域=协议数据单元(PDU)。7.参数组编号(PGN)PGN(ParameterGroupNumber)参数组编号:参数组编号唯一标识一个参数组,在通讯过程中起到“索引”的作用,表征报文的内容和用途,确定报文的类型和传播数据需要的帧数目。可以理解为同类(或者有共同特征的设备)参数的集合的索引。SAEJ1939中的格式规定如下:pgn61443–ElectronicEngineController#2–EEC2–TransmissionRepetitionRate:50ms-信息发送周期DataLength:8Bytes-数据域长度(CAN扩展帧中的数据域)DataPage:0-数据页(PGN中的数据页DP)PDUFormat:240-PDU格式(PDU1(240)和PDU2(240~255))(CAN格式中的PF)PDUSpecific:3-PDU特定域(PF240,DA,240≤PF≤255,组扩展)DefaultPriority:3-优先级ParameterGroupNumber:61443(00F00316)-PGNBitStartPosition/ByteLengthSPNDescriptionSPN(对应的SPN号)-数据域分布1.12bitsAcceleratorPedalLowIdleSwitch558-1.1表示第一个字节第一位1.32bitsAcceleratorPedalKickdownSwitch559-2bits表示该SPN对应的数据长度1.52bitsRoadSpeedLimit143721byteAcceleratorPedalPosition9131bytePercentLoadatCurrentSpeed9241byteRemoteAccelerator9748.特定参数号(SPN)spn91–AcceleratorPedalPosition–Theratioofactualacceleratorpedalpositiontomaximumpedalposition.AlthoughitisusedasaninputtodeterminetransmissionandASRalgorithmsaboutdriver’sactions.DataLength:1Bytes-SPN号对应的数据的长度Resolution:0.4%/bit,0offset-计算方式(见下)DataRange:0to100%-数据范围(涉及偏移量计算)Type:MeasuredSuspectParameterNumber:91-SPN号ParameterGroupNumber:[61443]-隶属的PGN号由SPN数据(CAN格式中的读出的数据)计算实际的数据方法:如下是一个实际的J1939信息0.10001OCF00300xRxd87DC3C02DFFFFFFFF转换步骤:十六进制转成十进制乘以转换系数加上偏置举例:查询PGN:SPN110如下:SPN175:SAEJ1939学习笔记(二)特殊的J1939信息(车辆控制)pgn0-TSC1pgn65226-DM1pgn60160&pgn60471–TP.BAMpgn0-TSC1扭矩/速度控制TSC1允许三种方式控制发动机:-扭矩控制(0%-100%)-速度控制(低怠速-高怠速)-扭矩/速度限制(两者之中的低者)例如:1、变速箱在换档时会利用此命令控制发动机转速;2、车辆控制器利用此命令控制发动机转速;3、牵引控制器利用此命令控制发动机的扭矩来防止车辆打滑pgn0-Torque/SpeedControl#1-TSC1-TransmissionRepetitionRate:whenactive;10mstoengine,50mstoretarderDataLength:8bytesDataPage:0PDUFormat:0PDUSpecific:DADefaultPriority:3ParameterGroupNumber:0(00000016)BitStartPosition/BytesLengthSPNDescriptionSPN1.12bitsOverrideControlMode6951.32bitsRequestedSpeedControlConditions6961.52bitsOverrideControlModePriority8972-32bytesRequestedSpeed/SpeedLimit89841byteRequestedTorque/TorqueLimit518数据域举例如下:相应SPN介绍SPN695-OverrideControlMode00–Overridedisable01–SpeedControl–GovernstoadesiredSpeed10–TorqueControl–MaintainsadesiredTorquevalue11–Speed/TorqueLimitControl–Controlstothelowestvalue.SPN897-OverrideControlModePriority00–HighestPriority01–HighPriority10–MediumPriority11–LowPrioritySPN696-RequestedSpeedControlConditionsBasedonthesebits(bits4,3inbyte1)uptoFour(4)differentASGgainsetscanbeappliedDYNAMICALLY.00=Gainset101=Gainset210=Gainset311=Gainset4ThiscanbeasignificantadvantagewhentheTSC1isbeingusedinspeedcontroltoaccomplishtheapplication’sintendedfunction.Ex:Improveloadpickupduringloadedoperationsandthenswitchtodifferentgainsetforstabilityduringlightloading.spn898-RequestedSpeed/SpeedLimit-Thisistheenginespeedwhichtheengineisexpectedtooperateatifthespeedcontrolmodeisactiveortheenginespeedwhichtheengineisnotexpectedtoexceedifthespeedlimitmodeisactive.DataLength:2bytesResolution:0.125rpm/bit,0offsetDataRange:0to8,031.875rpmType:StatusSuspectParameterNumber:898ParameterGroupNumber:[0]-PGNNofrompreviousslideAsthisisanSPN,don’tforgettoByteSwapwhenconvertinghence0100000000111000swappedis0011100001000000Toconvertinformation-CovertBinarytoDecimal-MultiplybyResolution-AddOffsetHence:0011100001000000=3840hConverttoDec:3840h=14400DecMultiplyby0.125:14400x0.125=1800Add0:1800+0=1800Result:1800rpmspn518-RequestedTorque/TorqueLimit-Thisistheenginetorqueatwhichtheengineisexpectedtooperateifthetorquecontrolmodeisactiveortheenginetorquewhichtheengineisnotexpectedtoexceedifthetorquelimitmodeisactive.DataLength:1byteResolution:1%/bit,-125%offsetDataRange:-125to125%OperatingRange:0to125%enginetorquerequestsType:StatusSuspectParameterNumber:518ParameterGroupNumber:[0]-PGNNofrompreviousslideHence:10010110=96hConverttoDec:96h=150DecMultiplyby1:150x1=150Add-125:150-125=25Result:25%TQSAEJ1939学习笔记(三)J1939故障代码种类J1939由几个不同的诊断信息:–诊断信息1-DM1–现行故障代码–诊断信息2-DM2–非现行故障代码–诊断信息3-DM3–清除非现行故障代码通常地,用户会用DM1信息来读取现行故障码。DM1信息是PGN65226orFECAh。相关的信息请参考J1939-73标准。PGN65226pgn65226–ActiveDiagnosticTroubleCodes–DM1TransmissionRepetitionRate:WhenafaultgoesActive/Inactive&1swhileactive.DataLength:VariableDatapage:0PDUFormat:254PDUSpecific:202DefaultPriority:6ParameterGroupNumber:65226(00FECA16)Byte:1LampStatusByte:2ReservedBytes:3–5SPNandFMIByte:6Bit:8SPNConversionByte:6Bits:1–7OccurrenceCount注意:1