Currently, I am automating the test cases for testing the Gauges in the Instrument Cluster. I have come across changing the units from metric to US through DIDs. Can anybody help me how to send the diagnostic related stuff using CAPL script.
Asked
Active
Viewed 2.3k times
4 Answers
2
Try this may be it works using SendDiagRequest(reqobj)
;
===============================================================
- Add respective CDD file in vector canoe
- Set target ECU in Canoe settings
- You have to define contents of service each byte value, can get those values in CAN trace
- create object of services in CAPL and send it using SendDiagRequest(reqobj);

Community
- 1
- 1

Sachin Bharambe
- 263
- 3
- 4
- 16
-
I didn't find the "SendDiagRequest" command in CAPL. Is it diagRequestSent? – Adarsh Kale Sep 28 '16 at 08:15
-
DiagSendRequest(req_object) – Sachin Bharambe Sep 28 '16 at 08:50
-
I tried sending the DID of 5 bytes using message xxx sendMsg{dlc = 8}; output(sendMsg); this was successful. But when i tried the same with more than 8 bytes (22 bytes in my case) which uses flow control concept, Can you please explain how to implement flow control concept in CAPL? I don't have any idea about usage of DiagSendRequest(obj); – Adarsh Kale Sep 30 '16 at 07:37
-
@AdarshKale To understand flow control please check the CANoe/CANalyzer documentation (e. g. online help) for [ISO-TP](https://en.wikipedia.org/wiki/ISO_15765-2) or read this article [here](https://stackoverflow.com/a/35653095/). – Sonic78 Jul 07 '17 at 06:55
1
If you have a diagnostic library loaded into CANoe (CDD/ODX/PDX, etc) then it will usually have the Transport Protocol defined which will segment your Tx and Rx where they are longer than 8 bytes.
Your post says that you are automating your testcases. This is done best in the test module of CANoe. If you have the CDD loaded you can drag the DID from the CAPL Browser Symbols pane (filtered by diagnostics) into the CAPL, e.g. drag "DID_01_ReadInfo" after diagRequest.
long size;
byte returnBytes[4096];
diagRequest DID_01_ReadInfo readInfoReq; // diag request object
diagResponse DID_01_ReadInfo readInfoResp; // diag reponse object
diagSendRequest(readInfoReq);
switch (testWaitForDiagResponse(readInfoReq, 2000)) // 2 sec timeout
{
case 0: // timeout
teststepfail("No reply from ECU");
break;
case 1: // response received
if (diaggetLastResponseCode(readInfoReq) == -1)
{
teststepPass("Positive Response");
// Get the number of bytes from the last response and store in 'returnBytes'
diagGetLastResponse(readInfoReq, readInfoResp);
size = diagGetPrimitiveData(readInfoResp, returnBytes, elCount(returnBytes));
}
else
{
teststepfail("Negative Response");
}
break;
}

SteveOll
- 79
- 1
- 4
0
long DiagSendRequest (diagRequest obj)

Jack
- 1
- 1
-
I tried sending the DID of 5 bytes using message xxx sendMsg{dlc = 8}; output(sendMsg); this was successful. But when i tried the same with more than 8 bytes (22 bytes in my case) which uses flow control concept, Can you please explain how to implement flow control concept in CAPL? – Adarsh Kale Sep 30 '16 at 07:33
-
Although this code may help to solve the problem, it doesn't explain _why_ and/or _how_ it answers the question. Providing this additional context would significantly improve its long-term educational value. Please [edit] your answer to add explanation, including what limitations and assumptions apply. – Toby Speight Oct 04 '16 at 15:11
0
Something like this could do it:
fControlMessage(message 0x496 mystream)
{
if (0x10 == mystream.byte(0) && Abfrage == 1) //First Frame von ISO_Lenkhilfe_Resp, erstes Byte auf 0x10 überprüfen
{
msDiag_FlowControl.byte(0) = 0x30; // Flow Control
msDiag_FlowControl.byte(1) = 0x0F; // Block Size ist 15
msDiag_FlowControl.byte(2) = 0x00; // 20ms Abstand bei aufeinanderfolgenden Frame
RequestLenght = mystream.byte(1); // Gibt die Länge(Anzahl) der Datenbytes an
RequestLenght = RequestLenght - 6; // 6 Byte Nutzdaten abziehen
Abfrage = 0;
//write("Send first Flow Control");
output(msDiag_FlowControl);
}

David Rogers
- 2,601
- 4
- 39
- 84

Galea János
- 21
- 1
- 5