I would like to use UDS_SvcTesterPresent_2013 to get a count of all connected ECUs to the network and their addresses. My idea was to use functional addressing and read the responses with UDS_WaitForServiceFunctional_2013.
However it seems that no responses are read, but on PCAN-Explorer I see the correct responses from the ECUs.
The uds_msgconfig is configured as followed:
Code: Select all
msgConfig.can_id = uint32_t();
msgConfig.can_msgtype = PCANTP_CAN_MSGTYPE_EXTENDED;
msgConfig.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
msgConfig.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
msgConfig.type = PUDS_MSGTYPE_USDT;
msgConfig.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
msgConfig.nai.target_addr = 0;
msgConfig.nai.extension_addr = 0;
Code: Select all
status = UDS_Initialize_2013(handle, PCANTP_BAUDRATE_500K);
if (UDS_StatusIsOk_2013(status) == true)
{
uint32_t prio = 3; // 3 = 0x0CDAXXYY || XX = target addr, YY = source addr
status = UDS_SetValue_2013(handle, uds_parameter::PUDS_PARAMETER_J1939_PRIORITY, &prio, sizeof(prio));
PrintUdsStatusIfNotOk(status);
uint32_t timeout = 100;
status = UDS_SetValue_2013(handle, uds_parameter::PUDS_PARAMETER_TIMEOUT_RESPONSE, &timeout, sizeof(timeout));
PrintUdsStatusIfNotOk(status);
AppHelper::Print("Sending tester present\n");
status = UDS_SvcTesterPresent_2013(handle, msgConfig, &msgRequest);
if (UDS_StatusIsOk_2013(status) == true)
{
uint32_t count;
uds_msg buff[10] = { uds_msg() };
status = UDS_WaitForServiceFunctional_2013(handle, &msgRequest, 10, true, buff, &count, &responseConfirm);
if (UDS_StatusIsOk_2013(status) == true)
{
AppHelper::Print("Tester present received\n");
}
else
{
PrintUdsStatusIfNotOk(status);
}
}
else
{
PrintUdsStatusIfNotOk(status);
}
status = UDS_MsgFree_2013(&msgRequest);
PrintUdsStatusIfNotOk(status);
status = UDS_MsgFree_2013(&response);
PrintUdsStatusIfNotOk(status);
status = UDS_MsgFree_2013(&responseConfirm);
PrintUdsStatusIfNotOk(status);
}
Code: Select all
msgConfig.nai.target_addr = 0;
msgConfig.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
Is there a method of making WaitForServiceFunctional work without changing the target type?
Many thanks.