- Table of contents
- Why do we need this FTP_Server_Teensy41 library
- Changelog
- Prerequisites
- Installation
- Packages' Patches
- Original Documents
- Examples
- Example FTP_Server_SDFAT2
- Debug Terminal Output Samples
- Debug
- Troubleshooting
- Issues
- TO DO
- DONE
- Contributions and Thanks
- Contributing
- License
- Copyright
Why do we need this FTP_Server_Teensy41 library
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.
- Teensy 4.1 using QNEthernet, NativeEthernet, W5x00 with Ethernet_Generic Library or Adafruit Airlift Featherwing using WiFiNINA_Generic Library and built-in SDCard, etc.
- Teensy 4.0 using W5x00 with Ethernet_Generic Library or Adafruit Airlift Featherwing using WiFiNINA_Generic Library
Arduino IDE 1.8.19+
for Arduino.Teensy core v1.57+
for Teensy 4.1QNEthernet Library version v0.16.0+
for Teensy 4.1 built-in Ethernet.NativeEthernet Library version stable111+
for Teensy 4.1 built-in Ethernet.Ethernet_Generic library v2.7.1+
to use W5x00. To install, checkWiFiNINA_Generic library v1.8.15-1+
to use Adafruit Airlift Featherwing. To install, check .
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 for more detailed instructions.
- Navigate to FTP_Server_Teensy41 page.
- Download the latest release
FTP_Server_Teensy41-main.zip
. - Extract the zip file to
FTP_Server_Teensy41-main
directory - Copy the whole
FTP_Server_Teensy41-main
folder to Arduino libraries' directory such as~/Arduino/libraries/
.
- Install VS Code
- Install PlatformIO
- Install FTP_Server_Teensy41 library by using Library Manager. Search for FTP_Server_Teensy41 in Platform.io Author's Libraries
- 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
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
Please have a look at README_orig.md or README.md
Example FTP_Server_SDFAT2
1. File FTP_Server_SDFAT2.ino
FTP_Server_Teensy41/examples/FTP_Server_SDFAT2/FTP_Server_SDFAT2.ino
Lines 10 to 373 in edc4cff
2. File defines.h
FTP_Server_Teensy41/examples/FTP_Server_SDFAT2/defines.h
Lines 10 to 126 in edc4cff
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
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
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 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
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.
Submit issues to: FTP_Server_Teensy41 issues
- Fix bug. Add enhancement
- Add support to to
LittleFS
, (Q)SPI Flash, etc. besides SD card.
- Initial porting and coding for Teensy 4.1 using built-in QNEthernet, NativeEthernet or W5x00 using Ethernet_Generic Library
- Support SD card and
SDFat1
,SDFat2
- Add debugging features.
- Add Table-of-Contents and Version String
- Fix bug incomplete downloads from server to client
- Add support to
WiFiNINA
, such asAdafruit Airlift Featherwing
- Configurable
user_name
length to max 63 anduser_password
to max 127
- Based on and modified from Jean-Michel Gallego's Arduino-Ftp-Server library
- 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 - 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 configurableuser_name
length to max 63 anduser_password
to max 127
⭐️ Jean-Michel Gallego |
Warren Watson |
davekc |
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
- The library is licensed under GPLv3
- Copyright (c) 2014- Jean-Michel Gallego
- Copyright (c) 2022- Khoi Hoang