Page 1 of 1

UDS TransferData response

Posted: Tue 15. Sep 2015, 15:43
by tr.gt
Hello,

I have problems realizing the TransferData service for our tester tool.

After some successful TransferData resquests and responses, no response is received. If you add some delay between the requests, I can send more request but it does not solve the problem.

Not get getting a response seems to be problem of the ECU. ;-) But I have a VBA "reference" implementation of the tester that I currently port to C++. Using the VBA tool I can transfer the complete data.

The CAN traces of the VBA and my implementations don't show any differences for the TransferData stream. The VBA tool even sends the ISO TP frames faster then PCAN-TP. It uses the same PEAK dongle and the VBA interface to PCAN Basic.

I'm not sure where the problem is. Since the transfer works with the VBA tool, I don't think it is a general problem with the ECU.

Could it be possible to get such problems with improper configured PCAN Basic?

Do you have any hints for debugging?

my current implementation

Code: Select all

   std::size_t blockLength = 256; // from requestDownload ...

   std::vector< unsigned char > download;
   // add some data ...

   unsigned char sequenceCounter = 0x01;
   unsigned char* d              = download->data();
   std::size_t position          = 0;

   TPUDSStatus status = PUDS_ERROR_OK;

   boost::progress_display progress( download->size() );

   while ( position < download->size() )
   {
      //std::this_thread::sleep_for( std::chrono::milliseconds(10) );

      status = UDS_SvcTransferData( ch, &request,
                                    sequenceCounter,
                                    d+position, blockLength );

      //std::cout << "counter: " << (int) sequenceCounter << std::endl;

      //std::this_thread::sleep_for( std::chrono::milliseconds(10) );

      if ( status == PUDS_ERROR_OK )
      {
         if ( ( download->size() - position ) < blockLength )
         {
            blockLength = download->size() - position;
         }
         position += blockLength;
         ++sequenceCounter;

         progress += blockLength;

         TPUDSMsg confirm = {};
         TPUDSMsg response = {};

         status = UDS_WaitForService( ch, &response, &request, &confirm );

         if ( status == PUDS_ERROR_OK )
         {
            unsigned char code = response.DATA.RAW[0];

            if ( UdsUtils::NEGATIVE_REPSONSE_ID == code )
            {
               return UdsUtils::negativeResponseCodeToMessage( response.DATA.NEGATIVE.NRC );
            }

            if ( (PUDS_SI_TransferData + UdsUtils::POSITIVE_RESPONSE_OFFSET) != code )
            {
               return Message( Message::ERROR,
                  "Unexpected response code: " + UdsUtils::responseCodeToString( code ),
                  "PcanTransferData::Download" );
            }
         }
      }

      if ( status != PUDS_ERROR_OK ) // exit ...
      {
         return PcanUdsUtils::toMessage( status );
      }
   }

   return PcanUdsUtils::toMessage( status );

Re: UDS TransferData response

Posted: Tue 15. Sep 2015, 16:22
by tr.gt
Some additional notes:

1. If I try to send a RequestTransferExit after not getting a TransferData response, I get a negative response code "0x24" (Request sequence error).

This normally indicates that the ECU is still waiting for different requests. In this case it should wait for TransferData requests.

2. I don't see the expected TransferData response in PCAN View.

Thanks,
Tobias

Re: UDS TransferData response

Posted: Tue 15. Sep 2015, 16:42
by F.Vergnaud
Hello Tobias,

If your VBA tool sends the ISO-TP frames faster than the PCAN-TP ones, then you may have an issue with the configured minimum separation time (STmin) of the ISO-TP standard. It specifies the minimum time gap allowed between the transmission of consecutive frames:
Theorically, this value is exchanged between the client and server to synchronize themselves. The default value is 10ms, try to lower this value to 0ms with the parameter PCANTP_PARAM_SEPERATION_TIME.
2. I don't see the expected TransferData response in PCAN View.
You should also check the RESULT value of the last UDS message received to see if there is no network communication error, maybe the ECU dropped the transfert because of a timeout. In that case the RESULT value would store a network error code.

Re: UDS TransferData response

Posted: Fri 25. Sep 2015, 11:06
by tr.gt
Hello Fabrice,

thank you for your feedback. It seems to be a problem with the ECU. It simply doesn't response.

Thanks,
Tobias