1. 程式人生 > >DTC Status Bits in Automotive Diagnostics

DTC Status Bits in Automotive Diagnostics

參考:https://zhuanlan.zhihu.com/c_153808584

Fault Code Status Bits in Automotive Diagnostics
Status bits in Automotive Diagnostics
Diagnostic Trouble Code: When Fault occurs in vehicle, associated ECU captures it and stores it in memory as fault code. This is specific number for type of Fault and is called Diagnostic Trouble Code. This information can be retrieved either by tools at service station or by in vehicle methodologies.
Operation Cycle

: Operation Cycle is the state in which ECU is operational. This is designer specific and it can be based on specific vehicle modes also. (Ex: Running, Pre-Running, Cranking)

kl15通,打火成功,kl15斷,這算是一個cycle。

kl15通,未打火,kl15斷,則不算是一個cycle。
Monitor Routine: Monitor Routine or Test Routine is the program which runs every operation cycle at some periodicity. They check whether the fault is still injected or active or not. Accordingly counter for the maturity of the fault for active and inactive will be decided. Maturity of the fault confirms the DTC for active and inactive state.
Clearing the DTC

: DTC clearing is done using the ISO command for requesting Clear from the tester. The service ID is 14 for clearing the current DTCs(Fault code).
DTC status Bits: Each DTC will have Status byte that provides the status information of DTC. Each bit in the status bytes has meaning and provides different information. Let’s start with LSB
某廠的規定:
在這裡插入圖片描述

Bit0 => This Bit is “testFailed”. This bit provides the information about the fault (Error) is still active (injected) or not. If Fault is still injected or Active, then the value is 1 otherwise the value is 0. Ex: Fault “Short Circuit” is still active.

通常來說,ECU內部以迴圈的方式不斷地針對預先定義好的錯誤路徑進行測試,如果在最近的一次測試中,在某個錯誤路徑中發現了故障,則相應DTC的這一個狀態位就要被置1,表徵出錯。此時DTC的testFailed位被置1,但是它不一定被ECU儲存到non-volatile memory中,只有當pendingDTC或confirmedDTC被置1時DTC才會被儲存。而pendingDTC或confirmedDTC被置1的條件應該是檢測到錯誤出現的次數或時間滿足某個預定義的門限。當錯誤消失或者診斷儀執行了清除DTC指令時,testFailed會再次被置為0。

Bit1 => This Bit is “testFailedThisOperationCycle”. This bit indicates whether the fault is occurred anytime during the current operation cycle. If Fault has occurred in the current operation cycle, then the value is 1 otherwise the value is 0.
這個bit用於標識某個DTC在當前的operation cycle中是否出現過testFailed置1的情況,即是否出現過錯誤。operation cycle的起始點是ECU通過網路管理喚醒到ECU通過網路管理進入睡眠,對於沒有網路管理的ECU,這個起始點就是KL15通斷。通過bit 0我們無法判斷某個DTC是否出現過,比如,當前testFailed = 0, 說明當前這個DTC沒有出錯,*如果testFailedThisOperationCycle = 1的話,就說明這個DTC在當前這個operation cycle中出過錯,但是當前錯誤又消失了。
*
Bit2 => This Bit is “pendingDTC”. This bit indicates whether the fault is occurred anytime during the current operation cycle. The only difference between “testFailedThisOperationCycle” and “pendingDTC” is “testFailedThisOperationCycle” is cleared at the end of current operation cycle (least bothering whether the fault is still active or inactive) and “pendingDTC” is cleared only when in next operation cycle the monitor routine is run and the result shows pass(fault is not present). So if Fault is still injected or Active in the current operation cycle, then the value is 1 otherwise if the Fault was active in previous operation cycle and is inactive (i.e monitor routine is run and fault is inactive) in the current operation cycle, then the value is 0.
根據規範的解釋,pendingDTC = 1表示某個DTC在當前或者上一個operation cycle中是否出現過。pendingDTC位其實是位於testFailed和confirmedDTC之間的一個狀態,有的DTC被確認的判定條件比較嚴苛,需要在多個operation cycle中出現才可以被判定為confirmed的狀態,此時就需要藉助於pendingDTC位了。pendingDTC = 1的時候,DTC就要被儲存下來了,如果接下來的兩個operation cycle中這個DTC都還存在,那麼confirmedDTC就要置1了。如果當前operation cycle中,故障發生,pendingDTC = 1,但是在下一個operation cycle中,故障沒有了,pendingDTC 仍然為 1,再下一個operation cycle中,故障仍然不存在,那麼pendingDTC 就可以置0了。

Bit3 => This Bit is “confirmedDTC”. This bit informs that fault is continuously active for specific monitor routines and is matured enough in the current operation cycle so that it can be said Confirmed. If fault is active and matured, then the value is 1 otherwise the value is 0.
當confirmedDTC = 1時,則說明某個DTC已經被儲存到ECU的non-volatile memory中,說明這個DTC曾經滿足了被confirmed的條件。但是請注意,confirmedDTC = 1時,並不意味著當前這個DTC仍然出錯,如果confirmedDTC = 1,但testFailed = 0,則說明這個DTC表示的故障目前已經消失了。將confirmedDTC 重新置0的方法只有刪除DTC,UDS用0x14服務,OBD用0x04服務。

Bit4 => This Bit is “testNotCompletedSinceLastClear”. This bit informs that monitor routine is not run in the current operation cycle(once after Clearing the DTC is done). The reason for not running in the current operation cycle can be because particular pin is inactive in the operation cycle(Ex: Parked or hibernate vehicle mode). If the monitor routine is not completed this operation cycle, then the value is 1 otherwise the value is 0.
這個bit用於標識,自從上次呼叫了清理DTC的服務(UDS用0x14服務,OBD用0x04服務)之後,是否成功地執行了對某個DTC的測試(不管測試結果是什麼,只關心是否測了)。因為很多DTC的測試也是需要滿足某些邊界條件的,並不是ECU上電就一定會對DTC進行檢測。

testNotCompletedSinceLastClear = 1 : 自從清理DTC之後還沒有完成過針對該DTC的測試。
testNotCompletedSinceLastClear = 0 : 自從清理DTC之後已經完成過針對該DTC的測試。

Bit5 => This Bit is “testFailedSinceLastClear”. This bit informs monitor routine has reported that test has failed (at least once Bit0 is set) in any operation cycle at least once after clearing the DTC action is performed. If the fault has occurred after clear DTC is performed, then the value is 1 otherwise the value is 0.
這個位與bit 1 :testFailedThisOperationCycle有些類似,後者標識某個DTC在當前的operation cycle中是否出現過testFailed置1的情況,而testFailedSinceLastClear標識的是在上次執行過清理DTC之後某個DTC是否出過錯。
testFailedSinceLastClear = 1, 自從清理DTC之後該DTC出過至少一次錯。
testFailedSinceLastClear = 0 , 自從清理DTC之後該DTC沒有出過錯。

Bit6 => This Bit is “testNotCompletedThisOperationCycle”. This bit informs that the monitor routine is still not run during this current operation cycle. This is because the pin is not active for this operation cycle or when the request is sent from the tester, the monitor routine is not run. If the monitor routine is not run this operation cycle, then the value is 1 otherwise the value is 0.
這個位與bit 4 : testNotCompletedSinceLastClear類似,後者標識自從上次呼叫了清理DTC的服務之後,是否成功地執行了對某個DTC的測試。而testNotCompletedThisOperationCycle則標識在當前operation cycle中是否成功地執行了對某個DTC的測試。

testNotCompletedThisOperationCycle = 1 : 在當前operation cycle中還沒在完成過針對該DTC的測試。

testNotCompletedThisOperationCycle = 0 : 在當前operation cycle中已經完成過針對該DTC的測試。

Bit7 => This Bit is “warningIndicatorRequested”. This bit is used to bring into the attention of the user or driver when the fault occurs. If fault occurs and any monitor is required for specific fault, then the value is 1 otherwise the value is 0.

某些比較嚴重的DTC會與使用者可見的警告指示相關聯,比如儀表上的報警燈,或者是文字,或者是聲音。這個warningIndicatorRequested就用於此類DTC。

warningIndicatorRequested = 1 : ECU請求啟用警告指示。

warningIndicatorRequested = 0: ECU不請求啟用警告指示。

注意,如果這個DTC不支援警告指示,則這個位永遠置0。

0x14:ClearDiagnosticInformation

這條診斷命令的格式比較簡單,用法也很好理解,即刪除儲存在ECU中的DTC。

第一個位元組就是SID了,後邊的三個位元組用於標識將要被刪除的DTC種類,UDS規定用FF FF FF表示所有種類的DTC,由廠家自定義代表Powertrain、Chassis、、Body、Network Communication等種類DTC的值。

比如,14 FF FF FF這條指令表示的就是刪除掉ECU中的所有DTC。ECU只需要返回一個0x54表示成功執行即可。

0x19:ReadDTCInformation

這條指令用於讀取儲存在ECU中的DTC,它的格式如下
在這裡插入圖片描述

0x14診斷命令請求的格式
0x19服務的sub-function代表了各式各樣讀取DTC的方法,UDS給19服務的sub-function從0x00到0x19進行了明確定義,我只使用過其中4種,下面對我用過的這些進行介紹,如果大家對其他的感興趣,可以查閱ISO 14229的定義。

sub-function = 0x01 (reportNumberOfDTCByStatusMask)

sub-function = 0x01用於讀取符合特定條件的DTC數量,此時parameter為一個byte的Mask,用於與DTC的Status進行“與”運算,而ECU返回的則是"與"運算之後結果不為0的DTC的數量。DTC的Status用一個byte表示,其中的8個bit分別代表DTC的不同狀態,比如,bit 0 表示這個DTC是active的還是passive的,bit 4表示這個DTC是否已經被confirm了,如果DTC的狀態是confirm,則說明該DTC已經被ECU儲存下來了。

看下SID 19:
在這裡插入圖片描述

在這裡插入圖片描述
比如:19 01 08這個命令的用途,就是讀取所有狀態為confirm的DTC的數量。

19 01 09 讀所有狀態為confirm並且當前為active 的DTC 數量,也就是所有歷史DTC 和當前DTC的數量。

比如19 02 01這個命令的用途,就是讀取所有狀態為active的DTC的數量。此時ECU返回的格式應該是59 02 01 XX XX XX 01 YY YY YY 09…。返回的DTC列表中的每個條目為4個位元組,前三個位元組用於標識DTC,比如 XX XX XX,最後一個位元組用於標識DTC狀態,比如01,表示DTC是active的,09表示DTC是active且confirm的。