problem flow control
problem flow control
I receive frames with more than 8 data twice. the first time I get it wrong
fisrt frame is just
second frame i receive 00 00 00 00 00 00 00 00 00
and the second time just.
i receive fisrt frame and second frame.
i read with
status = UDS_Read_2013(channel, &rx_msg,0, 0);
why ?
Thank you
fisrt frame is just
second frame i receive 00 00 00 00 00 00 00 00 00
and the second time just.
i receive fisrt frame and second frame.
i read with
status = UDS_Read_2013(channel, &rx_msg,0, 0);
why ?
Thank you
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: problem flow control
Hello,
Can you be a bit more explicit about what you're trying to do?
Obviously you're trying to do UDS communication, most of the time problems are related to incorrect configuration of mappings.
Please share with us an extract of your code and a trace log to get more information.
Thank you
Can you be a bit more explicit about what you're trying to do?
Obviously you're trying to do UDS communication, most of the time problems are related to incorrect configuration of mappings.
Please share with us an extract of your code and a trace log to get more information.
Thank you
Best regards,
Fabrice
Fabrice
Re: problem flow control
Thank you
Code: Select all
// Add mapping for physical request from external equipment to ECU_1: ID=0x715
mapping.can_id = 0x715;
mapping.can_id_flow_ctrl = 0x725;
mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
mapping.can_tx_dlc = 8;
mapping.nai.extension_addr = 0;
mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
status = UDS_AddMapping_2013(channel, &mapping);
if (!UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
{
MessagePopup("Add source_mapping1 failed.", "Error");
}
/// Add mapping for physical response from ECU_#X to external equipment: ID=0x725
mapping.can_id = 0x725;
mapping.can_id_flow_ctrl = 0x715;
mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
mapping.can_tx_dlc = 8;
mapping.nai.extension_addr = 0;
mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
status = UDS_AddMapping_2013(channel, &mapping);
if (!UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
{
MessagePopup("Add response_mapping2 failed.", "Error");
}
config.can_id = PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.can_msgtype =
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Add mappings on transmitter
status = UDS_AddMapping_2013(channel, &mapping);
Last edited by F.Vergnaud on Mon 28. Feb 2022, 10:48, edited 1 time in total.
Reason: code formatting
Reason: code formatting
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: problem flow control
Hello,
The configuration of the message you are trying send does not match the configuration of your mappings.
Also note that your mappings use the same source and target addresses that of standardized ISO mapping "0x7E0/0x7E8" (see #define PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1), be aware that your mappings will take precedence over those ones.
The can_id configuration of your message is PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1 which seems wrong... did you mean 0x715? Otherwise you can use -1 (#define CAN_ID_NO_MAPPING) to have the API detect which CAN ID to use based on your mappings.
The configuration of the message you are trying send does not match the configuration of your mappings.
Also note that your mappings use the same source and target addresses that of standardized ISO mapping "0x7E0/0x7E8" (see #define PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1), be aware that your mappings will take precedence over those ones.
The can_id configuration of your message is PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1 which seems wrong... did you mean 0x715? Otherwise you can use -1 (#define CAN_ID_NO_MAPPING) to have the API detect which CAN ID to use based on your mappings.
Best regards,
Fabrice
Fabrice
Re: problem flow control
Thank you
here are the received frames
715 22 F1 95 AB AB AB AB AB
725 62 F1 95 42 AD 3 0 0
725 0 0 0 0 0 0 0 0
725 62 F1 95 42 AD 3 0 0
725 0 42 8A A 1 1 0 0
I don't understand why it is sent twice. with a fisrt second frame error
here are the received frames
715 22 F1 95 AB AB AB AB AB
725 62 F1 95 42 AD 3 0 0
725 0 0 0 0 0 0 0 0
725 62 F1 95 42 AD 3 0 0
725 0 42 8A A 1 1 0 0
I don't understand why it is sent twice. with a fisrt second frame error
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: problem flow control
Can you share a PCAN-View trace of the communication or a screenshot of it? The data you're sharing is not precise enough.
You mention frame error, be careful I'm not sure if you're talking about CAN error frames or unexpected CAN frames:
- for the first one, you need to check the status of your CAN bus, bitrate configuration, termination resistance, etc.
- for the latter, a PCAN-View screenshot will help and let us confirm if the responder does indeed send those frames.
You mention frame error, be careful I'm not sure if you're talking about CAN error frames or unexpected CAN frames:
- for the first one, you need to check the status of your CAN bus, bitrate configuration, termination resistance, etc.
- for the latter, a PCAN-View screenshot will help and let us confirm if the responder does indeed send those frames.
Best regards,
Fabrice
Fabrice
Re: problem flow control
Thank you
I develop under CVI
send trame
715 22 F1 95 AB AB AB AB AB
correct answer
725 62 F1 95 42 AD 3 0 0
725 0 42 8A A 1 1 0 0
response received
725 62 F1 95 42 AD 3 0 0
725 0 0 0 0 0 0 0 0
725 62 F1 95 42 AD 3 0 0
725 0 42 8A A 1 1 0 0
this problem does not appear when I read simple frames.
I develop under CVI
send trame
715 22 F1 95 AB AB AB AB AB
correct answer
725 62 F1 95 42 AD 3 0 0
725 0 42 8A A 1 1 0 0
response received
725 62 F1 95 42 AD 3 0 0
725 0 0 0 0 0 0 0 0
725 62 F1 95 42 AD 3 0 0
725 0 42 8A A 1 1 0 0
this problem does not appear when I read simple frames.
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: problem flow control
The first UDS message you read maybe the indication frame of the ISOTP message. Keep in mind that PCAN-UDS API is a high-level API, you can read more or less information than what is written on the CAN bus.
You need to check more carefully the properties of the UDS msg:
- rx_msg.msg.type will tell you if you have an ISOTP message or a CAN/CANFD frame
- in case of an ISOTP message, the following operation (rx_msg.msg.msgdata.isotp->netaddrinfo.msgtype & PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION) let you know if the message is only an indication of a message start.
All things considered, you are using UDS_Read function but it feels like you only want to get the response of your request. You should consider using the service functions UDS_SvcXXXX to transmit a request and UDS_WaitForService to read the response (check example 02_client_request_ecu_reset_USDT). You can also take a look at other UDS_WaitForXXxx functions to read UDS message (and not CAN frames).
Note: PCAN-View is a CAN monitoring tool, you can execute it in parallel of your labview application.
You need to check more carefully the properties of the UDS msg:
- rx_msg.msg.type will tell you if you have an ISOTP message or a CAN/CANFD frame
- in case of an ISOTP message, the following operation (rx_msg.msg.msgdata.isotp->netaddrinfo.msgtype & PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION) let you know if the message is only an indication of a message start.
All things considered, you are using UDS_Read function but it feels like you only want to get the response of your request. You should consider using the service functions UDS_SvcXXXX to transmit a request and UDS_WaitForService to read the response (check example 02_client_request_ecu_reset_USDT). You can also take a look at other UDS_WaitForXXxx functions to read UDS message (and not CAN frames).
Note: PCAN-View is a CAN monitoring tool, you can execute it in parallel of your labview application.
Best regards,
Fabrice
Fabrice