• AVR Freaks

Hot!Harmony v2.06 FTP Server

Author
morgan1361
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/03/22 07:28:09
  • Location: 0
  • Status: offline
2019/09/03 15:31:40 (permalink)
0

Harmony v2.06 FTP Server

All,
 
I am having issues getting the FTP Server running that is built in to the Harmony TCP/IP Stack.  I am sure it is something simple that I am over looking but I can't seem to find the issue.  It seems from the documentation that the FTP server should just function with minimal configuration.  As in, no actual application code required.  
 
The project consists of a custom board with a PIC32MZ2048EFH100.  The board is functioning primarily as an ethernet switch with an embedded web server, hosted from an SD card.  Now, all of that is functioning well.  The problem is that I also need it to function as an FTP server so I can load new firmware if needed.  My FTP client (Filezilla and command line) will connect to the board, but the "ls" command fails with "425 Can't create data socket".  This was supposed to be the easy part :)
 
Below are my FTP config straps from system_config.h
/*** FTP Configuration ***/
#define TCPIP_STACK_USE_FTP_SERVER
#define TCPIP_FTP_USER_NAME_LEN 10
#define TCPIP_FTP_PASSWD_LEN 10
#define TCPIP_FTP_MAX_CONNECTIONS 5
#define TCPIP_FTP_DATA_SKT_TX_BUFF_SIZE 2048 // 2048
#define TCPIP_FTP_DATA_SKT_RX_BUFF_SIZE 2048 // 2048
#define TCPIP_FTPS_TASK_TICK_RATE 10 // 10
#define TCPIP_FTP_USER_NAME "meepmerp"
#define TCPIP_FTP_PASSWORD"herpderp"
#define TCPIP_FTP_TIMEOUT 1200
#define TCPIP_FTP_PUT_ENABLED

 
None of the Harmony examples show this configuration, however, some claim to use FTP, so is the above even needed?  The SD card is formatted as FAT and as I stated earlier, the web server is functioning from it.  
 
Any help would be greatly appreciated
#1
freebsd
Super Member
  • Total Posts : 154
  • Reward points : 0
  • Joined: 2011/03/07 04:15:29
  • Location: 0
  • Status: offline
Re: Harmony v2.06 FTP Server 2019/09/11 05:05:02 (permalink)
0
Hi , 
I am not able to reproduce the above issue .
We have added SYS_FS_Shell layer to the TCPIP module  instead of sys_fs_wrapper . The affected modules are FTP and HTTP modules. The purpose of SYS_FS_SHELL  layer to create individual layer  for the respective module access of SYS_FS_SHELL layer. This helps user to use different mount paths for different TCPIP module.
 
I have attached the respective files and there changes w.r.t. SYS_FS_SHELL file.
 
Now you need to add sys_fs_shell.c file to the project.
 
Please do let us know if this works for you.
#2
morgan1361
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/03/22 07:28:09
  • Location: 0
  • Status: offline
Re: Harmony v2.06 FTP Server 2019/09/11 08:49:57 (permalink)
0
Thank you @freebsd for your response.
 
Let me start by asking a couple questions
1. Are the configuration straps that I listed in my original post all that is needed to configure the FTP module for use?
 
2. Is anything else required to utilize the FTP module (i.e. an FTP_Initialize, FTP_Open, or FTP_Tasks function call done by me and not the stack)?
 
3. If the answer to question 2 is yes, then why am I able to connect via FTP without performing any of those function calls?
 
I guess my main source of confusion is the error itself.  "Cannot create data socket", what causes this error when I am already connected to the device via FTP?  
 
I am also a little confused by your response.  I understand the purpose of the new FS Shell to allow multiple mounting paths, but the FTP module does not have a mechanism for latching a specific mount path to it that I can see.  So if you could please elaborate on how this could potentially solve my issue.  Also, are there any actual examples of using the FTP module on a PIC32MZ with Harmony 2.x?  If so, can you point me in the right direction.
 
Thank you for your assistance
#3
freebsd
Super Member
  • Total Posts : 154
  • Reward points : 0
  • Joined: 2011/03/07 04:15:29
  • Location: 0
  • Status: offline
Re: Harmony v2.06 FTP Server 2019/09/12 07:08:50 (permalink)
0

Let me start by asking a couple questions
1. Are the configuration straps that I listed in my original post all that is needed to configure the FTP module for use?

> I don't see any issue. This should work and i also tried with 5 different FTP connections and It is working in my end.
 

2. Is anything else required to utilize the FTP module (i.e. an FTP_Initialize, FTP_Open, or FTP_Tasks function call done by me and not the stack)?

ANS - NO, you don't need to do all these. This is already taken care by the FTP server source code.
 

I guess my main source of confusion is the error itself.  "Cannot create data socket", what causes this error when I am already connected to the device via FTP?  
ANS- I guess, you might be short of Number TCP sockets. By default 
#define TCPIP_TCP_MAX_SOCKETS                 10
 
TCP/IP modules which are dependent on TCP socket, one need to increase the above parameter.
I tested with a setup which has 4 HTTP sockets , 5 FTP control sockets . When one of the client communicates with the FTP server , then it creates another new data socket for LS, DIR, GET an PUT command. So please increase this above macro.

 
 
Please do let me know if this solves your issue.
 
#4
morgan1361
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/03/22 07:28:09
  • Location: 0
  • Status: offline
Re: Harmony v2.06 FTP Server 2019/09/12 09:01:24 (permalink)
0
freebsd,
 
So I have made the following changes to system_config.h
 
I made the DRAM heap enormous just to eliminate that as a possible problem (I also adjusted the linker reserved heap in the project settings to compensate)

#define TCPIP_STACK_DRAM_SIZE             102400

#define TCPIP_FTP_MAX_CONNECTIONS     1
#define TCPIP_HTTP_MAX_CONNECTIONS   5
#define TCPIP_TCP_MAX_SOCKETS             30
#define TCPIP_UDP_MAX_SOCKETS            10

 
There should be no issue with the number of sockets available or memory available anymore. 
This seems to have had some effect.  Now when I execute an "ls" command, the error returned has changed
 

ftp> ls
200 Command OK
125 File status okay; about to open data connection
550 Requested action not taken

 
After some googling, it seems that this error is typically associated with file system errors, however the website still functions so the file system is working fine.  Any thoughts?
#5
freebsd
Super Member
  • Total Posts : 154
  • Reward points : 0
  • Joined: 2011/03/07 04:15:29
  • Location: 0
  • Status: offline
Re: Harmony v2.06 FTP Server 2019/09/13 05:46:39 (permalink)
0
Hi ,
Could you please share your packaged code that I can debug your issue?
> If this above request is not possible, could you please share your configuration.h ?
I am not able to reproduce the issue.
Are you using windows ftp client or something else? Please do provide the test details.
#6
Jump to:
© 2019 APG vNext Commercial Version 4.5