I am using a 52259 with MQX 4.1. I have a USB stick connected and mounted to MFS/Partition manager at "a:". I am able to read/write files to this, so I know it is mounted properly. I am using the following code to initialize the FTP server:
-------------------------------------------------------------------------
FTPSRV_PARAM_STRUCT params = {0};
unsigned int old_handle = ftpsrv_handle;
params.af |= AF_INET;
params.auth_table = (FTPSRV_AUTH_STRUCT*) ftpsrv_users;
params.root_dir = "a:";
ftpsrv_handle = FTPSRV_init(¶ms);
if (ftpsrv_handle != 0)
{
printf("FTP Server Started. Root directory is set to \"%s\", login: \"%s\", password: \"%s\".\n",
params.root_dir,
ftpsrv_users[0].uid,
ftpsrv_users[0].pass);
}
---------------------------------------------------------------------------
I then try to connect with FileZilla, and here is what I get:
Status: Connecting to 192.168.2.100:21...
Status: Connection established, waiting for welcome message...
Response: 220 RTCS FTPSRV Ready
Command: USER developer
Response: 331 User name okay, need password.
Command: PASS *********
Response: 230 Password ok, User logged in.
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 257 "\" is the current directory
Command: TYPE I
Response: 200 Type Binary.
Command: PASV
Response: 227 Entering Passive Mode (192,168,2,100,19,136).
Command: LIST
Response: 150 Opening data connection.
Response: 451 Requested action aborted. Local error in processing
Error: Failed to retrieve directory listing
I am connecting using default FileZilla settings. Any ideas? If I change my FTP server param to use c:, and leave my usb stick at a:, I get:
Response: 550 Requested action not taken. File unavailable.
as a response to the list command, instead of response 150/451 above. This tells me that a: is a valid directory in the initial case, whereas I know c: was invalid.
Hi,
this error usually means that server ran out of memory, so it is unable to create another socket for data connection.
Best regards,
Karel
What task does the FTP server get its stack allocated from? RTCS? Or does it get allocated from whatever task the FTP_init function was called from?
edit: Nevermind. It looks like it allocates its own stack space. FTP server stack size is 1200, and FTP Session stack size is 3000 per session. So with one session, it looks like it uses about 4200 bytes of stack. I had to decrease the stack size allocated to MFS. After I did that, the FTP server ran fine.
I tried web_havc demo, enabled ftp server, pc as client. k70F120 as ftp server. Here is my result. (I added a printf in ftpsrv_ses_init). Maybe you can refer to this demo