AUTOSAR DEM Configuration

本文只介绍AUTOSAR DEM配置,目的在于指导DEM快速开发,对于AUTOSAR DEM 功能请参见AUTOSAR DEM Introduction 一文

Workflow

AUTOSAR DEM Configuration

Step

Action

Refer to Section

1

定义DEM General

Dem General

2

定义Freeze Frame

Freeze Frame

3

定义Extended Data

Extended Data

4

定义 Enable Condition(Option)

Dem Enable Condition

5

定义Storage Condition (Option)

Dem Storage Condition

6

定义Operation Cycle

Operation Cycle

7

定义Event

Event Basic

Event Details

Debouncing(Option)

8

定义DTC

DTC

9

定义Callback(Option)

Callback

Dem General

Note:下图只是示例,具体配置要结合需求

AUTOSAR DEM Configuration

AUTOSAR DEM Configuration

AUTOSAR DEM Configuration

AUTOSAR DEM Configuration

Aging After Healing

DEM_AGING_WHILE_HEALING : Aging Process 可以不需要等待Healing 完成,只有满足Aging Process 触发条件就可以

DEM_AGING_AFTER_HEALING: AUTOSAR 标准, Aging Process 可以需要等待Healing 完成才可以Aging Process

DEM_AGING_AFTER_HEALING_ALL_DTC:  与DEM_AGING_AFTER_HEALING 类似,如果Event 不关联Indicator 也需要Healing 完成才可以Aging Process

Aging Behavior : Aging判断与触发条件

Aging Counter Behavior : Aging Counter 变化的方式

DEM_AGING_COUNT_ALWAYS: 即使EVENT Aging Process disabled , Aging Counter 也会变化

DEM_AGING_COUNT_ONLY_AGEABLE:: Aging Counter 变化只针对Enable Aging Process 的Event

Aging Counter Report: Aging Counter 对于report的形式(通过Internal Element Data)

Aging Retain Environment Data: 当Aged时, 对应的FF/ExtendData 是否一并清除

Availability Support :是否支持运行期ACTIVATE/DEVATIVATE 某个Event. 具体配置还需要在Event 级别

BswError Buffer Size: Dem Processing Queue Size, 一个Dem Mainfunction 最后能处理的Event个数,如果超过则会丢失

Clear Dtc Behavior:

ALL_SUPPORTED_DTCS: The API accepts all supported DTC values, as well as all DTC values which are configured in DemGroupDTCs and DEM_DTC_GROUP_ALL_DTCS (default).

ONLY_CLEAR_ALL_DTCS: The API accepts ClearAllDTCs only (DTC Group 0xFFFFFF).

ONLY_CLEAR_OBDII_AND_ALL_DTCS: The API accepts ClearAllDTCs only (DTC Groups 0x000000, 0xFFFFFF).

ONLY_CLEAR_SINGLE_AND_ALL_DTCS: The API accepts DTC numbers and ClearAllDTCs (DTC Group, 0xFFFFFF).

ONLY_CLEAR_WWHOBD_AND_ALL_DTCS: The API accepts ClearAllDTCs only (DTC Groups 0xFFFF33, 0xFFFFFF).

Clear DTC Behavior:

VOLATILE: 只清空RAM

NONVOLATILE_TRIGGER: ClearDTC 清空RAM 之后会trigger Clear NVM Data ,但是不会等待NVM 数据清除完成在给response

NONVOLATILE_FINISH: ClearDTC 需要清空RAM,NVM Data 都完成才会给出response

DTC StatusAvailablityMask: 用于$19 的DTC Mask

Event Displacement Strategy: 当Dem Primary 满了的时候,Event 替换原则

NONE: 不替换,新的Event将不再存储在DEM Fault Memory

PRIO_OCC: 根据Priority, Occurrence 进行替换

FULL: 根据Priority, Passive status ,Occurrence 进行替换

EventMemory Entry Storage Trigger:

写入New Event entry到Dem Fault Memory的触发源

AUTOSAR DEM Configuration

Extended Data Capture: 收集Extended Data 的时机

FreezeFrame Capture : 收集FF 的时机

TESTFAILED: 每次请求Test Failed

MEMORY_STORAGE: EVENT 第一次写入DEM PRIMARY BLOCK

Latch Test Failed Behavior: Latch Test Failed策略,具体是否启用在Event级别

DEM_LATCH_TF_ONLY_THIS_CYCLE: 如果Event 在本次Operation Cycle Failed,不能在Passed

DEM_LATCH_TF_CONFIRMED_AND_THIS_CYCLE : 如果Event 在本次Operation Cycle Failed,不能在Passed ,另外如果Event is Confirmed ,则需要Clear Fault之后才可以再次Passed

Max Number Event Entry Primary:  最多可以存储的Event 个数

Max Number Prestored FF:  最多存储的Prestored FF 个数

Occurrence Counter Process: Occurrence Counter 变化策略

DEM_PROCESS_OCCCTR_TF :每次TF 都 +1

DEM_PROCESS_OCCCTR_CDTC: 只有confirm 才 +1

Operation Cycle Storage : Operation Cycle State是否需要存储在NVM , 当Operation Cycle 大于Power Cycle 会用到这个功能

Reset Debounce Behavior :  Event Enable Condition 和 Debounce Counter  之间的关系

DEM_RESET_DEBOUNCE_ON_DISABLE_ENABLE_CONDITIONS

如果Event Enable Condition 不满足,需要reset Debounce Counter

DEM_RESET_DEBOUNCE_ON_ENABLE_ENABLE_CONDITIONS

如果Event Enable Condition 从不满足切换至满足,需要reset Debounce Counter

Restart Cycle on Init Ref : 由Dem_PreInit  Start所指定的 Operation Cycle

Reset TF on OperationCycle Start: Reset TF bit 当Operation Cycle Start

Status Bit TF Storage :  TF Bit 是否存储在NVM 中, 也就是说上个上电周期TF bit 将会影响下个上电周期

Status Bit ConfirmDTC Reset on Overflow : Confirm Bit是否reset 当发生Displacement  

Status Bit PendingDTC Process: Pending DTC 更新策略

STOREDONLY: 只有对应EVENT 存储在Dem Primary中才可以设置PendingDTC bit, 反之如果EVENT 被Displacement  或Aged 或 Clear Fault(Event 被从Dem Primary中移除),则需要Reset PendingDTC bit

ALL_DTC: PendingDTC bit 并不会受到影响,即使Event 被从Dem Primary中移除

Status bit TestFailedSinceLastClear Handing : TestFailedSinceLastClear 更新策略

AGING_AND_DISPLACEMENT: 当Displacement  或Aged或Clear Fault 发生时,由于Event 被从Dem Primary中移除,对应的TestFailedSinceLastClear bit 需要reset

NORMAL: 当Clear Fault 发生时,由于Event 被从Dem Primary中移除,对应的TestFailedSinceLastClear bit 需要reset

AGING: 当Aged 或Clear Fault 发生时,由于Event 被从Dem Primary中移除,对应的TestFailedSinceLastClear bit 需要reset

Status Bit WIR User Controlled: 是否支持外部勇敢通过Dem_SetWIRStatus 设置WIR

Status Bit WIR Controlled Behavior :

DISABLED_DURING_CONTROLDTCSETTING: 如果通过$85已经Disable DTC ,那么请求Dem_SetWIRStatus 将会返回E_NOT_OK

ENABLED_DURING_CONTROLDTCSETTING:通过 $85 Disable DTC宁不能影响外部设置WIR

Status Bit WIR Process: WIR bit 更新策略

STOREDONLY: 只有对应EVENT 存储在Dem Primary中才可以设置WIR Bit, 反之如果EVENT 被Displacement  或Aged 或 Clear Fault(Event 被从Dem Primary中移除),则需要Reset WIR bit

ALL_DTC: WIR bit 并不会受到影响,即使Event 被从Dem Primary中移除

Support Aging For All DTC: 是否所有Event 都支持AGING ,即使Event 没有存储在DEM Primary 中

Suppression Support: 是否支持DTC Suppression

Type of FreezeFrameRecord Numeration : FF记录策略分析

CALCULATED :在具体event级别需要设置Max Number FreezeFrameRecord即可

CONFIGURED: 在具体event级别需要设置DemFreezeFrameRecNumClassRef,用于指定这个EVENT 特殊的Storage Trigger/Update Condition

Event Combination Support: 对于多个Event 映射一个DTC的策略

DISABLED: 不支持

TYPE1: 只占用一个存储空间,相关数据也只存储一份比如FF,EX

TYPE2: 每个EVENT都会独立的存储, 数据也是一个EVENT 一份

Freeze Frame

DemDataClass

位置在DemGeneral/DemDataClass

AUTOSAR DEM Configuration

Data Element  Data Size : 数据长度

Data Element Endianness: 大小端(只在USE_DATA_SENDER_RECEIVER 生效)

Data Element Read Fnc : User Defined Callback Function(只在USE_DATA_FUNCTION_CALL生效)

Data Element Store Non-Volatile: 是存储在NVM

Data Element Use Port

USE_DATA_FUNCTION_CALL: 通过User Defined Callback 方式获取对应的FF Data

USE_DATA_SENDER_RECEIVER: 通过RTE Sender/Receiver 方式获取数据,会生成对应的Receiver Port, 需要由SWC 和其连接

USE_DATA_CLENT_SERVER_PORT: 通过RTE Client/Server 方式获取数据,会生成对应的Client Port, 需要由SWC 和其连接

Internal Data Element: 对于FF来说不需要选择

DemDidClass

位置在DemGeneral/DemDidClass, 在这里需要执行DID($19 04),同时需要引用DemDataClass

AUTOSAR DEM Configuration

AUTOSAR DEM Configuration

DemFreezeFrameClass

位置在DemGeneral/DemFreezeFrameClass, 可以由多个DemFreezeFrameClass被不同的Event关联

在DemFreezeFrameClass定义当前所关联的FF Data

AUTOSAR DEM Configuration

DemFreezeFrameRecNumClass

只有DcmGeneral/Type of FreezeFrameRecord Numeration : CONFIGURED 时才需要被引用

位置在DemGeneral/DemFreezeFrameRecNumClass

AUTOSAR DEM Configuration

FreezeFrameRecord Number: FF Data的数量

FreezeFrameRecord Trigger: 收集数据的触发源, 只是收集数据,并不是触发写入数据到dem fault memory

AUTOSAR DEM Configuration

FreezeFrameRecord Update: 触发写入数据到dem fault memory

AUTOSAR DEM Configuration

Extended Data

DemDataClass

位置在DemGeneral/DemDataClass, 对于Extended Data ,如果需要引用internal DataElement 则Port 需要选择USE_DATA_INTERNAL ,同时Internal DataElement 需要选择要获取Internal Data

AUTOSAR DEM Configuration

DemExtendedDataRecordClass

位置在DemGeneral/DemExtendedDataRecordClass , 在这里要关联多个DemDataClass

AUTOSAR DEM Configuration

ExtendedDataRecord Number: $19 06 读取Extended Data 所指定的ID, 每个Record 需要有唯一的一个ID Number

AUTOSAR DEM Configuration

DemExtendedDataClass

位置在DemGeneral/DemExtendedDataClass, 可以包含若干个Extended Data Class

AUTOSAR DEM Configuration

Dem Enable Conditions

每个event 可以有多个Storage Enable Condition, 当所有的Condition满足时,才会将Event Entry写入Dem fault memory

DemEnableCondition

位置是DemGeneral/DemEnableCondition

AUTOSAR DEM Configuration

通过接口如下接口设置Enable

Std_ReturnType Dem_SetEnableCondition(uint8 EnableConditionID, boolean ConditionFulfilled)

DemEnableConditionGroup

位置是DemGeneral/DemEnableConditionGroup

DemEnableConditionGroup 被Event 所引用,只有其包含的所有Enable Condition都满足才可以

AUTOSAR DEM Configuration

Dem Storage Conditions

DemStorageCondition

位置是DemGeneral/DemStorageCondition

AUTOSAR DEM Configuration

DemStorageConditionGroup

位置是DemGeneral/DemStorageConditionGroup

AUTOSAR DEM Configuration

Operation Cycle

位置是DemGeneral/DemOperationCycle

可以定义多个Operation Cycle

在INIT 阶段 : Dem_SetOperationCycleState(IGNITION, DEM_CYCLE_STATE_START );

在SHUTDOWN 阶段:Dem_SetOperationCycleState(IGNITION, DEM_CYCLE_STATE_STOP );

AUTOSAR DEM Configuration

Automatic End:  选择则不需要APP STOP Operation Cycle,其将在DEM_SHUTDOWN 中由DEM来完成

Automatic Start: 并无作用,将用DemGeneral/DemRestartCycleOnInitRef代替

OperationCycle Type: 仅对OBD ECU 起作用

Event Basic

位置是DemConfigSet/DemEventParameters

AUTOSAR DEM Configuration

Event Available : Event是否Available , 对于Unavailable Event将不能被请求更新状态,同样运行期也可以通过Dem_SetEventAvailable进行设置

Event ID:  线性变化的ID

Event Latch TestFailed: 是否支持Latch TF, 其用法见DcmGeneral/ Latch Test Failed Behavior:

Extended Data Class Ref: 引用Extended Data

FreezeFrame Class Ref: 引用FF

FreezeFrameRecNum Class Ref: 引用FF Rec Num, 只有DcmGeneral/Type of FreezeFrameRecord Numeration : CONFIGURED 时才需要被引用

Max Number FreezeFrame Record: FF Record只有DcmGeneral/Type of FreezeFrameRecord Numeration : CALCULATED时才需要被引用

Event Details

位置是DemConfigSet/DemEventParameters/DemEventClass

AUTOSAR DEM Configuration

Aging Allowed: 当前Event 是否运行Aging Process

AgingCycle Counter Threshold: Clear Event需求的AgingCycle

AgingCycle Ref: Aging Process 所关联的Cycle, 通过调用Dem_UpdateAgingCounter进行Aging 更新

EnableCondition Group Ref: 引用EnableCondition Group

Event Destination:

PRIMARY_MEMORY: 存储在这里面的可以被$19,$14 所获取,也是绝大部分Event存储的方式之一

SECONDARY_MEMORY:

存储在 Secondary Memory 中的EVENT 所对应的DTC 通过19 读取不出来, 一旦多个Secondary DTC 映射一个Primary DTC, 类似多个Event 对应一个DTC ,当Secondary DTC Qulification, 所对应的Primary DTC 也Qualify ,但是需要APP 自己完成

Event FailureCycle Ref: 需要引用的Cycle

Event FailureCycleCounter Threshold: Confirm bit被设置所需要的Cycle Counter

Event Priority: Event 优先级, 当Displacement 发生时会有作用

FreezeFrame Prestorage Support: 是否支持 Prestore FF

  1. PreStorage 需要显示调用Dem_PreStoreFreezeFrame
  2. 当正式的Freeze Frame收集被触发,PreStore 的FF 数据将会被使用

Operation Cycle Refer关联一个Operation Cycle 将影响Event UDS bit

StorageCondition Group Ref:  引用StrorageCondition Group

Debouncing

位置是DemConfigSet/DemEventParameters/DemEventClass/DemDebounceAlgorithmClass

DemDebounceMonitorInternal

配置一个Callout用于实现Debounce的变化

AUTOSAR DEM Configuration

DemDebounceCounterBased

基于预先配置好Increase/Decrease counter 进行Debounce

AUTOSAR DEM Configuration

Debounce Behavior:

FREEZE: Debounce Counter 并不会恢复初始值,当Enable Condition , ControlDtcSetting,举个例子我们将BUSOFF 作为Enable Condition ,假设一个Message TO 是500ms, 现在Debounce Counter已经累加到250了,如果此时产生BUSOFF, 需要Disable Condition, 当BUSOFF 恢复后再次Enable Condition时, 之前累计的Debounce Counter是否要继续,还是复位

RESET: ,当Enable Condition , ControlDtcSetting 需要 Reset (0) Debounce Counter

Debounce Continues: 当Disable Condition/ ControlDtcSetting Disable DTC 时,是否Debounce Counter是否依然会持续技术,即不受这些条件影响

Debounce Counter Storage: 是否将Debounce Counter存储在NVM 中

Debounce Counter Decrement Step Size: PreTestPassed 减少的步长

Debounce Counter Failed Threshold: Event Test Failed 的Threshold

Debounce Counter Increment Step Size: PreTestFailed 增加的步长

Debounce Counter Passed Threshold: Event Test Passed 的Threshold

Debounce Counter JumpDown Value:

如果启用,当PreTestPassed时,如果Debounce Counter >= JumpDown Value, 则 Debounce Counter = JumpDown Value

Debounce Counter JumpUp Value:

如果启用,当PreTestFailed时,如果Debounce Counter <= JumpUp Value, 则 Debounce Counter = JumpUp Value

DemDebounceTimeBased

AUTOSAR DEM Configuration

DebounceTime Failed Threshold: PreFailed 产生之后,多久之后会真正的产生TestFailed, 在这期间如果出现PreFailed 不连续(中间穿插PrePassed),则会重新计数

DebounceTime Passed Threshold: PrePassed 产生之后,多久之后会真正的产生TestPassed, 在这期间如果出现PrePassed 不连续(中间穿插PreFailed),则会重新计数

DTC

位置是DemConfigSet/DemDTCClass

AUTOSAR DEM Configuration

DTC Functional Unit:通过$19 09 可以读取

DTC Severity:

DTC的严重程度,ISO- 14229 所特有, $19 08/09 所使用

  • DEM_DTC_SEV_NO_SEVERITY: No severity information available.
  • DEM_DTC_SEV_MAINTENANCE_ONLY: Maintenance required.
  • DEM_DTC_SEV_CHECK_AT_NEXT_HALT: Check at next halt.
  • DEM_DTC_SEV_IMMEDIATELY: Check immediately.

Immediate Nv Storage DTC 对应的EVENT 是否立即存储到NVM 中,非同步方式,如果Disable,数据将在DEM_Shutdown中写入

UDS DTC: DTC Number

Callback

Event ClearEventAllowed Callback

Event 级别的Callback,用于在清除fault($14) 之前判断该fault是否可以清除

位置是DemConfigSet/DemEventParameters/DemCallbackClearEventAllowed

AUTOSAR DEM Configuration

Std_ReturnType Dem_CallbackClearEventAllowed (boolean *ClearAllowed);

Event EventStatusChanged Callback

Event 级别的Callback,Event Status 变化时会触发

位置是DemConfigSet/DemEventParameters/ DemCallbackEventStatusChanged

AUTOSAR DEM Configuration

Std_ReturnType Dem_CallbackEventStatusChanged (Dem_UdsStatusByteType EventStatusOld ,Dem_UdsStatusByteType EventStatusNew);

Event EventDataChanged Callback

Event 级别的Callback,Event Data 变化时会触发

位置是DemConfigSet/DemEventParameters/DemCallbackEventDataChanged

AUTOSAR DEM Configuration

Std_ReturnType Dem_CallbackEventDataChanged (void);

Global EventDataChanged Callback

Global级别的Callback,Event Data 变化时会触发

位置是DemGeneral/Trigger GlobalEventDataChanged Callback

Std_ReturnType Appl_Dem_GeneralCBDataEvt_EventDataChanged(Dem_EventIdType EventId)

Global EventStatusChanged Callback

Global级别的Callback,Event Status 变化时会触发

位置是DemGeneral/Trigger GlobalEventStatusChanged Callback

Std_ReturnType Appl_Dem_GeneralCBStatusEvt_GeneralCallbackEventUdsStatusChanged(Dem_EventIdType EventId, Dem_UdsStatusByteType EventUdsStatusOld, Dem_UdsStatusByteType EventUdsStatusNew

Global DTCStatusChanged Callback

Global级别的Callback,DTC Status 变化时会触发

位置是DemGeneral/DemCallbackDTCStatusChanged

AUTOSAR DEM Configuration

Std_ReturnType DemCallbackDTCStatusChanged (uint32 DTC, Dem_DTCStatusMaskType DtcStatusOld, Dem_DTCStatusMaskType DtcStatusNew )

Start to Clear DTC Callback

 $14 执行Clear DTC 在清除DEM 数据之前触发

位置是DemGeneral/DemEventMemorySet/DemClearDTCNotification

AUTOSAR DEM Configuration

Finish to Clear DTC Callback

 $14 执行Clear DTC 在清除DEM 数据之后触发

位置是DemGeneral/DemEventMemorySet/DemClearDTCNotification

AUTOSAR DEM Configuration

Std_ReturnType ClearDTCCallOut(uint32 DTC, Dem_DTCFormatType DTCFormat, Dem_DTCOriginType DTCOrigin)

上一篇:伪类和伪元素概念


下一篇:【六级单词】2022.1.24