0

I am trying to simulate a node in CAPL which gives diagnostic response to the tester requests. In CANoe, I have added 2 network nodes 1)ECU and 2)Tester.

//**In Tester.can**

DiagRequest service req; // In variables, with corresponding service from cdd

on key 'a'
{
    read_diag_addr_request();
}

void read_diag_addr_request()
{
    DiagSetTarget ("Target");    
    DiagResize(Diag_addr_req,2);
    DiagSetprimitiveByte(req,1,0x1A);   
    DiagSetprimitiveByte(req,2,0xB0);   
    DiagSendRequest(req);   
} 

//**In ECU.can**

DiagResponse service res; // In variables, with corresponding service from cdd

on diagResponse *
{
    write("IN DIAG_RESPONSE");
    DiagResize(res,3);
    DiagSetprimitiveByte(res,0,0x5A);   
    DiagSetprimitiveByte(res,1,0xB0);  
    DiagSetprimitiveByte(res,2,0x"data"); 
    DiagSendResponse(res);  
}

The tester request [1A B0] is seen on trace window, but the positive response is not observed.

Note: Consider only positive response handling and the tester request is correct. I have tried getting the response using on message * event and this works fine.

Can someone help me in figuring out the problem when using CAPL function DiagSendResponse?.

Thanks

jerinj
  • 19
  • 1
  • 3

1 Answers1

2

You might Need to use the "on DiagRequest * " handler in the Ecu.can module, since you want to react on a received request with a Response.

The "on diagresponse *" is called, if you receive a Response.

kesselhaus
  • 21
  • 2