I am trying to run SvcSecurityAccess_2013 to get a seed. I am using custom ECU so I deleted mappings and add custom mapping
Code: Select all
cantp_status mappingResult;
uds_mapping request_mapping = new uds_mapping();
uds_mapping response_mapping;
request_mapping.can_id = 0x781;
request_mapping.can_id_flow_ctrl = 0x7F1;
request_mapping.nai.source_addr = 0x11;
request_mapping.nai.target_addr = 0x22;
request_mapping.nai.extension_addr = 0x0;
request_mapping.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;// cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
request_mapping.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;// cantp_isotp_format.PCANTP_ISOTP_FORMAT_NORMAL;
//request_mapping.nai.msgtype = cantp_isotp_msgtype.PCANTP_ISOTP_MSGTYPE_DIAGNOSTIC;
request_mapping.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
// Defines a second mapping to allow communication from Destination 0x22 to Source 0x11.
response_mapping = request_mapping;
response_mapping.can_id = request_mapping.can_id_flow_ctrl;
response_mapping.can_id_flow_ctrl = request_mapping.can_id;
response_mapping.nai.source_addr = request_mapping.nai.target_addr;
response_mapping.nai.target_addr = request_mapping.nai.source_addr;
Code: Select all
uds_msgconfig config = new uds_msgconfig();
config.can_id = (UInt16)0x781;
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;//usdt
config.nai.source_addr = (UInt16)0x11;
config.nai.target_addr = (UInt16)0x22;
Code: Select all
uds_status status;
uds_msg request = new uds_msg();
uds_msg response = new uds_msg();
uds_msg confirmation = new uds_msg();
UInt32 dw_buffer;
UInt32 value_little_endian;
CLEAR_CONSOLE();
Console.WriteLine("*** UDS Service: SecurityAccess ***");
// Sends a physical SecurityAccess message
Console.WriteLine("Sends a physical SecurityAccess message: ");
status = UDSApi.SvcSecurityAccess_2013(channel, config, out request, UDSApi.PUDS_SVC_PARAM_SA_RSD_1);
if (UDSApi.StatusIsOk_2013(status))
status = UDSApi.WaitForService_2013(channel, ref request, out response, out confirmation);
Console.WriteLine(" UDS_SvcSecurityAccess_2013: {0}", (int)status);
if (UDSApi.StatusIsOk_2013(status))
display_uds_msg(ref confirmation, ref response, false);
else
display_uds_msg_request(ref request, false);
Thank you.