send consecutive frame of SvcRequestDownload

A free API for the communication with control devices according to UDS (ISO 14229-1)
Locked
tomlee
Posts: 4
Joined: Tue 15. Aug 2023, 01:02

send consecutive frame of SvcRequestDownload

Post by tomlee » Tue 15. Aug 2023, 01:32

Hello,
When I send the service(UDSApi.SvcRequestDownload_2013) and get the response message(flow control frame):

Code: Select all

18DA33F1 -  8    10 0B 34 00 44 00 01 00
18DAF133 -  8    30 00 00 00 00 00 00 00
but the service send the first frame only and it can not send consecutive frame:

Code: Select all

18DA33F1 -  8    21 00 00 04 00 00 CC CC
What's the problem, please? thanks.
Last edited by K.Wagner on Tue 15. Aug 2023, 09:28, edited 1 time in total.
Reason: Code formatting for better reading

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: send consecutive frame of SvcRequestDownload

Post by K.Wagner » Tue 15. Aug 2023, 09:51

Hello,

could you please post your code when sending the service? Also it is good to know:
  • API version
  • If you are communicating with an ECU or if you are simulating it
Best regards,
Keneth

tomlee
Posts: 4
Joined: Tue 15. Aug 2023, 01:02

Re: send consecutive frame of SvcRequestDownload

Post by tomlee » Tue 15. Aug 2023, 11:27

Please check my code, thanks. ( PCAN-UDS 2.x API)
I am communicating with an ECU.

Code: Select all

  	    // Define TimeOuts
            dw_buffer = CanTpApi.PCANTP_ISO_TIMEOUTS_15765_4;
            status = UDSApi.SetValue_2013(client_handle, uds_parameter.PUDS_PARAMETER_ISO_TIMEOUTS, ref dw_buffer, sizeof(UInt32));
            Console.WriteLine("=========Set ISO 15765-4 timeouts values: {0}", (int)status);
            
           // Define Network Address Information used for all the tests
            config.can_id = (UInt32)0xFFFFFFFF;
            config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_EXTENDED;
            config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
            config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
            config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
            config.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT; //0xF1
            config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1; //0x33
            int MemoryStartAddress = 0x00010000;      
            int MemorySize = 0x00040000;       
            
           //******************************************
           
            uds_msg request = new uds_msg();
            uds_msg response = new uds_msg();
            uds_msg confirmation = new uds_msg();

            byte[] lBufferMemAddr = BitConverter.GetBytes(startAddress).Reverse().ToArray();
            byte[] lBufferMemSize = BitConverter.GetBytes(dataLength).Reverse().ToArray();         
           
            log.Info("*** UDS Service: RequestDownload ***");

            byte compressionMethod = 0x00; // No Compression
            byte encryptionMethod = 0x00; // No Encryption

            Console.WriteLine(); Console.WriteLine(); Console.WriteLine("*** UDS Service: RequestDownload ***");

            status = UDSApi.SvcRequestDownload_2013(channel, config, out request, 0x00, 0x00, lBufferMemAddr, (byte)lBufferMemAddr.Length, lBufferMemSize, (byte)lBufferMemSize.Length);
Last edited by K.Wagner on Tue 15. Aug 2023, 16:40, edited 1 time in total.
Reason: Code formatting for better reading

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: send consecutive frame of SvcRequestDownload

Post by F.Vergnaud » Wed 16. Aug 2023, 11:56

Hello,

Here are changes made to your code so that we were able to successfully complete the UDS request:

In the following, the target address was 0x01 instead of 0x33:

Code: Select all

   
            config.nai.target_addr = 0x33;  // uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1 is actually 0x01
In the following, a variable "channel" was used instead of "client_handle":

Code: Select all

   
            status = UDSApi.SvcRequestDownload_2013(client_handle, config, out request, 0x00, 0x00, lBufferMemAddr, (byte)lBufferMemAddr.Length, lBufferMemSize, (byte)lBufferMemSize.Length);
If the Consecutive frame is not sent by the API, this means that a network error may have occured. Please check:
1. the return status of the function SvcRequestDownload_2013,
2. the return status of the "wait for service" function (and in case of an error the network result of the request_confirmation):

Code: Select all

   
            status = UDSApi.WaitForService_2013(client_handle, ref request, out response, out request_confirmation);
Also note that since you are configuring the API to check against OBD2 timeouts, be careful that the ECU must reply its FC frame before 75ms.
Best regards,
Fabrice

tomlee
Posts: 4
Joined: Tue 15. Aug 2023, 01:02

Re: send consecutive frame of SvcRequestDownload

Post by tomlee » Wed 16. Aug 2023, 15:31

Hello, thank you for your help!

1) <the target address was 0x01 instead of 0x33”>
I've changed the content here :“PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1 = 0x33 ”

2) <a variable "channel" was used instead of "client_handle">
You are right. This is an error in the code I posted

3) I added the function code of of the function SvcRequestDownload_2013:

Code: Select all

 status = UDSApi.SvcRequestDownload_2013(channel, config, out request, 0x00, 0x00, lBufferMemAddr, (byte)lBufferMemAddr.Length, lBufferMemSize, (byte)lBufferMemSize.Length);               

            if (UDSApi.StatusIsOk_2013(status))
                status = UDSApi.WaitForService_2013(channel, ref request, out response, out confirmation);
            Console.WriteLine(" UDS_SvcRequestDownload_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);

            // Free messages
            status = UDSApi.MsgFree_2013(ref request);
            Console.WriteLine(" Free request message: {0}", (int)status);
            status = UDSApi.MsgFree_2013(ref response);
            Console.WriteLine(" Free response message: {0}", (int)status);
            status = UDSApi.MsgFree_2013(ref confirmation);
            Console.WriteLine(" Free confirmation message: {0}", (int)status);
Program run result and he Consecutive frame is not sent by the API.
As shown below message:

Code: Select all

11:01:09:0640 Rx 1 0x18DA33F1 x 8 10 0B 34 00 44 00 01 00 
11:01:09:0644 Rx 1 0x18DAF133 x 8 30 10 05 FF 00 00 B2 00 
11:01:09:0658 Rx 1 0x18DAF133 x 8 30 00 00 55 55 55 55 55 
Console:

Code: Select all

*** UDS Service: RequestDownload ***
 UDS_SvcRequestDownload_2013: 654311424

UDS request from 0x00F1 (to 0x0033, with extension address 0x00) - result: 0 - OK !
-> Length: 11, Data= 34 00 44 00 01 00 00 00 04 00 00

 /!\ ERROR: NO UDS RESPONSE !!
 Free request message: 0
 Free response message: 0
 Free confirmation message: 0
4) If I add code of "PCANBasic.Write(PCANBasic.PCAN_USBBUS1, ref CANMsg)" to send Consecutive frame, then the ECU can give positive feedback.

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: send consecutive frame of SvcRequestDownload

Post by F.Vergnaud » Wed 16. Aug 2023, 16:35

Please check you are using the latest version of PCAN-ISO-TP: v3.4.0 or later.
Your ECU sends a Flow Control frame with a non constant padding value which was considered as an invalid ISOTP FC frame prior v3.3 (see https://www.peak-system.com/PCAN-ISO-TP ... .html?&L=1).
This feature is disabled by default on v3.3+.

You can see that the returned status is 654311424 => 0x27000000 which is PUDS_STATUS_SERVICE_TX_ERROR: an error occured during the transmission of the ISOTP message.
You could get more information by checking the ISOTP network result in "request_confirmation.msg.Msgdata_any_Copy.netstatus".
Best regards,
Fabrice

tomlee
Posts: 4
Joined: Tue 15. Aug 2023, 01:02

Re: send consecutive frame of SvcRequestDownload

Post by tomlee » Wed 16. Aug 2023, 17:13

You are right. It's OK now! Thanks!

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: send consecutive frame of SvcRequestDownload

Post by PEAK-Support » Thu 17. Aug 2023, 07:57

Topic closed
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Locked