gallegojm / Arduino-Ftp-Server

Ftp server for Arduino Due and Ethernet Shield or WIZ820io
40 stars 25 forks source link

SAMD #5

Closed gioreva closed 3 years ago

gioreva commented 3 years ago

HI

I'm trying Arduino Zero SAMD21 CPU

=== Test of FTP Server ===
Mount the SD card with library FatFs ... ok
Initialize ethernet module ... W5500 ok
IP address of server: 192.168.1.70
Free stack: 24376

But when I try to download a file with FtpZilla, I get this error. After that no longer connects.

Status: Connecting to 192.168.1.70:21...
Status: Connection established, waiting for welcome message...
Status: Plain FTP is insecure. Please switch to FTP over TLS.
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing...
Status: Directory listing of "/" successful
Status: Starting download of /config.ini
Command:    PASV
Error:  Connection timed out after 20 seconds of inactivity
Error:  File transfer failed
Status: Connecting to 192.168.1.70:21...
Status: Connection established, waiting for welcome message...
gioreva commented 3 years ago

I have downloaded FTP Rush But i don't find way for edit config.ini, text file, directly inside Client.

image

gallegojm commented 3 years ago

Right click on the file open this menu: FR01

gioreva commented 3 years ago

My FTP RUSH is different.

image

gallegojm commented 3 years ago

I now realize that the version of FtpRush I am using is very, very old ! FR02 What a shame!

gioreva commented 3 years ago

image

gioreva commented 3 years ago

Exist V2 and V3. But FileZilla Work well.

gioreva commented 3 years ago

Ok, I tried the V2 but is a continuous crash. Do not download files. Just reopened FileZilla has downloaded them.

gallegojm commented 3 years ago

Ja ja ja. Using a software 9 years old. May be I should update it...

change port Runtime

Yes, it would be nice something like: ftpSrv.init( commandPort, dataPort, externalIP ); but, until now I do not know how to instantiate a server object without define his port number. So, the only solution at the moment is to modify the #define in FtpServer.h

I have updated the discussion in the forum and thank you for your suggestions

gallegojm commented 3 years ago

Hi I updated to the version V2.2.0 from FtpRush. Looks like V3 is beta It is working fine here. But if you are satisfied with FileZilla, that is all right.

Something we do not discute: If the client crashes without closing the connection (for example if the computer it is running on loses its connecttion to the internet), the server does not close immediately (because it has no way to know about the crash). Consequently, you can't reconnect until the server closes the connection. This time lapse is defined by FTP_TIME_OUT in FtspServer.h and I set it to 5 minutes. But you can reduce it if you will.

gioreva commented 3 years ago

Thank you.

I already switched to another project, but I would still experience here. For example, I wanted to see if it was possible to enable uPnP

The problem is that opening the port is difficult and not very functional. It works very well open the FTP service but do not know if uPnP can do this.

gallegojm commented 3 years ago

I have no experience with uPnP. if I am not mistaken, the interest is to facilitate the configuration of the router behind which is connected a device (for example, your Gevino Zero)?

I have a question: You told me you are updating the firmware from a file uploaded to the SD. This is interesting. Can you tell me which library you use for that?

gioreva commented 3 years ago

I have created custom bootloader for SAMD21, but need hardware programmer. Atmel-ice

gioreva commented 3 years ago

Hi Library work well, but IDE at startup says ?

"Invalid library found in C:\Users\x-gio\Documents\Arduino\libraries\FtpServer: no headers files (.h) found in C:\Users\x-gio\Documents\Arduino\libraries\FtpServer"

gallegojm commented 3 years ago

Hi This is strange! This message appears compiling one of the examples? Which one? The editor points to a specific line?

gioreva commented 3 years ago

Not, when ide start. At startup it check all folder

gallegojm commented 3 years ago

All your libraries are in that folder? My Users...\Documents\Arduino\libraries folder is empty. It only contains a file readme.txt I have a libraries subfolder in the folder where are my sketches.

gioreva commented 3 years ago

Maybe cause is missing file "library.properties" on my folder.

I'm going crazy. Is there a conflict with the library https://github.com/stevemarple/IniFile

It was better if the file was opened in schetch and passed only the pointer to your library.

Problem is redefinition of "sd"

define FAT_FS sd

line 43 FatLib.h

Also IniFile use same.

I can not understand what files you use sd

gioreva commented 3 years ago

Arduino: 1.8.13 (Windows 10), Board: "GEVINO SD bootloader"

In file included from C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:38:0,

             from C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\GEVINO_alarm\GEVINO_alarm.ino:43:

C:\Users\x-gio\Documents\Arduino\libraries\FatLib\src/FatLib.h:43:22: error: conflicting declaration 'SdFat sd'

define FAT_FS sd

                  ^

C:\Users\x-gio\Documents\Arduino\libraries\IniFile\src/IniFile.h:12:14: note: in expansion of macro 'FAT_FS'

extern SdFat FAT_FS;

          ^~~~~~

In file included from C:\Users\x-gio\Documents\Arduino\libraries\FatLib\src/FatLib.h:41:0,

             from C:\Users\x-gio\Documents\Arduino\libraries\FtpServer\src/FtpServer.h:38,

             from C:\Users\x-gio\Documents\Project\Geva\GEVINO opto\GEVINO_alarm\GEVINO_alarm.ino:43:

C:\Users\x-gio\Documents\Arduino\libraries\FatLib\src/ExtSdFat.h:26:17: note: previous declaration as 'ExtSdFat sd'

extern ExtSdFat sd;

             ^~

exit status 1

Error compiling for board GEVINO SD bootloader.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

gallegojm commented 3 years ago

Hi It is difficult to answer you without your seeing the code. If the error goes away when you delete the Inifile library, then yes there is a conflict between the libraries. I do not know IniFile. I just see that in IniFile.h there is a way to select library to access SD card. Maybe you can modify this library to use FatLib, the same way I do in ftp server. This way you will be able to choose between SdFat or FatFs by simply changing a #define in your entire sketch.

gioreva commented 3 years ago

Code is simple.

#include <SdFat.h>
#include <FtpServer.h>
#include <IniFile.h>
FtpServer ftpSrv;
IniFile ini("config.ini");
void setup(){}
void loop(){}

I'm trying to change the IniFile library but all attempts have failed. You have too many recursive libraries and I lose myself.

Help me to find right definition for extern SdFat sd; Line 12 of https://github.com/stevemarple/IniFile/blob/master/src/IniFile.h

gioreva commented 3 years ago

Now Work Sorry Forget everything

gallegojm commented 3 years ago

Do not worry. I don't know a way to progress without making mistakes!

Is IniFile used in setup() to configure some parameters? In that case may be you can do it in a simpler way.

gioreva commented 3 years ago

image

I'm desperate, I can not find a solution for use this ibrary wit IniFile Can you help me ? I always get "not open file".

if defined(PREFER_SDFAT_LIBRARY)

include "SdFat.h"

//extern SdFat SD; extern SdFat sd;

else

bool IniFile::open(void) { if (_file) _file.close(); // _file = SD.open(_filename, _mode); _file = sd.open(_filename, _mode); if (isOpen()) { _error = errorNoError; return true; } else { _error = errorFileNotFound; return false; } }

gallegojm commented 3 years ago

Hi Let me see if I have time this afternoon to help you

gioreva commented 3 years ago

Maybe I have solved problem Tomorrow I continue

.ino

include

SdFat SD;

IniFile.h

if defined(PREFER_SDFAT_LIBRARY)

include "SdFat.h"

extern SdFat SD;

gioreva commented 3 years ago

nothing, now works IniFIle but not works FTP Only i see directory, but not work uplaod download file.

I need your help for setup disk.

"SD" "sd" "FAT_LIB" Where and what extern define.

gioreva commented 3 years ago

Not, now work

gioreva commented 3 years ago

if defined(PREFER_SDFAT_LIBRARY)

include "ExtSdFat.h"

extern ExtSdFat sd;

else

include "SD.h"

endif

gioreva commented 3 years ago

Maybe you have not undestand. I have to use same disk (sdfat) from IniFile and FTPserver

If I use config above, build work, but somtime i found SD brocken. Also formatting is impossible, i have removed and recreated partition for save it.