Go Down

Topic: Ftp Server on Arduino (Read 47907 times) previous topic - next topic

gallegojm

Of course you need more libraries.

I think that instructions for arduino Due in the Github repository (readme.txt) are clear enough (look at my message # 79).


Jono72

Hi Guys,

Hopefully someone can help me here, I have Arduino MEGA, I have been trying for weeks to get this to work, I cannot find anyone that has created an FTP server, I have installed all the libraries mentioned, including the modified Ethernet connection, but I just cannot get this to compile.

Can anybody point me in the right direction here, I only need ftp access for my project to upload small config.txt file and download log files that's it.

I intend to also be running an MODBUS TCP/IP RTU slave (obviously not at the same time), the FTP access is just for configuration and datalog removal when needed.

Kind Regards

John

PS error file attached.

gallegojm

Hi Jono
Please read message #62 to #70, #77, #81 and #86.
I don't think it is a good idea to wast all resources of an arduino mega using a ftp server just for uploading a config file. If you got it, reducing the ftp server library, you will not have much memory left for the rest of your application.

Godbleach

#93
Jul 10, 2018, 10:34 am Last Edit: Jul 10, 2018, 10:36 am by Godbleach
Hi !! I want to make FTP Server with ENC28J60-H how can I do ?. I want lib and example to use and without SD. Sorry for my bad lang.

gallegojm

Hi Godbleach
Don't worry for your "bad lang". English is not my favorite language to me either.
I have no experience with ENC28J60 but, googling, I saw than people had connected this board to arduino's platform. So you surely can adapt my software to this controller.
If you don't use a SD card, what is the support for your files or data?

Yuhanj

Hi. Thank you for a great library, it helped me a lot in my project!

I have Arduino Mega 2560 and module W5500. Arduino IDE 1.8.5

I have struggled with compilation for three days and would like to write detailed instructions for others.


1)To use the files from \FtpServeur    https://github.com/gallegojm/Arduino-Ftp-Server
2)To install the library SdFat.h       https://github.com/greiman/SdFat-beta
3)To install the library Streaming.h   http://arduiniana.org/Streaming/Streaming5.zip     
4)In the file SdList.h replace the line 5 "#include <SdStream.h>" to "//#include <SdStream.h>"
5)In the file SdList.cpp replace the line 50 "SdFile file;" to "FatFile file;"
6)In the file SdList.cpp replace the line 56 "file.getFilename( name );" to "file.getName( name, 128 );"
7)In the file SdList.cpp replace the line 75 "Sd2Card * p_card = sd.card();" to "Sd2Card * p_card = (Sd2Card *) sd.card();"
8)In the file SdList.cpp replace the line 83  "SdVolume * p_vol = sd.vol();" to "FatVolume * p_vol = (FatVolume *) sd.vol();"
9)Modified files iostream.h, EthernetServer.h, EthernetServer.cpp as already written.

To work with W5500:

10)To install the library Ethernet2.h
11)In the file FtpServeur.ino replace the line 8 "#include <Ethernet.h>" to "#include <Ethernet2.h>
12)In the file FtpServer.h replace the line 30 "#include <Ethernet.h>" to "#include <Ethernet2.h>

Jean-Michel, thanks again for your work!

With best regards,
Yuhan.



gallegojm

Thanks to you, Yuhanj for this update with the new libraries and new ide.
It would be interesting if you can give some info about download and upload speed.
We could compare with data from messages #27, #44, #58 and #59
And also about memory needs. Does memory remain for other applications?

I am glad you rejuvenated the ftp server library!
Jean-Michel

Yuhanj

Hi. If I understand what you need.

For all: Windows10 + Mega 2560 + W5500 + FtpRush client

For: FTP_BUF_SIZE = 512


"Sketch uses 32910 bytes (12%) of program storage space. Maximum is 253952 bytes.
Global variables use 4457 bytes (54%) of dynamic memory, leaving 3735 bytes for local variables. Maximum is 8192 bytes."

File of 3,7 Mega bytes

1) Download  29,14 (s)/133,37Kbps
2) Upload    36,95(s)/105,08Kbps

File of 13,5 Mega bytes

1) Download  01:49(s)/131,29Kbps
2) Upload    02:12(s)/108,04Kbps


For: FTP_BUF_SIZE = 2048

"Sketch uses 32910 bytes (12%) of program storage space. Maximum is 253952 bytes.
Global variables use 5993 bytes (73%) of dynamic memory, leaving 2199 bytes for local variables. Maximum is 8192 bytes."

File of 13,5 Mega bytes

1) Download  01:40(s)/142,24Kbps
2) Upload    02:22(s)/100,35Kbps

File of 3,7 Mega bytes

1) Download 26,83(s)/144,87Kbps
2) Upload   40,33(s)/96,28Kbps


I have not yet connected an FTP server to my big project. I need about 30% more dynamic memory for other processes. 30% + 54 % should work think.

What else can I do for you?

With best regards,
Yuhan.


gallegojm

Hi Yuhanj
Thank you for those measurements.
They are of the same order of value as those obtained with an Arduino Due and a W5200. It's good news
I wish you good luck for your project



alanlt

hi, Yuhanj  and gallegojm,
Thank you for your share.
Now I'm working on Mega2560 and W5200 too, and my transferring speed is:
1)for class 4 SD card:
 Uploading: 80.16kBps
 Downloading: 119.47 kBps
2) for class 6 SD card:
 Uploading: 138.54 kBps
 Downloading: 125.50kBps
3) for class 10 SD card: 
  Uploading: 124.52 kBps
  Downloading: 122.47 kBps
It is strange that using class 10 SD card speed is lower than class 6 SD card speed. I will try to another brand class 10 SD card later.
And another question, did you solve the problem of supporting long name in Mega2560? In my project, we need to upload big (about 200M) and long-name file to Mega2560. If you have a solution, could you give me a tip? thanks.

gallegojm

Hi alanlt
I am glad to see so many people using ftp server library.

About SD cards class 10 speed lower than cards class 6. Can be my memory plays me a bad trick, but I seem to have read that to increase the speed, the class 10 cards used a special interface, not available with Arduino hardware.

About long file names. When I wrote the library, SdFat (by greiman) was not supporting long names, that is why I used FatFs (by ChaN). But I see than greiman had updated his library and that it supports now long names and he says "Long File names require extra flash but no extra RAM". See SdFat/extras/html/index.html in his last repository.
Jean-Michel

Godbleach

Hi gallegojm.
What can I use a library for ENC28J60 ?
I search on google but no someone make ftp server on ENC28J60 but it have a FTP Client and I can't make a server.
nerver mind of SD Card.

alanlt

Hello, gallegojm and Yuhanj,
I found if using Yuhanj 's step 5
5)In the file SdList.cpp replace the line 50 "SdFile file;" to "FatFile file;"
Then long filename will be supported. But the upload speed will decrease from 180kBps to 105kBps, I have tried to use Sdfile with new SdFat lib. The compile error occurs.

    sketch\SdList.cpp: In member function 'bool SdList::nextFile(char*, bool*, uint32_t*)':

   SdList.cpp:56: error: 'class SdFile' has no member named 'getFilename'

        file.getFilename( name );
I find getFilename() is defined in class SdBaseFile of SdBaseFile.cpp
    bool SdBaseFile::getFilename(char* name) {}
For I'm not familar in C++ and arduino IDE, so I haven't solved it yet. Do you know what is the cause?
And Yuhanj, did you try to compile with SdFile class ever?

Yuhanj

Hi, alanlt.

No, I couldn't compile with the class SdFile. With class SdBaseFile - I haven't tried.

You have 180kBps for Mega 2560? Wow! How did you do it?

alanlt

Hello,
first, I used 2560+w5100, upload speed is 7.47KPBs. Download speed is 51.79KBps
then I used 2560+w5200, upload speed is 80.16KPBs. Downlaod speed is 119.47KBps
then I changed class4 SD card to class6 SD card and class10 SD card
1) for class 6 SD card:
 Uploading: 138.54 kBps
 Downloading: 125.50kBps
2) for class 10 SD card: 
  Uploading: 124.52 kBps
  Downloading: 122.47 kBps
Then I changed "if( ! sd.begin( CS_SDCARD, SPI_HALF_SPEED ))" to "if( ! sd.begin( CS_SDCARD, SPI_FULL_SPEED )) " in FtpServerur.ino,
1) for class 6 SD card:
 Uploading: 185.81 kBps
 Downloading: 175.79kBps
2) for class 10 SD card: 
  Uploading: 188.08 kBps
  Downloading: 170.18 kBps
If changing "SdFile file" to "FatFile file", the speed is similar as yours.
So I concluded that to get high speed, it is recomended to use Sdfile and SPI_FULL_SPEED.
And Yuhanj, I see your name looks like a Chinese, and I'm Chinese too. Could you please add my wechat "13764124252", then it is convinient for us to comunicate in Project develoment later?

Go Up