Cannot receive Negative Response with custom mapping
Posted: Wed 1. Jun 2022, 12:08
Hi everyone,
I have a problem with custom mapping when using PCAN-UDS API.
At first, I used the default Can ID (7E0/7E8) and it worked with my ECU. Now my specification changed and I need to change to a different ID, so I use UDS_AddMapping_2013, but now I cannot receive any negative response, and after the first negative response, my program cannot receive positive response too.
Here is my source code.
Do you have any hint for this problem?
Thank you
I have a problem with custom mapping when using PCAN-UDS API.
At first, I used the default Can ID (7E0/7E8) and it worked with my ECU. Now my specification changed and I need to change to a different ID, so I use UDS_AddMapping_2013, but now I cannot receive any negative response, and after the first negative response, my program cannot receive positive response too.
Here is my source code.
Code: Select all
// Init mTpHandle with UDS_Initialize_2013
uds_status status;
map = {};
map.can_id = sa;
map.can_id_flow_ctrl = ra;
map.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
map.can_tx_dlc = 8;
map.nai.extension_addr = 0;
map.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
map.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
map.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
map.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
status = UDS_AddMapping_2013(mTpHandle, &map);
if (!UDS_StatusIsOk_2013(status)) {
std::cout << "Add mapping failed: " << std::hex << sa << " "
<< int(status) << std::endl;
}
map = {};
map.can_id = ra;
map.can_id_flow_ctrl = sa;
map.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
map.can_tx_dlc = 8;
map.nai.extension_addr = 0;
map.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
map.nai.source_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
map.nai.target_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
map.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
UDS_AddMapping_2013(mTpHandle, &mGwMap);
if (!UDS_StatusIsOk_2013(status)) {
std::cout << "Add mapping failed: " << std::hex << sa << " "
<< int(status) << std::endl;
}
map= {};
map.can_id = fa;
map.can_id_flow_ctrl = (uint32_t)-1;
map.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
map.can_tx_dlc = 8;
map.nai.extension_addr = 0;
map.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
map.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
map.nai.target_addr = PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL;
map.nai.target_type = PCANTP_ISOTP_ADDRESSING_FUNCTIONAL;
UDS_AddMapping_2013(mTpHandle, &mGwMap);
if (!UDS_StatusIsOk_2013(status)) {
std::cout << "Add mapping failed: " << std::hex << sa << " "
<< int(status) << std::endl;
}
mConfigPhysical.can_id = sa;
mConfigPhysical.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
mConfigPhysical.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
mConfigPhysical.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
mConfigPhysical.type = PUDS_MSGTYPE_USDT;
mConfigPhysical.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
mConfigPhysical.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
mConfigPhysical.nai.extension_addr = 0;
mConfigPhysical.can_tx_dlc = 8;
Thank you