3

In the Autosar DEM module, there are two debounce mechanisms : Counter based and timer based.Which mechanism is a good one? How to decide, what mechanism needs to be applied for a given event?

xyz101
  • 149
  • 1
  • 5

2 Answers2

2

The debounce algorithms are described in the AUTOSAR Dem spec., in short:

  • the counter based debouncing needs the reporting by Dem_SetEventStatus() with PREPASSED and PREFAILED status in order to increment/decrement the counter.

  • The timer based debouncing only needs a single reporting trigger by Dem_SetEventStatus(), in order to start the debounce timer to start. The timer is then updated by the Dem_Mainfunction() cyclically in the direction triggered.

Consider the following use-cases:

  • Monitor runs only once and gives immediate result --> counter based
    • startup RAM test failed, or
    • "EOL Inspection Executed"
  • Monitor runs cyclically, but it needs N times consecutive failure reporting to have an active DemEvent --> counter based e.g. if Adc sampling failed (due to HW problem) for 5 cycles, or if voltage is out of range for 3 cycles
  • Com Timeout handling --> timer based Customer wants to have 3 times message cycle for timeout. After that you shall start already failsafe handling, but the DemEvent/DTC shall only be active after another 1000ms. Failsafe handling could mean to use last known good value or failsafe / default values.

    • Com_TOut_MessageX() -> called once by Com, when the Timeout (3x message cycle) occurs
    • Com_RxAck_MessageX() -> called once by Com, when a message is received
kesselhaus
  • 1,241
  • 8
  • 9
0

Timer base: is suitable for timeout errors.

Example:

Message cylce time is 250ms, time base is 10ms.

Message is considered to be timeout after 2 cycles of missing, then the config counter for Dem should be 50.

Counter base: is suitable for event errors (DLC, Checksum...).

Example:

Message is consider to have DLC error after 3 cycles of DLC wrong, then the config counter for Dem should be 2.

Van Tr
  • 5,889
  • 2
  • 20
  • 44