How can we check the response of UDS message through CAPL?

3.3k Views Asked by At

I have written a basic program to send a UDS message in CAPL, But I don't know how to take the response inside the testcase function.

Below is the code snippet

includes
{
  
}

variables
{
    message 0x639 read;
}

void maintest()
{
    tc1();
}

testCase tc1()
{
    read.dlc=0x08;
    read.byte(0)=0X02;
    read.byte(1)=0x10;
    read.byte(2)=0x03;
    output(read);
    testStepPass("OK");
}
2

There are 2 best solutions below

0
On BEST ANSWER

As mentioned in the previous comments, it is recommended to use the Diagnostic Features.

If you wish to use raw frames, then there is a function for waiting for the response message.

TestWaitForMessage(0x649,100);
TestGetWaitEventMsgData(res_msg);

The res_msg will be having the byte values of the response.
You can access it by res_msg.byte(0).

2
On

why don't you use diagnostic module from CANoe?

You can add your own diagnostic console under Diagnostics (or Diagnostics & XCP) tab -> Diagnostic/ISO TP and set up your own console (you need to configure things like target address, diagnostic layer etc.).

After that all the functions needed for CAPL you can find in help press F1 in CAPL Browser -> CAPL Functions -> Diagnostics CAPL Functions.