Autosar uds development notes

1. 简介:

autosar和uds的功能基本固定,如果购买协议栈实现,以DID 0100为例(cp 蓝色的会是协议栈根据配置生成的接口),会是下面的流程:在这里插入图片描述

  1. 在配置工具中配置0100的DID,名称,长度,可读可写,会话限制,解锁限制,
  2. 工具生成对应接口(比如DID_0100_***(rtn, *data))
  3. 在接口中填写代码逻辑,比如读取数据, 然后将对应的数据填写到data中,rtn填回复的响应
  4. 协议栈自身会处理会话,解锁一些处理,并且将数据和回复进行打包回复
  5. 其他的服务类似,如果需要改动逻辑会生成接口,如果需要是协议栈内部处理在配置中直接关联即可

2. UDS服务开发

  1. uds协议栈相关(3E&NRC&0x10&0x85&0x28&会话保持&解锁验证&时间参数等)

    • 相关功能协议栈自己内部实现,按照不同项目的需求进行配置,配置完成以后基本不需改动
  2. 解锁相关(0x27)

    • 配置后会生成对应的接口,然后需要将对应的解锁算法进行填充,协议栈会自身将对应的解锁等级和服务相关联。例如在协议栈配置2701/02解锁,再将该解锁等级关联到2E 01 01,2E 01 01就只会在2701/02验证通过才能实现写入。
  3. 功能触发(0x31)

    • 31服务可以直接使用协议栈配置的接口实现
    • 31服务通常很固定且变更少,使用协议栈配置以后基本不需要改动
    • 31服务经常涉及到
### Autosar UDS Protocol Implementation and Usage The AUTOSAR (Automotive Open System Architecture) Unified Diagnostic Services (UDS) protocol defines a standardized set of services used for vehicle diagnostics. It ensures interoperability between different ECUs within an automotive system. #### Key Concepts in UDS Protocol 1. **Diagnostic Communication Manager (DCM)** Once the DCM is integrated into your project, it becomes essential to understand how each diagnostic service supported by your ECU should be configured, implemented, and managed both by the DCM and your application logic[^1]. The configuration process involves defining which diagnostic requests are allowed or denied based on specific conditions such as security levels or operational states. 2. **Event Handling with Warning Indicators** In certain scenarios, events may trigger warnings through indicators like dashboard lights. An event's warning indicator request status can be determined using bit 7 of the UDS status byte[^2]. This allows developers to control whether a user-controlled warning light should illuminate under predefined circumstances. 3. **Service Implementation Details** To implement these functionalities effectively, one must consult detailed documentation provided in Chapter 5 ("Diagnostic Service Implementation") where API definitions outline necessary procedures for integrating various diagnostic features properly. 4. **Example Code Snippet** Below demonstrates a basic example illustrating interaction with some fundamental aspects related to handling responses from diagnostic commands via Python-like pseudocode: ```python def send_diagnostic_request(service_id, sub_function=None): """Simulates sending a diagnostic request.""" message = { 'service': service_id, 'subFunction': sub_function if sub_function else None } response = simulate_ecu_response(message) return parse_udss(response) def check_warning_indicator_status(status_byte): """Checks if the warning indicator was requested according to UDS specification.""" # Extracting Bit 7 value indicating User Controlled Warning Indicator Request Status ucwir_bit_value = bool((status_byte >> 7) & 0b1) return ucwir_bit_value # Example function call simulating reading Event State Information Response containing Status Byte response_data = {'statusByte': int('B8', base=16)} # Hypothetical hexadecimal representation is_requested = check_warning_indicator_status(response_data['statusByte']) print(f"Warning Light Activation Requested? {is_requested}") ``` This code snippet provides insight into querying diagnostic information while interpreting relevant bits inside received bytes per specifications outlined earlier regarding managing statuses tied directly back towards practical implementations involving real-world applications leveraging this framework correctly following best practices established throughout industry standards today!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值