【问题标题】:Simulation of a node/ECU in CAPLCAPL 中的节点/ECU 仿真
【发布时间】:2017-08-04 23:48:57
【问题描述】:

我正在尝试在 CAPL 中模拟一个节点,该节点会为测试人员的请求提供诊断响应。在 CANoe 中,我添加了 2 个网络节点 1)ECU 和 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);  
}

在跟踪窗口中看到测试仪请求 [1A B0],但未观察到肯定响应。

注意:仅考虑积极响应处理,并且测试人员的请求是正确的。我已经尝试使用 on message * 事件获得响应,并且效果很好。

在使用 CAPL 函数 DiagSendResponse 时,有人可以帮我解决问题吗?

谢谢

【问题讨论】:

    标签: diagnostics capl canoe


    【解决方案1】:

    您可能需要在 Ecu.can 模块中使用“on DiagRequest *”处理程序,因为您希望使用 Response 对收到的请求做出反应。

    如果您收到响应,则会调用“on diagresponse *”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-17
      • 2021-07-19
      • 2022-06-18
      • 2021-06-10
      • 2015-07-26
      • 1970-01-01
      • 2022-01-21
      • 1970-01-01
      相关资源
      最近更新 更多