LDF文件分析

本文详细解析了LIN协议的配置文件,包括节点定义、信号类型(普通信号、诊断信号)、报文框架(普通报文、零星报文、诊断报文)以及节点属性和调度表,展示了如何在LIN通信中设置参数和数据交换.

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

文件配置

/* 
 * Copyright (c) 2015 - 2016 , Freescale Semiconductor, Inc.                             
 * Copyright 2016-2017 NXP                                                                    
 * All rights reserved.                                                                  
 *                                                                                       
 * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.                          
 */
/*---------GLOBAL DEFINITIONS-----------*/

LIN_description_file;//LIN描述文件 
LIN_protocol_version = "2.1";//LIN协议版本 
LIN_language_version = "2.1";//LIN语言版本 
LIN_speed = 19.2 kbps;//LIN通信波特率

节点

Nodes {
  Master: SeatECU, 5 ms, 0.1 ms ;//主节点,时基,抖动
  Slaves: Motor1, Motor2, New_SlaveNode ;//从节点
}

普通信号

Signals {
  Motor1ErrorCode: 8, 5,     Motor1, SeatECU ;
  //信号名称      长度 起始位置 发送节点  接收节点
  Motor1ErrorValue: 8, 1, Motor1, SeatECU ;
  Motor1LinError: 1, 0, Motor1, SeatECU ;
  Motor1Selection: 2, 0, SeatECU, Motor1 ;
  Motor1Temp: 8, 5, Motor1, SeatECU ;
  Motor2ErrorCode: 8, 2, Motor2, SeatECU ;
  Motor2ErrorValue: 8, 4, Motor2, SeatECU ;
  Motor2LinError: 1, 0, Motor2, SeatECU ;
  Motor2Selection: 2, 0, SeatECU, Motor2 ;
  Motor2Temp: 8, 0, Motor2, SeatECU ;
  MotorDirection: 2, 0, SeatECU, Motor1, Motor2 ;
  MotorSpeed: 10, 0, SeatECU, Motor1, Motor2 ;
  Motor1Position: 32, {0, 0, 0, 0}, Motor1, SeatECU ;
  Motor2Position: 32, {0, 0, 0, 0}, Motor2, SeatECU ;
  New_Frame_NewSignal: 32, {0, 0, 0, 0}, New_SlaveNode, Motor1 ;
}

诊断信号

Diagnostic_signals {
  MasterReqB0: 8, 0 ;
  //信号名称    长度 默认值
  MasterReqB1: 8, 0 ;
  MasterReqB2: 8, 0 ;
  MasterReqB3: 8, 0 ;
  MasterReqB4: 8, 0 ;
  MasterReqB5: 8, 0 ;
  MasterReqB6: 8, 0 ;
  MasterReqB7: 8, 0 ;
  SlaveRespB0: 8, 0 ;
  SlaveRespB1: 8, 0 ;
  SlaveRespB2: 8, 0 ;
  SlaveRespB3: 8, 0 ;
  SlaveRespB4: 8, 0 ;
  SlaveRespB5: 8, 0 ;
  SlaveRespB6: 8, 0 ;
  SlaveRespB7: 8, 0 ;
}

普通报文

Frames {
  Motor1Control: 48, SeatECU, 1 {
  //帧名称       帧ID 发送节点  数据字节长度
    Motor1Selection, 0 ;
    //信号名         起始位   
  }
  Motor1State_Cycl: 51, Motor1, 6 {
    Motor1Temp, 0 ;
    Motor1Position, 8 ;
    Motor1LinError, 40 ;
  }
  Motor1State_Event: 54, Motor1, 3 {
    Motor1ErrorCode, 8 ;
    Motor1ErrorValue, 16 ;
  }
  Motor2Control: 49, SeatECU, 1 {
    Motor2Selection, 0 ;
  }
  Motor2State_Cycl: 52, Motor2, 6 {
    Motor2Temp, 0 ;
    Motor2Position, 8 ;
    Motor2LinError, 40 ;
  }
  Motor2State_Event: 55, Motor2, 3 {
    Motor2ErrorCode, 8 ;
    Motor2ErrorValue, 16 ;
  }
  MotorsControl: 45, SeatECU, 8 {
    MotorDirection, 0 ;
    MotorSpeed, 2 ;
  }
  New_Frame: 24, New_SlaveNode, 8 {
    New_Frame_NewSignal, 28 ;
  }
}

零星报文

Sporadic_frames {
  SporadicControlFrame: Motor1Control, Motor2Control ;
  //零星报文集合         //报文1名称     报文2名称
}

诊断报文

Diagnostic_frames {
  MasterReq: 0x3c {//请求报文
    MasterReqB0, 0 ;
    MasterReqB1, 8 ;
    MasterReqB2, 16 ;
    MasterReqB3, 24 ;
    MasterReqB4, 32 ;
    MasterReqB5, 40 ;
    MasterReqB6, 48 ;
    MasterReqB7, 56 ;
  }
  SlaveResp: 0x3d {//响应报文
    SlaveRespB0, 0 ;
    SlaveRespB1, 8 ;
    SlaveRespB2, 16 ;
    SlaveRespB3, 24 ;
    SlaveRespB4, 32 ;
    SlaveRespB5, 40 ;
    SlaveRespB6, 48 ;
    SlaveRespB7, 56 ;
  }
}

节点属性

Node_attributes {
  Motor1{//节点名称
    LIN_protocol = "2.1" ;//协议版本
    configured_NAD = 0x2 ;//NAD
    initial_NAD = 0xA ;//默认NAD
    product_id = 0x1E, 0x1, 0 ;//产品ID 功能ID 可变ID
    response_error = Motor1LinError ;//应答错误名称
    P2_min = 100 ms ;//从 LIN 子网接收到主机请求帧到 LIN 的从机节点准备好数据发送应答之间的最小时间间隔
    ST_min = 20 ms ;// 从机节点准备接收下一个帧(主机请求帧)或准备发送下一个帧(从机应答帧)的应答部分所需要的最小准备时间
    N_As_timeout = 1000 ms ;
    N_Cr_timeout = 1000 ms ;
    configurable_frames {//节点包含的报文
      Motor1Control ;
      Motor1State_Cycl ;
      Motor1State_Event ;
      MotorsControl ;
      New_Frame ;
    }
  }
  Motor2{
    LIN_protocol = "2.1" ;
    configured_NAD = 0x3 ;
    initial_NAD = 0xC ;
    product_id = 0x2E, 0xB, 1 ;
    response_error = Motor2LinError ;
    P2_min = 50 ms ;
    ST_min = 0 ms ;
    N_As_timeout = 1000 ms ;
    N_Cr_timeout = 1000 ms ;
    configurable_frames {
      Motor2Control ;
      Motor2State_Cycl ;
      Motor2State_Event ;
      MotorsControl ;
    }
  }
  New_SlaveNode{
    LIN_protocol = "2.1" ;
    configured_NAD = 0xFF ;
    initial_NAD = 0xFF ;
    product_id = 0x0, 0x0, 255 ;
    P2_min = 50 ms ;
    ST_min = 0 ms ;
    N_As_timeout = 1000 ms ;
    N_Cr_timeout = 1000 ms ;
    configurable_frames {
      New_Frame ;
    }
  }
}

调度表

Schedule_tables {
  Configuration_Schedule {//调度表名称 
    AssignNAD {LSM} delay 15 ms;      
    //报文名称 节点  时隙
  } 
 NormalTable {//普通调度表
    Motor1Control delay 50 ms ;//报文名称 时隙
    Motor1State_Cycl delay 50 ms ;
  }
}

信号编码

Signal_encoding_types {
  New_Frame_NewSignal_Encoding_1 {//信号编码名称
    physical_value, 6, 15, 0.01, 0 ;
    //物理值        最小值 最大值 放大倍数 偏移量
    logical_value, 7, "off" ;
    //逻辑值       7代表off
    logical_value, 8, "on" ;
  }
}

定义映射关系

Signal_representation {
  New_Frame_NewSignal_Encoding_1: New_Frame_NewSignal ;
  //应用信号编码的信号包括          信号1名称
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不吃鱼的羊

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值