Closed imecar-github closed 1 year ago
But I could not manage to use kISO14229_CLIENT_CALLBACK_PENDING and kISO14229_CLIENT_CALLBACK_DONE.
Please attach code
how can I use TransferDataStream with FATFS ?
You can retarget the stdio.h functions either at the linker level (defining your own fread
, etc) or at the compiler level (compile iso14229 with -Dfread=f_read
and it will directly use your FATFS functions)
` if(fileEOF == false) { if(file_counter > fileFileInformation.fileSize) { fileEOF = true; return kISO14229_CLIENT_CALLBACK_DONE; } file_willRet = 128; if((fileFileInformation.fileSize - file_counter) < 128 ) { file_willRet = fileFileInformation.fileSize-file_counter; lastBlock = true; } TransferData(client, file_blockSizeCounter, 130, fileFileInformation.buffer + file_counter, file_willRet); if(!lastBlock) { if(20 == file_canMessageCounter) { file_blockSizeCounter = file_blockSizeCounter + 1; if(file_blockSizeCounter == 256) { file_blockSizeCounter = 0; } file_counter+= 128; file_canMessageCounter = 0; g.serverRecvQueueIdx = 0; } } else { if((((fileFileInformation.fileSize - file_counter) / 7) + 1) == file_canMessageCounter) { file_blockSizeCounter = file_blockSizeCounter + 1; if(file_blockSizeCounter == 256) { file_blockSizeCounter = 0; } file_counter+= (fileFileInformation.fileSize - file_counter); file_canMessageCounter = 0; g.serverRecvQueueIdx = 0; fileEOF= true; }
}
file_canMessageCounter++;
HAL_Delay(5);
return kISO14229_CLIENT_CALLBACK_PENDING;
}
else
{
return kISO14229_CLIENT_CALLBACK_DONE;
}
return kISO14229_CLIENT_CALLBACK_DONE;`
I write something like this, but It does not work every file. Could you provide me an algorithm ?`
I write something like this, but It does not work every file. Could you provide me an algorithm ?
Edit:
`if (file_driverEOF == false) { if (file_counter > fileFileInformation.fileSize) { file_driverEOF = true;
}
file_willRet = 128;
if ((fileFileInformation.fileSize - file_counter) < 128) {
file_willRet = fileFileInformation.fileSize - file_counter;
}
TransferData(client, file_blockSizeCounter & 0xFF,
file_willRet + 2,
fileFileInformation.buffer + file_counter,
file_willRet);
if(client->state == kRequestStateSent)
{
file_counter += 128;
file_canMessageCounter = 0;
file_blockSizeCounter++;
g.serverRecvQueueIdx = 0;
}
HAL_Delay(5);
return kISO14229_CLIENT_CALLBACK_PENDING;
}
return kISO14229_CLIENT_CALLBACK_DONE;
`
I just tried this code and everything seems fine!
I just tried this code and everything seems fine!
OK. I'm closing this issue.
Hi. I have a question about TransferData with blocksize 128. I want to send data from client to server 128 byte packets. But I could not manage to use kISO14229_CLIENT_CALLBACK_PENDING and kISO14229_CLIENT_CALLBACK_DONE. How can I handle 128 byte packet is sent? I want to see positive TransferData response but I could not see.
I'm using SD CARD with FATFS. But TransferDataStream is using iostream. I could not use TransferDataStream with FATFS.
My first question is, Is there any other else TransferData function with blocksize 128? Second question is, how can I use TransferDataStream with FATFS ?
Edit1: I am using iso14229ClientSequenceRunBlocking.