2

I trying to read a DTC from a CAPL script. I am using "(0x19) ReadDtcInformation - Report DTC snapshot record by DTC number" protocol service. My DTC number is 0x062003. I am able to set DTC number correctly. But, I am not able to set DTC status bits.

1. diagRequest FR_Diagnostic.FaultMemory_ReadEnvironmentData PWM_Status; // 0x19 0x94
2. diagSetParameter(PWM_Status,"DTC",0x062003);  // 0x06 0x20 0x03
3. diagSetParameter(PWM_Status,"DtcSnapshotRecordNumber",0xFF); 
4. DiagSendRequest(PWM_Status);

Line #3 is not quite setting DtcSnapshotRecordNumber to 0xFF. I see this field as 0x00 in trace.

Question: 1. Am I using correct API in line #3? How do I set DtcSnapshotRecordNumber to read for all the status bits? (there are 8 status bits to monitor, thus it should be set to 0xFF).

Flying Dutchmann
  • 85
  • 1
  • 2
  • 3

2 Answers2

0

Normaly you call service 0x19 (Diagnostic) then call Subfunction and then you provide a bitmask which contains information for what you are searching.

So everything you need is defined in ISO 14229 Road vehicles.

Most services regarding DTCs and OBD stuff are the same across all OEMs. Each OEM normaly has a Diagnostic Specification Supplement which describes OEM specific Diagnostic services and so on.

In CAPL there is normaly an easy way to read out DTCs. You don´t need to do it manually as it is provided by the CDD-File. You can see it in the Object Browser of CAPL Brower on the right side.

So for your case for egg. retrieve number of DTCs which match your Mask:

Subfunction Report DTCByStatusMask 0x02

0x1902

The mask which is your search filter will be build like this:

bit # hex state description 0 0x01 testFailed DTC failed at the time of the request 1 0x02 testFailedThisOperationCycle DTC failed on the current operation cycle 2 0x04 pendingDTC DTC failed on the current or previous operation cycle 3 0x08 confirmedDTC DTC is confirmed at the time of the request 4 0x10 testNotCompletedSinceLastClear DTC test not completed since the last code clear 5 0x20 testFailedSinceLastClear DTC test failed at least once since last code clear 6 0x40 testNotCompletedThisOperationCycle DTC test not completed this operation cycle 7 0x80 warningIndicatorRequested Server is requesting warningIndicator to be active

So if you just want to read out DTC which are confirmed (stored) than you send:

0x190208

If you get a positive response than the DTCs will be retrieved in Hex Format. You´ll need a HEX->SAE converter which will convert retrieved DTCs to regular know format. Anyway you can Test it through Diagnostic Console.

HiLTastic
  • 1
  • 1
  • Although CANoe provides diagnostic console platform, I was interested in CAPL way of doing it. But thanks for the explanation though :) – Flying Dutchmann May 21 '18 at 19:33
0

Answering myself:

  1. Yes, I was using the correct API.
  2. It wasn't getting set properly because the datatype used in the database (.cdd) files was wrong.

I could have converted .cdd file to template and edit the template and work with updated .cdd file, but I chose to work it out using a fresh template copy.

William Price
  • 4,033
  • 1
  • 35
  • 54
Flying Dutchmann
  • 85
  • 1
  • 2
  • 3
  • 1
    Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - [From Review](/review/low-quality-posts/19803402) – Alejandro May 22 '18 at 19:31
  • It is the complete the answer to my questions. – Flying Dutchmann May 23 '18 at 20:27