Forum Rule: Always post complete source code & details to reproduce any issue!
Page 5 of 7 FirstFirst ... 3 4 5 6 7 LastLast
Results 101 to 125 of 172

Thread: Teensy 4.1 - Adafruit Airlift Featherwing Co-Processor FTP Server not opening Port 21

  1. #101
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Fascinating - that worked like a charm !!!!! but I noticed in Filezilla that the SD Card contents don't show in Filezilla?
    Code:
    Status:	Connection established, waiting for welcome message...
    Response:	220---Welcome to Simply FTP server ---
    Response:	220---   By Renzo Mischianti   ---
    Response:	220 --    Version 2022-03-11    --
    Status:	Plain FTP is insecure. Please switch to FTP over TLS.
    Command:	USER esp8266
    Response:	331 Ok. Password required
    Command:	PASS *******
    Response:	230 Ok
    Status:	Server does not support non-ASCII characters.
    Status:	Logged in
    Status:	Retrieving directory listing...
    Command:	PWD
    Response:	257 "/" is your current directory
    Command:	TYPE I
    Response:	200 TYPE is now 8-bit binary
    Command:	PORT 192,168,1,181,198,22
    Response:	200 PORT command successful
    Command:	MLSD
    Response:	150 Accepted data connection to port 50710
    Response:	150 Accepted data connection to port 50710
    Error:	Failed to retrieve directory listing

  2. #102
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    @mjs513 - Here is a screen shot of connection with Filezilla:
    Click image for larger version. 

Name:	Screenshot at 2022-05-08 17-26-59.png 
Views:	10 
Size:	132.6 KB 
ID:	28326

    This is what I have with handleFTP():
    Code:
    uint8_t FtpServer::handleFTP() {
    #ifdef FTP_ADDITIONAL_DEBUG
    //    int8_t data0 = data.status();
    	ftpTransfer transferStage0 = transferStage;
    	ftpCmd cmdStage0 = cmdStage;
    	ftpDataConn dataConn0 = dataConn;
    #endif
    
    	if ((int32_t) (millisDelay - millis()) <= 0) {
    		if (cmdStage == FTP_Stop) {
    			if (client.connected()) {
    				DEBUG_PRINTLN(F("Disconnect client!"));
    				disconnectClient();
    			}
    			cmdStage = FTP_Init;
    		} else if (cmdStage == FTP_Init)  {  // Ftp server waiting for connection
    			abortTransfer();
    			iniVariables();
    			DEBUG_PRINT(F(" Ftp server waiting for connection on port "));
    			DEBUG_PRINTLN(cmdPort);
    
    			cmdStage = FTP_Client;
    		} else if (cmdStage == FTP_Client) {    // Ftp server idle
    
    //#if (FTP_SERVER_NETWORK_TYPE == NETWORK_WiFiNINA)
    //			if (client && !client.connected()) {
    //				client.stop();
    //				DEBUG_PRINTLN(F("CLIENT STOP!!"));
    //			}
    //			byte status;
    //			client = ftpServer.available(&status);
    			/*
    			 *   CLOSED      = 0,
      LISTEN      = 1,
      SYN_SENT    = 2,
      SYN_RCVD    = 3,
      ESTABLISHED = 4,
      FIN_WAIT_1  = 5,
      FIN_WAIT_2  = 6,
      CLOSE_WAIT  = 7,
      CLOSING     = 8,
      LAST_ACK    = 9,
      TIME_WAIT   = 10
    			 *
    			 */
    //			DEBUG_PRINTLN(status);
    //#elif defined(ESP8266)
    //		  if( ftpServer.hasClient())
    //		  {
    //		    client.stop();
    //		    client = ftpServer.available();
    //		  }
    //#else
    //			if (client && !client.connected()) {
    //				client.stop();
    //				DEBUG_PRINTLN(F("CLIENT STOP!!"));
    //			}
    			client = ftpServer.accept();
    //#endif
    			if (client.connected())             // A client connected
    			{
    				clientConnected();
    				millisEndConnection = millis() + 1000L * FTP_AUTH_TIME_OUT; // wait client id for 10 s.
    				cmdStage = FTP_User;
    			}
    		} else if (readChar() > 0)             // got response

  3. #103
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    @wwatson think I am pretty much done for the night so will update in the morning. Nice job

  4. #104
    Junior Member Juraj's Avatar
    Join Date
    May 2022
    Location
    Slovakia
    Posts
    13
    if server.accept() works for you, consider to add a supporting comment to the PR in WiFiNINA GitHub repo:
    https://github.com/arduino-libraries/WiFiNINA/pull/204

  5. #105
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    @wwatson - double checked what I am using for handleFtp and its the same as what you posted. Still getting the error an no directory display for some reason. Have been reading and seems everybody seems to be using active mode with Filezilla - not sure why it doesn't work with passive mode.

    @Juraj - so far so good and will do.

  6. #106
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    @wwatson - are you using the accept branch of WifiNina or the master branch? I still can't get filezilla to display the directory

  7. #107
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    Quote Originally Posted by mjs513 View Post
    @wwatson - are you using the accept branch of WifiNina or the master branch? I still can't get filezilla to display the directory
    I think it is the accept branch. One more thing that I did not remember yesterday Is that in the site manager you have to also set Active mode in the transfer tab.

    Like This:
    Click image for larger version. 

Name:	Screenshot at 2022-05-09 15-17-12.png 
Views:	5 
Size:	44.9 KB 
ID:	28331

    The leftmost icon on the menu bar will take you to the site manager. There are three settings: 'Default' 'Active' and 'passive'. Make sure you have Default or Active selected. I would select Active to be on the safe side.

    Got a couple of errands to run. Will gather up all info on the libraries I am using and get back with you.

  8. #108
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Quote Originally Posted by wwatson View Post
    I think it is the accept branch. One more thing that I did not remember yesterday Is that in the site manager you have to also set Active mode in the transfer tab.

    Like This:
    Click image for larger version. 

Name:	Screenshot at 2022-05-09 15-17-12.png 
Views:	5 
Size:	44.9 KB 
ID:	28331

    The leftmost icon on the menu bar will take you to the site manager. There are three settings: 'Default' 'Active' and 'passive'. Make sure you have Default or Active selected. I would select Active to be on the safe side.

    Got a couple of errands to run. Will gather up all info on the libraries I am using and get back with you.
    Thanks - got that one checked as well. Not sure why yours is working and mine is not. If you get a chance export your filezilla setting and post them for me - pretty sure I got them right but who knows.

  9. #109
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    @mjs513 - I zipped up everything that I have at this point that is working including the original Arduino FtpServer by Jean-Michel Gallego. I spent all of last Sunday modifying his latest version which finally led me to the solution. Mind you there is so much more to do. At this point we can only get directory listings and change directories. the file sizes are right but the dates and times are incorrect. I only worked with the T4.1 built in SD card. I am quite sure that file transfers are not setup properly as well as passive mode. I remember having problems with passive mode when I had the T3.6 and ESP8266 setup with WiFiSPI. As you stated it sounds like Active mode is used more.

    Here is everything that I am using:
    https://github.com/wwatson4506/nina-...e/accept()_mod
    No mods to this...

    Here is the rest that fit as a zip:
    SerialESPPassthrough.zip I think you already have this.
    SimpleFTPServer.zip A completely incomplete version
    WiFiNINA-accept.zip Unmodified...
    FtpServer.zip The original simpleFTPServer is based on. Also incomplete.

    I am running these on a Adafruit ESP32 Airlifit Featherwing.

    Hopefully next weekend I can play with it more. I feel kinda guilty not testing MSC more with TD1.57B1

  10. #110
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Quote Originally Posted by wwatson View Post
    @mjs513 - I zipped up everything that I have at this point that is working including the original Arduino FtpServer by Jean-Michel Gallego. I spent all of last Sunday modifying his latest version which finally led me to the solution. Mind you there is so much more to do. At this point we can only get directory listings and change directories. the file sizes are right but the dates and times are incorrect. I only worked with the T4.1 built in SD card. I am quite sure that file transfers are not setup properly as well as passive mode. I remember having problems with passive mode when I had the T3.6 and ESP8266 setup with WiFiSPI. As you stated it sounds like Active mode is used more.

    Here is everything that I am using:
    https://github.com/wwatson4506/nina-...e/accept()_mod
    No mods to this...

    Here is the rest that fit as a zip:
    SerialESPPassthrough.zip I think you already have this.
    SimpleFTPServer.zip A completely incomplete version
    WiFiNINA-accept.zip Unmodified...
    FtpServer.zip The original simpleFTPServer is based on. Also incomplete.

    I am running these on a Adafruit ESP32 Airlifit Featherwing.

    Hopefully next weekend I can play with it more. I feel kinda guilty not testing MSC more with TD1.57B1
    Looks like I am using the same libraries that you are using - not sure why I can not get the directory listing. Are you using the nina-fw bin file that I generated?

    Oh figured out get Passive mode to connect. Try this:
    Code:
    FtpServer ftpSrv(21, 20);
    then I get the connection through port 21 but I get no data connection message.

  11. #111
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    Quote Originally Posted by mjs513 View Post
    Looks like I am using the same libraries that you are using - not sure why I can not get the directory listing. Are you using the nina-fw bin file that I generated?

    Oh figured out get Passive mode to connect. Try this:
    Code:
    FtpServer ftpSrv(21, 20);
    then I get the connection through port 21 but I get no data connection message.
    Was playing with this after work tonight. the server is really unstable. I can connect and get a directory listing and then change back and forth between directories. When I try to disconnect Filezilla the T4.1 locks up here:
    Code:
    DIR MLSD 
    DIR NEXT 
    Type=file;Modify=19700101000000;Size=32768000; 32MEGfile.dat
    Connected!!
    DIR MLSD 
    DIR NEXT 
    Type=file;Modify=19700101000000;Size=1975361; WhiteTrashSouthernCultureOnTheSkids.mp3
    Connected!!
    DIR MLSD 
    All file readed!!
    The only way to reconnect is to reset the T4.1 or wait for the server to timeout then I can reconnect. It all seems very unstable and I really haven't got a clue as to where to start. I guess the best place would be gettiing stable connection and disconnection with both passive and active modes. Will probably start with the FTPServer version I had working on the T3.6 and ESP8266

  12. #112
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    @wwatson
    Still playing to see what I can see - I did fix, I think, all the warnings etc with SD but still not working for me.

    One last question before I quit on this, are you using GPI0?

  13. #113
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    Quote Originally Posted by mjs513 View Post
    @wwatson
    Still playing to see what I can see - I did fix, I think, all the warnings etc with SD but still not working for me.

    One last question before I quit on this, are you using GPI0?
    No I'm not. Only for uploading new firmware. I'm going to keep picking at it and see what I can come up with. I just wonder if it still has to do with the speed of the T4.1. From what the specs say SPI speed is 8MHz to the Airlift...

  14. #114
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Quote Originally Posted by wwatson View Post
    No I'm not. Only for uploading new firmware. I'm going to keep picking at it and see what I can come up with. I just wonder if it still has to do with the speed of the T4.1. From what the specs say SPI speed is 8MHz to the Airlift...
    Just looked in wifinina library (
    Code:
    void SpiDrv::spiSlaveSelect()
    {
        WIFININA_SPIWIFI->beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
        digitalWrite(WIFININA_SLAVESELECT, LOW);
    
        // wait for up to 5 ms for the NINA to indicate it is not ready for transfer
        // the timeout is only needed for the case when the shield or module is not present
        for (unsigned long start = millis(); (digitalRead(WIFININA_SLAVEREADY) != HIGH) && (millis() - start) < 5;);
    }

  15. #115
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    Quote Originally Posted by mjs513 View Post
    Just looked in wifinina library (
    Code:
    void SpiDrv::spiSlaveSelect()
    {
        WIFININA_SPIWIFI->beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
        digitalWrite(WIFININA_SLAVESELECT, LOW);
    
        // wait for up to 5 ms for the NINA to indicate it is not ready for transfer
        // the timeout is only needed for the case when the shield or module is not present
        for (unsigned long start = millis(); (digitalRead(WIFININA_SLAVEREADY) != HIGH) && (millis() - start) < 5;);
    }
    I think now I have passive mode figured out. In the main sketch we have this in setup():
    Code:
    //      ftpSrv.setCallback(_callback);
    //      ftpSrv.setTransferCallback(_transferCallback);
    After commenting these out I was able to connect consistently in passive mode. Still cannot disconnect gracefully without resetting the t4.1 or waiting for it to time out on inactivity and the server disconnect...

    Edit: Dang, Failed again. totally inconsistent That's it for tonight...
    Last edited by wwatson; 05-11-2022 at 11:49 PM. Reason: Failed again...

  16. #116
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Quote Originally Posted by wwatson View Post
    I think now I have passive mode figured out. In the main sketch we have this in setup():
    Code:
    //      ftpSrv.setCallback(_callback);
    //      ftpSrv.setTransferCallback(_transferCallback);
    After commenting these out I was able to connect consistently in passive mode. Still cannot disconnect gracefully without resetting the t4.1 or waiting for it to time out on inactivity and the server disconnect...

    Edit: Dang, Failed again. totally inconsistent That's it for tonight...
    Well - finally feel like I made some progress - I switched to using SDFat2 instead of SD just for the heck of it, turned debug off and was able to connect and get the directory listing. And was able to navigate the directories and transfer files;
    Code:
    tatus:	Disconnected from server
    Status:	Connecting to 192.168.1.239: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:	Retrieving directory listing of "/2001"...
    Status:	Directory listing of "/2001" successful
    Status:	Starting download of /2001/calculations.wav
    Status:	File transfer successful, transferred 426,300 bytes in 1 second
    Status:	Retrieving directory listing of "/GIF"...
    Status:	Directory listing of "/GIF" successful
    Status:	Disconnected from server
    Will update what I have and post in the morning. A bit tired now after some trial and error to get it working.

  17. #117
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    @wwatson
    As promised here is what I am using that got it working. Still some flakiness on transferring files but seems to be working.

    1. WifiNINA Library: https://github.com/mjs513/WiFiNINA (no changes)
    2. NINA-FW Firmware: https://github.com/mjs513/nina-fw
    3. SimpleServerFTP: WiFiNINA-master.zip
    and FeatherWing ESP32 FW Bin: NINA_W102-1.7.5.bin.zip

    Cheers - see if this works for you.

  18. #118
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    @mjs513 - That's great news Can't wait to try it out tonight. Nice job...

  19. #119
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Quote Originally Posted by wwatson View Post
    @mjs513 - That's great news Can't wait to try it out tonight. Nice job...
    Was something that you mentioned and started me thinking. This is a team effort on this project.

  20. #120
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,796
    So now I have some new shiny stuff like the same airwing...

    Might have to see if any of it works

  21. #121
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    Quote Originally Posted by mjs513 View Post
    Was something that you mentioned and started me thinking. This is a team effort on this project.
    I noticed that 'simpleFTPServer' was not included in p#117. Is your working version available?

  22. #122
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Quote Originally Posted by wwatson View Post
    I noticed that 'simpleFTPServer' was not included in p#117. Is your working version available?
    Oh shoot I attached the wrong file. Thanks for pointing that out:
    Attached Files Attached Files

  23. #123
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    Quote Originally Posted by mjs513 View Post
    Oh shoot I attached the wrong file. Thanks for pointing that out:
    Thanks Mike. It gets confusing at times To many variations on variations...

  24. #124
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    730
    @mjs513 - I was able to get as far as you did. Noticed that uploading or downloading would create a file but the actual file did not transfer. File size was zero. Also used the basic ftp command to check out make and deleting directories. That all works ok. It seems that doStore and doRetrieve is failing. Keeps losing the data connection for some reason...
    Got to catch some zzzz...

  25. #125
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,288
    Quote Originally Posted by wwatson View Post
    @mjs513 - I was able to get as far as you did. Noticed that uploading or downloading would create a file but the actual file did not transfer. File size was zero. Also used the basic ftp command to check out make and deleting directories. That all works ok. It seems that doStore and doRetrieve is failing. Keeps losing the data connection for some reason...
    Got to catch some zzzz...
    That seemed to happen to me more when I transferred from the client to the server. going from server to client it always failed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •