Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

FTP Server for Teensy 4.x using SD, LittleFS, etc. with QNEthernet, NativeEthernet, W5x00 with Ethernet_Generic Library or Adafruit Airlift Featherwing using WiFiNINA_Generic Library

License

Notifications You must be signed in to change notification settings

khoih-prog/FTP_Server_Teensy41

Repository files navigation

FTP_Server_Teensy41 Library

arduino-library-badge GitHub release contributions welcome GitHub issues

Donate to my libraries using BuyMeACoffee



Table of contents



Why do we need this FTP_Server_Teensy41 library

Features

This FTP_Server_Teensy41 library is modified from Arduino-Ftp-Server library to support Teensy 4.x with QNEthernet, NativeEthernet, W5x00 using Ethernet_Generic Library or Adafruit Airlift Featherwing using WiFiNINA_Generic Library, and currently SDFat2. In the near future, any FS, such as PSRAM, LittleFS, (Q)SPI Flash, etc. will be supported.


Currently supported Boards

  1. Teensy 4.1 using QNEthernet, NativeEthernet, W5x00 with Ethernet_Generic Library or Adafruit Airlift Featherwing using WiFiNINA_Generic Library and built-in SDCard, etc.
  2. Teensy 4.0 using W5x00 with Ethernet_Generic Library or Adafruit Airlift Featherwing using WiFiNINA_Generic Library


Prerequisites

  1. Arduino IDE 1.8.19+ for Arduino. GitHub release
  2. Teensy core v1.57+ for Teensy 4.1
  3. QNEthernet Library version v0.16.0+ for Teensy 4.1 built-in Ethernet.
  4. NativeEthernet Library version stable111+ for Teensy 4.1 built-in Ethernet.
  5. Ethernet_Generic library v2.7.1+ to use W5x00. To install, check arduino-library-badge
  6. WiFiNINA_Generic library v1.8.15-1+ to use Adafruit Airlift Featherwing. To install, check arduino-library-badge.

Installation

Use Arduino Library Manager

The best and easiest way is to use Arduino Library Manager. Search for FTP_Server_Teensy41, then select / install the latest version. You can also use this link arduino-library-badge for more detailed instructions.

Manual Install

  1. Navigate to FTP_Server_Teensy41 page.
  2. Download the latest release FTP_Server_Teensy41-main.zip.
  3. Extract the zip file to FTP_Server_Teensy41-main directory
  4. Copy the whole FTP_Server_Teensy41-main folder to Arduino libraries' directory such as ~/Arduino/libraries/.

VS Code & PlatformIO:

  1. Install VS Code
  2. Install PlatformIO
  3. Install FTP_Server_Teensy41 library by using Library Manager. Search for FTP_Server_Teensy41 in Platform.io Author's Libraries
  4. Use included platformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at Project Configuration File


Packages' Patches

1. For Teensy boards

To be able to compile and run on Teensy boards, you have to copy the files in Packages_Patches for Teensy directory into Teensy hardware directory (./arduino-1.8.19/hardware/teensy/avr/boards.txt).

Supposing the Arduino version is 1.8.19. These files must be copied into the directory:

  • ./arduino-1.8.19/hardware/teensy/avr/boards.txt
  • ./arduino-1.8.19/hardware/teensy/avr/cores/teensy/Stream.h
  • ./arduino-1.8.19/hardware/teensy/avr/cores/teensy3/Stream.h
  • ./arduino-1.8.19/hardware/teensy/avr/cores/teensy4/Stream.h

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:

  • ./arduino-x.yy.zz/hardware/teensy/avr/boards.txt
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy/Stream.h
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy3/Stream.h
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy4/Stream.h


Original Documents

Please have a look at README_orig.md or README.md



Examples

  1. FTP_Server_SDFAT2
  2. multiFileProject
  3. FTP_Server_SDFAT2_NINA New


#include "defines.h"
#include <SD.h>
#include <SPI.h>
#define PASV_RESPONSE_STYLE_NEW true
#define FTP_FILESYST FTP_SDFAT2
// Default 2048
#define FTP_BUF_SIZE 8192
#define FTP_USER_NAME_LEN 64 // Max permissible and default are 64
#define FTP_USER_PWD_LEN 128 // Max permissible and default are 128
#include <FTP_Server_Teensy41.h>
// Object for FtpServer
// Command port and Data port in passive mode can be defined here
// FtpServer ftpSrv( 221, 25000 );
// FtpServer ftpSrv( 421 ); // Default data port in passive mode is 55600
FtpServer ftpSrv; // Default command port is 21 ( !! without parenthesis !! )
File myFile;
// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
// Teensy audio board: pin 10
// Teensy 3.5 & 3.6 & 4.1 on-board: BUILTIN_SDCARD
// Wiz820+SD board: pin 4
// Teensy 2.0: pin 0
// Teensy++ 2.0: pin 20
const int chipSelect = BUILTIN_SDCARD; //10;
SDClass myfs;
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
/*******************************************************************************
** **
** INITIALISATION **
** **
*******************************************************************************/
#define FTP_ACCOUNT "teensy4x"
#define FTP_PASSWORD "ftp_test"
void initEthernet()
{
#if USE_QN_ETHERNET
Serial.println(F("=========== USE_QN_ETHERNET ==========="));
#elif USE_NATIVE_ETHERNET
Serial.println(F("======== USE_NATIVE_ETHERNET ========"));
#elif USE_ETHERNET_GENERIC
Serial.println(F("======== USE_ETHERNET_GENERIC ========"));
#else
Serial.println(F("======================================="));
#endif
#if USE_NATIVE_ETHERNET
// start the ethernet connection and the server:
// Use DHCP dynamic IP and random mac
uint16_t index = millis() % NUMBER_OF_MAC;
// Use Static IP
//Ethernet.begin(mac[index], ip);
Ethernet.begin(mac[index]);
Serial.print(F("Using mac index = "));
Serial.println(index);
Serial.print(F("Connected! IP address: "));
Serial.println(Ethernet.localIP());
#elif USE_QN_ETHERNET
#if USING_DHCP
// Start the Ethernet connection, using DHCP
Serial.print("Initialize Ethernet using DHCP => ");
Ethernet.begin();
// give the Ethernet shield minimum 1 sec for DHCP and 2 secs for staticP to initialize:
delay(1000);
#else
// Start the Ethernet connection, using static IP
Serial.print("Initialize Ethernet using static IP => ");
Ethernet.begin(myIP, myNetmask, myGW);
Ethernet.setDNSServerIP(mydnsServer);
#endif
if (!Ethernet.waitForLocalIP(5000))
{
Serial.println("Failed to configure Ethernet");
if (!Ethernet.linkStatus())
{
Serial.println("Ethernet cable is not connected.");
}
// Stay here forever
while (true)
{
delay(1);
}
}
else
{
Serial.print("IP Address = ");
Serial.println(Ethernet.localIP());
}
// give the Ethernet shield minimum 1 sec for DHCP and 2 secs for staticP to initialize:
//delay(2000);
#else
FTP_LOGWARN(F("Default SPI pinout:"));
FTP_LOGWARN1(F("MOSI:"), MOSI);
FTP_LOGWARN1(F("MISO:"), MISO);
FTP_LOGWARN1(F("SCK:"), SCK);
FTP_LOGWARN1(F("SS:"), SS);
FTP_LOGWARN(F("========================="));
// unknown board, do nothing, use default SS = 10
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN 10 // For other boards
#endif
#if defined(BOARD_NAME)
FTP_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
#else
FTP_LOGWARN1(F("Unknown board setCsPin:"), USE_THIS_SS_PIN);
#endif
// For other boards, to change if necessary
Ethernet.init (USE_THIS_SS_PIN);
// start the ethernet connection and the server:
// Use DHCP dynamic IP and random mac
uint16_t index = millis() % NUMBER_OF_MAC;
// Use Static IP
//Ethernet.begin(mac[index], ip);
Ethernet.begin(mac[index]);
Serial.print("IP Address = ");
Serial.println(Ethernet.localIP());
#endif
}
void cardInit()
{
// we'll use the initialization code from the utility libraries
// since we're just testing if the card is working!
if (!card.init(SPI_HALF_SPEED, chipSelect))
{
Serial.println("Initialization failed. Things to check:");
Serial.println("* is a card inserted?");
Serial.println("* is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
return;
}
else
{
Serial.println("Wiring is correct and a card is present.");
}
// print the type of card
Serial.print("\nCard type: ");
switch (card.type())
{
case SD_CARD_TYPE_SD1:
Serial.println("SD1");
break;
case SD_CARD_TYPE_SD2:
Serial.println("SD2");
break;
case SD_CARD_TYPE_SDHC:
Serial.println("SDHC");
break;
default:
Serial.println("Unknown");
}
// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
if (!volume.init(card))
{
Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
return;
}
// print the type and size of the first FAT-type volume
uint32_t volumesize;
Serial.print("\nVolume type is FAT"); Serial.println(volume.fatType(), DEC); Serial.println();
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
if (volumesize < 8388608ul)
{
Serial.print("Volume size (bytes): ");
Serial.println(volumesize * 512); // SD card blocks are always 512 bytes
}
Serial.print("Volume size (Kbytes): "); volumesize /= 2; Serial.println(volumesize);
Serial.print("Volume size (Mbytes): "); volumesize /= 1024; Serial.println(volumesize);
}
void printDirectory(File dir, int numSpaces)
{
while (true)
{
File entry = dir.openNextFile();
if (! entry)
{
//Serial.println("** no more files **");
break;
}
printSpaces(numSpaces);
Serial.print(entry.name());
if (entry.isDirectory())
{
Serial.println("/");
printDirectory(entry, numSpaces + 2);
}
else
{
// files have sizes, directories do not
unsigned int n = log10(entry.size());
if (n > 10)
n = 10;
printSpaces(50 - numSpaces - strlen(entry.name()) - n);
Serial.print(" "); Serial.print(entry.size(), DEC);
DateTimeFields datetime;
if (entry.getModifyTime(datetime))
{
printSpaces(4);
printTime(datetime);
}
Serial.println();
}
entry.close();
}
}
void printSpaces(int num)
{
for (int i = 0; i < num; i++)
{
Serial.print(" ");
}
}
void printTime(const DateTimeFields tm)
{
const char *months[12] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
if (tm.hour < 10)
Serial.print('0');
Serial.print(tm.hour);
Serial.print(':');
if (tm.min < 10)
Serial.print('0');
Serial.print(tm.min);
Serial.print(" ");
Serial.print(months[tm.mon]);
Serial.print(" ");
Serial.print(tm.mday);
Serial.print(", ");
Serial.print(tm.year + 1900);
}
void SDCardTest()
{
Serial.println("\n===============================");
Serial.print("SDCard Initialization : ");
if (!SD.begin(chipSelect))
{
Serial.println("failed!");
return;
}
Serial.println("done.");
File root = SD.open("/");
printDirectory(root, 0);
Serial.println("done!");
}
void setup()
{
Serial.begin(115200);
while (!Serial && millis() < 5000);
delay(500);
Serial.print(F("\nStarting FTP_Server_SDFAT2 on ")); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.println(FTP_SERVER_TEENSY41_VERSION);
// Uncomment this if Teensy 4.0 has SD card
#if (defined(ARDUINO_TEENSY41))
Serial.println("Initializing SD card...");
//////////////////////////////////////////////////////////////////
cardInit();
////////////////////////////////////////////////////////////////
SDCardTest();
//////////////////////////////////////////////////////////////////
#endif
initEthernet();
// Initialize the FTP server
ftpSrv.init();
ftpSrv.credentials( FTP_ACCOUNT, FTP_PASSWORD );
Serial.print("FTP Server Credentials => account = "); Serial.print(FTP_ACCOUNT);
Serial.print(", password = "); Serial.println(FTP_PASSWORD);
}
/*******************************************************************************
** **
** MAIN LOOP **
** **
*******************************************************************************/
void loop()
{
ftpSrv.service();
// more processes...
}


2. File defines.h

#ifndef defines_h
#define defines_h
#define TEENSY41_DEBUG_PORT Serial
// Debug Level from 0 to 4
#define _FTP_SERVER_LOGLEVEL_ 1
#if ( defined(CORE_TEENSY) && defined(__IMXRT1062__))
#if (defined(ARDUINO_TEENSY41))
// For Teensy 4.1
#define BOARD_TYPE "TEENSY 4.1"
// Use true for QNEthernet or NativeEthernet Library, and false to use other Ethernet_Generic library
#define USE_QN_ETHERNET true
#define USE_NATIVE_ETHERNET false
#else
// For Teensy 4.0
#define BOARD_TYPE "TEENSY 4.0"
// Use false for QNEthernet and NativeEthernet Library, and to use other Ethernet_Generic library
#define USE_QN_ETHERNET false
#define USE_NATIVE_ETHERNET false
#endif
#else
#error Only Teensy 4.1 supported
#endif
#ifndef BOARD_NAME
#define BOARD_NAME BOARD_TYPE
#endif
// Use true for ENC28J60 and UIPEthernet library (https://github.com/UIPEthernet/UIPEthernet)
// Use false for W5x00 and Ethernetx library (https://www.arduino.cc/en/Reference/Ethernet)
#define USE_UIP_ETHERNET false
#define USE_ETHERNET_GENERIC false
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false
#if USE_QN_ETHERNET
#include "QNEthernet.h" // https://github.com/ssilverman/QNEthernet
using namespace qindesign::network;
//#warning Using QNEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
#define SHIELD_TYPE "QNEthernet"
#elif USE_NATIVE_ETHERNET
#include "NativeEthernet.h"
//#warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
#define SHIELD_TYPE "NativeEthernet"
#elif USE_ETHERNET_GENERIC
#include <SPI.h>
///////////////////////////////////////////////////////////
// W5100 chips can have up to 4 sockets. W5200 & W5500 can have up to 8 sockets.
// Use EthernetLarge feature, Larger buffers, but reduced number of simultaneous connections/sockets (MAX_SOCK_NUM == 2)
#define ETHERNET_LARGE_BUFFERS
//////////////////////////////////////////////////////////
#include "Ethernet_Generic.h"
#if defined(ETHERNET_LARGE_BUFFERS)
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library with Large Buffer"
#else
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library"
#endif
#endif
#if (USE_NATIVE_ETHERNET || USE_ETHERNET_GENERIC)
// Enter a MAC address and IP address for your controller below.
#define NUMBER_OF_MAC 20
byte mac[][NUMBER_OF_MAC] =
{
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 },
};
#else
#define USING_DHCP false //true
#if !USING_DHCP
// Set the static IP address to use if the DHCP fails to assign
IPAddress myIP(192, 168, 2, 241);
IPAddress myNetmask(255, 255, 255, 0);
IPAddress myGW(192, 168, 2, 1);
//IPAddress mydnsServer(192, 168, 2, 1);
IPAddress mydnsServer(8, 8, 8, 8);
#endif
#endif
#endif //defines_h



Debug Terminal Output Samples

1. FTP_Server_SDFAT2 on TEENSY 4.1 with QNEthernet

Following is debug terminal output when running example FTP_Server_SDFAT2 on Teensy4.1 using Built-in Ethernet and QNEthernet Library demonstrate the operation of FTP Server and SD Card using SDFat2.

Starting FTP_Server_SDFAT2 on TEENSY 4.1 with QNEthernet
FTP_Server_Teensy41 v1.2.0
Initializing SD card...
Wiring is correct and a card is present.

Card type: SDHC

Volume type is FAT32

Volume size (Kbytes): 31452672
Volume size (Mbytes): 30715

===============================
SDCard Initialization : done.
test.txt                                      1048702    22:42  April 29, 2022
foo.txt                                            13    00:00  January 1, 1980
datalog.bin                                  41943040    00:00  January 1, 2022
index.htm                                        3810    22:50  April 29, 2022
mydatalog.txt                                      10    22:24  April 9, 2022
edit.htm.gz                                      4116    20:15  March 13, 2022
CanadaFlag_1.png                                41214    20:15  March 13, 2022
CanadaFlag_2.png                                 8311    20:15  March 13, 2022
CanadaFlag_3.jpg                                11156    20:15  March 13, 2022
favicon.ico                                      1150    22:54  April 29, 2022
graphs.js.gz                                     1971    20:15  March 13, 2022
CanadaFlag_2_1.png                               8311    22:52  April 29, 2022
ESP_AT_WM_Lite.txt                               1547    22:51  April 29, 2022
done!

=========== USE_QN_ETHERNET ===========
Initialize Ethernet using static IP => IP Address = 192.168.2.241
FTP Server Credentials => account = teensy4x, password = ftp_test
[FTP]  Ftp server waiting for connection on port  21
[FTP]  Client connected!
USER teensy4x
PASS ftp_test
[FTP]  Authentication Ok. Waiting for commands.
SYST
DELE test.txt
PORT 192,168,2,30,169,133
[FTP]  Data IP set to  192.168.2.30 , Data port set to  43397
LIST
DELE datalog.bin
PORT 192,168,2,30,135,195
[FTP]  Data IP set to  192.168.2.30 , Data port set to  34755
LIST
PORT 192,168,2,30,165,55
[FTP]  Data IP set to  192.168.2.30 , Data port set to  42295
LIST
PORT 192,168,2,30,206,193
[FTP]  Data IP set to  192.168.2.30 , Data port set to  52929
RETR index.htm
[FTP]  Sending  index.htm
PORT 192,168,2,30,182,29
[FTP]  Data IP set to  192.168.2.30 , Data port set to  46621
STOR index1.htm
[FTP]  Receiving  index1.htm
[FTP]  Transfer completed in (ms)  250 , Speed (kbytes/s)  15
QUIT
[FTP]  Disconnecting client
[FTP]  Ftp server waiting for connection on port  21

2. FTP_Server_SDFAT2 on TEENSY 4.1 with NativeEthernet

Following is debug terminal output when running example FTP_Server_SDFAT2 on Teensy4.1 using Built-in Ethernet and NativeEthernet Library demonstrate the operation of FTP Server and SD Card using SDFat2.

Starting FTP_Server_SDFAT2 on TEENSY 4.1 with NativeEthernet
FTP_Server_Teensy41 v1.2.0
Initializing SD card...
Wiring is correct and a card is present.

Card type: SDHC

Volume type is FAT32

Volume size (Kbytes): 31452672
Volume size (Mbytes): 30715

===============================
SDCard Initialization : done.
index1.htm                                       3810    23:11  April 29, 2022
foo.txt                                            13    00:00  January 1, 1980
index.htm                                        3810    22:50  April 29, 2022
mydatalog.txt                                      10    22:24  April 9, 2022
edit.htm.gz                                      4116    20:15  March 13, 2022
CanadaFlag_1.png                                41214    20:15  March 13, 2022
CanadaFlag_2.png                                 8311    20:15  March 13, 2022
CanadaFlag_3.jpg                                11156    20:15  March 13, 2022
favicon.ico                                      1150    22:54  April 29, 2022
graphs.js.gz                                     1971    20:15  March 13, 2022
CanadaFlag_2_1.png                               8311    22:52  April 29, 2022
ESP_AT_WM_Lite.txt                               1547    22:51  April 29, 2022
done!
======== USE_NATIVE_ETHERNET ========
Using mac index = 7
Connected! IP address: 192.168.2.103
FTP Server Credentials => account = teensy4x, password = ftp_test
[FTP]  Ftp server waiting for connection on port  21
[FTP]  Client connected!
USER teensy4x
PASS ftp_test
[FTP]  Authentication Ok. Waiting for commands.
SYST
PORT 192,168,2,30,146,13
[FTP]  Data IP set to  192.168.2.30 , Data port set to  37389
LIST
DELE index1.htm
PORT 192,168,2,30,170,27
[FTP]  Data IP set to  192.168.2.30 , Data port set to  43547
STOR index1.htm
[FTP]  Receiving  index1.htm
[FTP]  Transfer completed in (ms)  2 , Speed (kbytes/s)  1905
QUIT
[FTP]  Disconnecting client
[FTP]  Ftp server waiting for connection on port  21

3. FTP_Server_SDFAT2 on TEENSY 4.0 with W5x00 using Ethernet_Generic Library

Following is debug terminal output when running example FTP_Server_SDFAT2 on Teensy4.0 using W5x00 using Ethernet_Generic Library with Large Buffer.

Starting FTP_Server_SDFAT2 on TEENSY 4.0 with W5x00 using Ethernet_Generic Library with Large Buffer
FTP_Server_Teensy41 v1.2.0
======== USE_ETHERNET_GENERIC ========
[FTP] Default SPI pinout:
[FTP] MOSI: 11
[FTP] MISO: 12
[FTP] SCK: 13
[FTP] SS: 10
[FTP] =========================
[FTP] Board : TEENSY 4.0 , setCsPin: 10
IP Address = 192.168.2.118
FTP Server Credentials => account = teensy4x, password = ftp_test
[FTP]  Ftp server waiting for connection on port  21
[FTP]  Client connected!
USER teensy4x
PASS ftp_test
[FTP]  Authentication Ok. Waiting for commands.
SYST
PORT 192,168,2,30,233,47
[FTP]  Data IP set to  192.168.2.30 , Data port set to  59695
LIST
PORT 192,168,2,30,148,131
[FTP]  Data IP set to  192.168.2.30 , Data port set to  38019


Debug

Debug is enabled by default on Serial. Debug Level from 0 to 4. To disable, change the AWS_TEENSY41_LOGLEVEL to 0

// Use this to output debug msgs to Serial
#define TEENSY41_DEBUG_PORT                 Serial

// Debug Level from 0 to 4
#define _FTP_SERVER_LOGLEVEL_               2

Troubleshooting

If you get compilation errors, more often than not, you may need to install a newer version of Arduino IDE, the Arduino Teensyduino core or depending libraries.

Sometimes, the library will only work if you update the Teensyduino core to the latest version because I'm always using the latest cores /libraries.


Issues

Submit issues to: FTP_Server_Teensy41 issues



TO DO

  1. Fix bug. Add enhancement
  2. Add support to to LittleFS, (Q)SPI Flash, etc. besides SD card.

DONE

  1. Initial porting and coding for Teensy 4.1 using built-in QNEthernet, NativeEthernet or W5x00 using Ethernet_Generic Library
  2. Support SD card and SDFat1, SDFat2
  3. Add debugging features.
  4. Add Table-of-Contents and Version String
  5. Fix bug incomplete downloads from server to client
  6. Add support to WiFiNINA, such as Adafruit Airlift Featherwing
  7. Configurable user_name length to max 63 and user_password to max 127


Contributions and Thanks

  1. Based on and modified from Jean-Michel Gallego's Arduino-Ftp-Server library
  2. Thanks to Warren Watson to make PR in Incomplete downloads from server to client. #2 leading to the new version v1.1.0 to fix bug incomplete downloads from server to client
  3. Thanks to davekc to post issue in Setting FTP_CRED_SIZE on the fly like with FTP_BUF_SIZE #4 leading to the new version v1.2.0 to have configurable user_name length to max 63 and user_password to max 127
gallegojm
⭐️ Jean-Michel Gallego

wwatson4506
Warren Watson

davekc
davekc


Contributing

If you want to contribute to this project:

  • Report bugs and errors
  • Ask for enhancements
  • Create issues and pull requests
  • Tell other people about this library

License

  • The library is licensed under GPLv3

Copyright

  • Copyright (c) 2014- Jean-Michel Gallego
  • Copyright (c) 2022- Khoi Hoang