SAE J1939学习笔记(转)

发布时间:2015-08-07 11:54:52

转自http://blog.csdn.net/Hugohut/article/category/2223943

SAE J1939学习笔记(一)

1.总线布局

2.差分信号线

J1939 通讯传输的是一系列的“1”或“0” 。 

1 代表在J1939(+)与J1939(-)之间是高电压差。

0 代表在J1939(+)与J1939(-)之间是低电压差

250K波特率时,在J1939高、低导线间的电压从01每秒变化250K次是可能的。用一个高频示波器可以看到此电压变化。

3.ISO标准对应

Layer1 J1939/11:  物理层,物理介质,总线的设计, 长度,节点,等等.

Layer2 J1939/21:  数据层,定义分类PGN信息/传输协议.

Layer3 J1939/31:   网络层,定义不同网络互连之间的转换技术。

Layer7 J1939/71:   应用层,信息分享、解析。

J1939/73:   应用层,故障信息。

4.术语

SPN特定参数–特定参数对应的号码,例如:

              SPN 190 = 发动机转速

              SPN 513 = % 扭矩

PGN 参数号码–总线上的信息被以的形式广播,例如:

  PGN 61444 =发动机控制器#1 (EEC1)

  PGN 61444 = SPN 190, SPN 513,等等.

  发动机转速和扭矩百分比都属于PGN 61444参数组。

优先级告诉ECM接收的信息的重要性:

    0 = 最重要

    6 = 最不重要

   例如:如果变速箱用优先级3请求发动机升速,而牵引控制器用优先级0请求发动机降速,最终发动机会选择降速。

源地址和目的地址指示信息是从哪一个控制器发出,或发送到哪一个控制器。

   00h发动机控制器--主机

   01h发动机控制器--辅机

   03h变速箱

5.CAN标准帧和扩展帧

标准帧只有11位的标识符(ID

扩展帧有11+18=29位标识符(ID

以后均以扩展帧作介绍。

6.协议数据单元(PDU

标识符+数据域=协议数据单元(PDU)。

7.参数组编号(PGN

PGNParameter Group Number)参数组编号:

参数组编号唯一标识一个参数组,在通讯过程中起到索引的作用,表征报文的内容和用途,确定报文的类型和传播数据需要的帧数目。可以理解为同类(或者有共同特征的设备)参数的集合的索引。

SAEJ1939中的格式规定如下:

pgn61443 – Electronic EngineController #2 – EEC2 –

Transmission Repetition Rate: 50ms         ->信息发送周期

Data Length:                            8 Bytes       ->数据域长度(CAN扩展帧中的数据域)

Data Page:                              0      ->数据页(PGN中的数据页DP

PDU Format:                           240           ->PDU格式(PDU1<240)和PDU2240~255))(CAN格式中的PF

PDU Specific:                          3              ->PDU特定域(PF<240DA240≤PF≤255,组扩展)

Default Priority:                        3        ->优先级 

Parameter Group Number:            61443 (00F00316)                ->PGN

Bit Start Position / Byte     Length          SPNDescription                        SPN (对应的SPN号)   ->数据域分布

1.1                        2 bits             Accelerator Pedal Low Idle Switch        558                               ->1.1表示第一个字节第一位

1.3                        2 bits             Accelerator Pedal Kickdown Switch      559                               ->2bits表示该SPN对应的数据长度

1.5                        2 bits             Road Speed Limit                                1437

2                          1 byte            Accelerator Pedal Position                      91

3                          1 byte            Percent Load at Current Speed              92

4                          1 byte            Remote Accelerator                               974

8.特定参数号(SPN

spn91 – Accelerator PedalPosition – The ratio of actual acceleratorpedal position to maximum pedal position. Although it is used as an input to determine transmission and ASRalgorithms about driver’s actions.

 

Data Length:                            1 Bytes                    ->SPN号对应的数据的长度

Resolution:                        0.4%/ bit, 0 offset          ->计算方式(见下)

Data Range:                      0 to100%                  ->数据范围(涉及偏移量计算)

Type:                                 Measured

Suspect Parameter Number:         91                     ->SPN

Parameter Group Number:            [61443]             ->隶属的PGN

SPN数据(CAN格式中的读出的数据)计算实际的数据方法:

如下是一个实际的 J1939信息

  0.1000 1  OCF00300x   Rx   d8  7DC3 C0 2D FFFFFFFF

转换步骤:

    十六进制转成十进制

    乘以转换系数

    加上偏置

举例:

查询PGN

SPN110如下:

SPN175:

SAE J1939学习笔记(二)

特殊的J1939信息(车辆控制)

>pgn0 - TSC1

>pgn65226 -DM1

>pgn60160 & pgn60471 – TP.BAM

pgn0 - TSC1   扭矩/速度控制

TSC1 允许三种方式控制发动机:

  - 扭矩控制 (0% -> 100%)

  - 速度控制 (低怠速 ->高怠速)

  - 扭矩/速度限制(两者之中的低者)

例如:1、变速箱在换档时会利用此命令控制发动机转速;

      2、车辆控制器利用此命令控制发动机转速;

      3、牵引控制器利用此命令控制发动机的扭矩来防止车辆打滑

pgn0 -Torque/Speed Control #1 - TSC1 -

Transmission Repetition Rate:       when active; 10 ms to engine, 50ms toretarder

Data Length:                            8 bytes

Data Page:                       0

PDU Format:                           0

PDU Specific:                         DA

Default Priority:                3

Parameter Group Number:            0 ( 00000016 )

Bit Start Position /Bytes   Length SPNDescription                                       SPN

1.1                             2 bits            OverrideControl Mode                  695

1.3                             2 bits            RequestedSpeed Control Conditions     696

1.5                             2 bits            OverrideControl Mode Priority         897

2-3                             2 bytes           RequestedSpeed/Speed Limit            898

4                               1 byte            RequestedTorque/Torque Limit          518

数据域举例如下:

相应SPN介绍

SPN695 Override Control Mode

  00 – Override disable

  01 – Speed Control – Governs to a desiredSpeed

  10 – Torque Control – Maintains a desired Torque value

  11 – Speed/Torque Limit Control – Controls to the lowest value.

SPN897 -Override Control Mode Priority

  00 – Highest Priority

  01 – High Priority

  10 – Medium Priority

  11 – Low Priority

SPN696 - Requested Speed Control Conditions

  Basedon these bits (bits 4,3 in byte 1) up to Four (4) different ASGgainsets can be applied DYNAMICALLY.

  00 =Gainset 1   

  01 =Gainset2  

  10 =Gainset 3

  11 =Gainset 4

  This can be a significant advantage when the TSC1 is being used in speed control toaccomplish the application’s intended function. 

  Ex: Improve load pickup during loadedoperations and then switch to differentgainsetfor stability during light loading.

spn898- Requested Speed/Speed Limit -

  This is the engine speed which the engine is expected to operate at ifthe speed control mode is active or the engine speed which the engine is not expected to exceed if the speed limit mode is active.

  Data Length:                                  2bytes

  Resolution:                             0.125 rpm/bit , 0 offset

  Data Range:                             0 to 8,031.875 rpm

  Type:                                             Status

  Suspect Parameter Number:         898

  Parameter Group Number:             [0]                ->PGN No from previous slide

  Asthis is an SPN, don’t forget to Byte Swap when converting hence     0100 0000 0011 1000 swapped is 0011 100001000000

  To convert information

-CovertBinary to Decimal

-Multiplyby Resolution

-AddOffset

Hence: 00111000  0100 0000 = 38 40h

Convert to Dec:  3840h = 14400 Dec

Multiply by 0.125:  14400x 0.125 = 1800

Add 0:  1800 + 0 =1800

Result:  1800 rpm

spn518-Requested Torque/Torque Limit - This is the engine torque at which the engine is expected to operate ifthe torque control mode is active or the engine torque which the engine is notexpected to exceed if the torque limit mode is active.

Data Length:                                             1 byte

Resolution:                                     1 %/bit , -125 % offset

Data Range:                                        -125 to 125 %

Operating Range:                      0 to 125% engine torquerequests

Type:                                                        Status

Suspect Parameter Number:                       518

Parameter Group Number:                          [0]        ->PGN No from previous slide

Hence:      10010110 = 96h

Convert to Dec:  96h = 150 Dec

Multiply by 1:  150x 1 = 150

Add -125:  150 -125 = 25

Result:  25% TQ

SAE J1939学习笔记(三)

J1939故障代码种类

J1939 由几个不同的诊断信息:

   –诊断信息 1 - DM1 – 现行故障代码

   –诊断信息 2 - DM2 – 非现行故障代码

   –诊断信息 3 - DM3 – 清除非现行故障代码

通常地,用户会用 DM1 信息来读取现行故障码。

DM1 信息是 PGN 65226 or FECAh相关的信息请参考J1939-73标准。

PGN 65226

pgn65226 – Active DiagnosticTrouble Codes – DM1 

Transmission Repetition Rate: When a fault goes Active/Inactive & 1swhile active.

Data Length:                         Variable

Data page:                             0

PDU Format:                           254

PDU Specific:                          202

Default Priority:                       6

Parameter Group Number:            65226 (00FECA16)

Byte:      1                         LampStatus

Byte:      2                         Reserved

Bytes:     3–5                      SPN and FMI

Byte:      6 Bit:8                   SPNConversion

Byte:      6 Bits:1–7               Occurrence Count

注意:1.参考文件中例子字节和我引用的例子字节的描述序列均为:1 2 3 4 5 6 7 8...(字节)。

      2.参考文件中例子字节和我引用的例子字节的描述位序列均为:8 7 6 5 4 3 2 1(),即第一个数描述为第8位,依次递减,最小序号为1。如上例中,字节6的描述第8位则为第1个数。

        注:当实际需要计算的时候,或者其他应用的时候,仍然在前的为高位,并不需要做位调整,只是称呼不同而已。

      3.J1939字节排序为小端模式,即为高字节在后,低字节在前(多字节),所以实际计算的时候,如在数据域表示为8AA1,则实际的计算数据应为A18A(所有数据(不论多少个字节)都是最后一个字节为最高字节,这和16位或32为单片机有出入)(特殊情况例外,如下例的SPN

Byte1 – Lamp Status

§Bits1 – 2   Protection Lamp               保护灯状态

§Bits3 – 4   Amber Warning Lamp            琥珀色警告灯状态

§Bits5 – 6   Red Stop Lamp                 红色停止灯状态

§Bits7 – 8   Malfunction Indicator Lamp    故障指示灯状态

Bytes 3-5

    19位的数字是用于识别报告的诊断项目。SPN 用于多种目的,专用于诊断的有:(1)用于识别可修复的失效最小子系统;(2)用于识别子系统或集成部件可能并无严重故障,但存在运行不正常;(3)识别一个将要告知的专门事件或情况;以及(4)用于报告部件和非标准的故障模式。可疑参数与参数组中相关参数或与诊断项目一一对应,但并不是参数组中的参数本身。可疑参数编号与发送故障诊断信息的控制模块的地址编码无关,然而,有必要通过控制模块的地址编码来确定故障诊断信息是由网络上的哪个控制器来执行诊断的。 初始的511 SPN 是预置SPN,并将使用与在SAEJ1587中使用的参数标志符(PID )完全相同的编号。也就是在报告加速踏板故障时,该参数标志符在SAE J1587 中定义为PID 91 ,而 SPN 的编号就定义为SPN 91。所有其他的 SPN将从512 开始继续编号,且每加一作为一个新的赋值。生产厂可自定义可疑参数,编号自 520192524287,  多达4096个。

                                   

    FMI 定义了为SPN 所识别的子系统中发现的故障类型。注意,该故障可能不是电子故障,但相反可能是需要报告给设备技术员甚至操作员的子系统故障或条件,这些条件包括需要报告的系统事件或状态。FMI SPN 为预留的和发生次数域组合已知的诊断故障代码。如果另外的故障模式是必需的, FMI 将由CATARC来赋值。 

数据长度:      5 

分辨率:      1FMI/位 

数据范围:     031 

类型:         状态 

可疑参数编号: 1215 

                               -商用车控制系统局域网络(CAN 总线)通讯协议,第6 部分:应用层诊断

The Suspect Parameter Number (SPN) is converted into decimal depending on the Conversion Bit6.8.

Byte 6, Bit8tells us which method isused interpret the SPN

All Mid-Range and Heavy Duty will have a ‘0’ in this position henceConversion Method 0 (J1939 Version 4)

All High Horse Power will have a ‘1’ in this position hence Conversion Method 1 (J1939 Version 1)

Used by Mid-Range and Heavy Duty (QSB, QSC, QSM, QSX)

SPN = 000  00000010  0111 0101 = 629

FMI = 0 1100 = 12

SPN 629, FMI 12 = Fault Code 111 – Engine Control Module

                                                          – Criticalinternal Failure

Used by High Horse Power (QSK, QST, QSKV)

SPN = 0000 0000 0100 1110  101 = 629

FMI = 0 1100 = 12

SPN 629, FMI 12 = Fault Code 111 – Engine Control Module

                                                          – Criticalinternal Failure

注:实际还存在6.81的时候的版本2和版本3,这里不做介绍,可参考《商用车控制系统局域网络(CAN 总线)通讯协议,第6 部分:应用层诊断》

Byte 6, Bits 1 – 7  

Tellus how many times the fault has occurred.

Youcan directly convert this into decimal .

i.e.000 0010 = 2, hence this fault has occurred twice.

举例

Example:  (QSM,QSX,QSC,QSB)

Example:  (QSKV orHHP)

FMI Code  Description

   0  DataValid but above Normal Operating Range

    1  DataValid but below Normal Operating Range

    2  DataErratic, Intermittent or Incorrect

    3  Voltageabove Normal or Shorted to High Source

    4  Voltagebelow Normal or Shorted to Low Source

    5  Currentbelow Normal or Open Circuit

    6  Currentabove Normal or Grounded Circuit

    7  MechanicalSystem Not Responding or out of adjustment

    8  Abnormalfrequency or pulse width or period

    9  AbnormalUpdate Rate

  10  AbnormalRate of Change

  11  RootCause Not Know

  12  BadIntelligent Device or Component

  13  Outof Calibration

  14   SpecialInstructions

  15  DataValid But Above Normal Operating Range (Least Severe Level)

  16  DataValid But Above Normal Operating Range (Moderate Sever Level)

  17  DataValid But Below Normal Operating Range (Least Severe Level)

  18  DataValid But Below Normal Operating Range (Moderate Severe Level)

SAE J1939学习笔记(四)

多包通信(网络传输层)

1.pgn60416 – ConnectionManagement

2.pgn60160 – Data Transfer

3.举例

Note:The Data Packets may not follow immediately after the Broadcast message

1)管理包解释

2)数据包解释

SAE J1939学习笔记(五)

请求PGN

    对于特定目标地址的请求,目标地址必须做出响应。如果目标地址不支持请求的PGN,也必须发出一个NACK 的响应以表明它不支持该PGN。有些PGN 是多包的,因此一个单帧请求的响应可能有多个CAN 数据帧。如果是全局请求,当一个节点不支持某个PGN 时,不能发出NACK 响应。

附:

SAE J1939学习笔记(转)

相关推荐