I have the FTP Server task started in my Nano54415 application. I can perform file transfers to and from the SD card without incident using Explorer's 'Page->Open FTP Site in Windows Explorter' drag and drop window. However, when I'm transferring a large file (either to or from the SD card) and I hit the Cancel button on the progress bar dialog, it causes the Netburner to have a watchdog timeout and reset. My watchdog is currently set to 8 seconds (sim2.scm.cwcr=0x00DE).
Do I need to modify some Netburner code to prevent this?
FTP Server file transfer cancellation
Re: FTP Server file transfer cancellation
Can you give some details regarding what a 'large' file is (1MB? 40MB? ~1GB?)? If I were to guess, this is probably related to the mmc driver (aka, SD driver) for the MCF54415 parts blocking the task during transfers. If you've got an 8 second timeout on your watchdog (refreshed in a lower priority task I'm guessing), then you're likely to fail this condition with files >~8MB. Is this what you're seeing?
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: FTP Server file transfer cancellation
I'm transferring 60MB files, and I have no problem grabbing 30 of them and transferring them to my PC. The problem only occurs when I cancel the transfer of a file by clicking the Cancel button on the windows file copy dialog. It's acting like the FTP process does not know the file transfer has been cancelled, and is waiting on something?
Re: FTP Server file transfer cancellation
It would help if you shown the section of code where your uploading the data.
Are you checking to see if the connection gets closed ?
Are you checking to see if the connection gets closed ?
Re: FTP Server file transfer cancellation
Wow... seulater, thanks for your post. It's been so long since I worked with this app that I forgot I even had any ftp code. I was thinking it was all handled by the runtime library!
I see where the problem is (there's a writeall function call that is writing blocks of the file to the FTP file desciptor in an infinite loop). Now how to fix it so I can check on whether the connection has been closed...?
I see where the problem is (there's a writeall function call that is writing blocks of the file to the FTP file desciptor in an infinite loop). Now how to fix it so I can check on whether the connection has been closed...?
Re: FTP Server file transfer cancellation
All better now 

Re: FTP Server file transfer cancellation
FYI, there is a loop in the ftp_f.ccp program in the C:\nburn\examples\StandardStack\EFFS\ examples that provide FTP that becomes an infinite loop if the ftp session is cancelled or refreshed while a file is being transferred.
At around line 506 in ftp_f.ccp:
write() returns a negative number if it fails. If the session is cancelled or refreshed while in this loop, the write() will continue to return -2 and there is no way out of the loop. Changing the exit counter condition from if ( BytesWritten == 0 ) to if ( BytesWritten <= 0 ) fixes the problem, although that might not be the best way to deal with this.
Perhaps someone else has a more robust solution that should be incorporated into the ftp_f.cpp program.
At around line 506 in ftp_f.ccp:
Code: Select all
while( ( RetryAttempts < NetworkRetryLimit ) && ( TotalBytesWritten != BytesRead ) )
{
BytesWritten = write( fd, FTP_buffer + TotalBytesWritten, BytesRead-TotalBytesWritten );
// retry if busy
if ( BytesWritten == 0 )
{
RetryAttempts++;
OSTimeDly( TICKS_PER_SECOND/4 );
}
TotalBytesWritten += BytesWritten;
}
if( RetryAttempts >= NetworkRetryLimit )
TransferError = 2;
}
Perhaps someone else has a more robust solution that should be incorporated into the ftp_f.cpp program.
Re: FTP Server file transfer cancellation
I'm making a note of this to examine this issue later. I have encountered this error and been frustrated by it. Thank you for pointing out the cause.
-Dan
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc