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.

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 );