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

@wwatson
Was just going through that myself and just trying to fake it out but then getting other issues. Going to revert to what you did and give it a try.
 
@wwatson
Was just going through that myself and just trying to fake it out but then getting other issues. Going to revert to what you did and give it a try.

Yeah, I am not sure if I have missed something in defines that is not set properly or what. Still looking...
 
Ok was able to duplicate the Filezilla connection with waiting for welcome message. Anyway if you turn on debug you get this from handleFTP:
Code:
SD opened!
NOT ANONYMOUS
esp8266
  Command Old: 0  Transfer Old: 0  Data Old: 0
  Command    : 1  Transfer    : 0  Data    : 0
 Ftp server waiting for connection on port 21
  Command Old: 1  Transfer Old: 0  Data Old: 0
  Command    : 2  Transfer    : 0  Data    : 0
where
Code:
enum ftpCmd { FTP_Stop = 0,       //  In this stage, stop any connection
              FTP_Init,           //  initialize some variables
              FTP_Client,         //  wait for client connection
              FTP_User,           //  wait for user name
              FTP_Pass,           //  wait for user password
              FTP_Cmd };          //  answers to commands
 
The WiFiNINA Library is still buggy and is slowed to accept good PRs.

I don't have the same hardware to test, but think FTPServer has issue with current version of WiFiNINA.

Check Using WIFI-NINA with FtpServer; no accept() and PR added server.accept() #204

Try using @JAndrassy forked WiFiNINA at WiFiNINA with server_accept with the updated NINA_W102.zip in post #31

Thanks for the tip. Unfortunately since we are using the ESP32 airlift as a coprocessor can not use the arduino library directly. However with that said I took the update for accept and brought it over to the Adafruit WifiNINA library. Fairly easy since both are almost the same. However, It did get better but still having some disconnects (pardon the pun). It a least connects now but is continually connecting and disconnecting and as before filezilla is timing out.

Code:
SD opened!
>>>>>>>>>>>>>>> _callback 0 1 1
CONNECTED
>>>>>>>>>>>>>>> _callback 1 1 1
DISCONNECTED
>>>>>>>>>>>>>>> _callback 0 1 1
CONNECTED
>>>>>>>>>>>>>>> _callback 1 1 1
DISCONNECTED
>>>>>>>>>>>>>>> _callback 0 1 1
CONNECTED


In p#31 it shows an updated WifiNINA firmware change but not sure what version that corresponds to, however I did run the firmware verstion check and found:
Code:
WiFiNINA firmware check.

Firmware version installed: 1.2.2
Latest firmware version available : 1.2.1

Check result: PASSED

Not sure if I should go ahead and update to that firmware version?
 
The WiFiNINA Library is still buggy and is slowed to accept good PRs.

I don't have the same hardware to test, but think FTPServer has issue with current version of WiFiNINA.

Check Using WIFI-NINA with FtpServer; no accept() and PR added server.accept() #204

Try using @JAndrassy forked WiFiNINA at WiFiNINA with server_accept with the updated NINA_W102.zip in post #31

I ran out of time this weekend to do anymore with this. I checked the version of NINA on the Adafruit Airlift FeatherWIng I have. It is version 1.2.2. I also have an Adafruit ESP32 WROOM that I loaded up with NINA firmware from Adafruit. So far it won't connect to the T4.1. I am not sure if the pinouts on both boards are the same. Next chance I get I will load it up with NINA_W102 and try to get it to work.

Thanks for the info:)

@mjs513 - Beat me to it:)
 
@mjs513,

It's great you made some good progress. I think you have to update the firmware to sync with the library fix. Please post on Adafruit Forum or ask @JAndrassy how to update the firmware for Adafruit Airlift FeatherWing, even I think you can use the same firmware update utility FirmwareUpdater

You can also try my WiFiNINA_Generic library and modify the file WiFiNINA_Pinout_Generic.h to match the pins for Adafruit Airlift FeatherWing.

The mods for some Adafruit boards from line #251-#268

Code:
    #elif ( defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE) || defined(ADAFRUIT_PYBADGE_AIRLIFT_M4) )
    
      #warning ADAFRUIT_METRO_M4_AIRLIFT_LITE or ADAFRUIT_PYBADGE_AIRLIFT_M4 are OK to use
      
    #elif ( defined(ADAFRUIT_MATRIXPORTAL_M4_EXPRESS)  )  
      
      #warning You have to modify pin usage according to actual connection for SAMD51 ADAFRUIT_MATRIXPORTAL_M4_EXPRESS
      // To define pin out for WiFiNINA here


      //#define PINS_COUNT           (60u)
      //NINA     
      #define NINA_GPIO0      ESP32_GPIO0
      #define NINA_RESETN     ESP32_RESETN
      #define NINA_ACK        SPIWIFI_ACK


      #define SPIWIFI_SS      33
      #define SPIWIFI_ACK     31
      #define SPIWIFI_RESET   ESP32_RESETN
 
@khoih-prog
Thanks for the help with this. Yep saw that but shied away from it because of the minor changes to the core files for the Teensy - with the updates coming up didn't want to start moding the core (yes I have done it before).

Was just doing a bit of checking on the adafruit forum and found this reference to the updated firmware: https://forums.adafruit.com/viewtopic.php?f=8&t=189539&p=917334&hilit=wifinina#p917470, so yep will update the firmware to the one included in the p#31. But a bit out of time today as @wwatson said so will probably be tomorrow before I try it - there are instructions on how to do that for the adafruit coprocessor out there.

Thanks again
 
I ran out of time this weekend to do anymore with this. I checked the version of NINA on the Adafruit Airlift FeatherWIng I have. It is version 1.2.2. I also have an Adafruit ESP32 WROOM that I loaded up with NINA firmware from Adafruit. So far it won't connect to the T4.1. I am not sure if the pinouts on both boards are the same. Next chance I get I will load it up with NINA_W102 and try to get it to work.

Thanks for the info:)

@mjs513 - Beat me to it:)

Just pushed up a branch (accept) that adds that function to the adafruit library if interested: https://github.com/mjs513/WiFiNINA/tree/accept
 
Just pushed up a branch (accept) that adds that function to the adafruit library if interested: https://github.com/mjs513/WiFiNINA/tree/accept

The accept branch as well as many other PRs have been merged into WiFiNINA_Generic v1.8.14-4 so that you can use conveniently.

### Releases v1.8.14-4

1. Fix bugs by using some unmerged PRs from original WiFiNINA, such as:

- [WiFi.config - setting defaults as the Ethernet library #219](https://github.com/arduino-libraries/WiFiNINA/pull/219)
- [Fix WiFiClient watchdog usage #211](https://github.com/arduino-libraries/WiFiNINA/pull/211)
- [Watchdog trigger changes #208](https://github.com/arduino-libraries/WiFiNINA/pull/208)
- [added server.accept() #204](https://github.com/arduino-libraries/WiFiNINA/pull/204)
- [Fix PinStatus error on some platforms #185](https://github.com/arduino-libraries/WiFiNINA/pull/185)

2. Add many WiFiMulti-related examples in [WiFiMulti](https://github.com/khoih-prog/WiFiNINA_Generic/tree/master/examples/WiFiMulti)
3. Update examples
4. Update `Packages' Patches`
 
how does the FTP library even compile with WiFiNINA? Arduino WiFiNINA and the Adafruit fork don't have server.accept().

esp8266 and esp32 server.available() works as (EthernetServer).accept(), but available() in WiFiNINA only returns a Client with data available as the Arduino API specified it. but in FTP the server has to start the communication.

EDIT: there is some patch in the SimpleFtpServer library for WiFiNINA to compile, but of course it doesn't work.

accept() was introduced by Paul in 2018 for Ethernet 2.00.
My PR to add accept() to WiFiNINA is not merged yet.
 
Last edited:
wwatson,
You certainly have gotten farther than I have. I will make the changes you made and see what effect that has on my project and let you know the results.

Thanks for helping out with this project. I've been stuck at this point for over 6 months. :) - I'm an idiot!
 
wwatson,
You certainly have gotten farther than I have. I will make the changes you made and see what effect that has on my project and let you know the results.

Thanks for helping out with this project. I've been stuck at this point for over 6 months. :) - I'm an idiot!

To be honest, @mjs513 got further with it. Check posts #30 on. Nobody is an idiot:) They just need more information and time to gather that information. I usually don't have time during the week to play with this stuff. But on the weekends... Unless there are lots of requests from the other half:)
 
just to be clear. no official firmware build has support for server.accept(). My PR from January is not merged yet in the Arduino/nina-fw repository. The change in WiFiNINA library will not work without new firmware build with accept() support for the AirLift
 
just to be clear. no official firmware build has support for server.accept(). My PR from January is not merged yet in the Arduino/nina-fw repository. The change in WiFiNINA library will not work without new firmware build with accept() support for the AirLift

Yep -- I noticed that the PR is still hanging out there. Not sure why they haven't incorporated yet. And yes it doesn't work without the firmware update to the airlift. Unfortunately we haven't been able to get the Airlift into a mode where it we could update the firmware which is annoying. We have a help request into Adafruit identifing the issue but haven't got a response yet - but we are still playing.
 
I updated the firmware from Arduino IDE with the Nina firmware updater from the Tools menu (with some existing fw version replaced with the patched version).
esptool.py over the SerialNINAPassthrough sketch in the main MCU worked too.
 
I updated the firmware from Arduino IDE with the Nina firmware updater from the Tools menu (with some existing fw version replaced with the patched version).
esptool.py over the SerialNINAPassthrough sketch in the main MCU worked too.

Will give it a try - but it strange @KurtE and I are both having issues with the esptooly and the SerialPassthrough.
 
It wont talk...

...


I wonder what the state of all of the IO pins needs to be for it to talk...
 
NinaSerial has to be the Serial interface wired to the esp32 Serial0 pins.
NINA_GPIO0 has to be the pin wired to io 0 of the esp32 and
NINA_RESETN should be the pin number of the pin wired to esp32 reset.

other option is not use other MCU and the sketch, but to use a 'FTDI' and put the esp32 into flashing mode manually (io 0 low at reset)

https://forum.arduino.cc/t/ublox-nina-minimum-pins/576351/2
 
Note: On mine I tried the FirmwareUpdater... Changed the IO pins to match what was shown.

And it still goes: Unable to communicate with ESP32 boot ROM!
 
NinaSerial has to be the Serial interface wired to the esp32 Serial0 pins.
NINA_GPIO0 has to be the pin wired to io 0 of the esp32 and
NINA_RESETN should be the pin number of the pin wired to esp32 reset.

other option is not use other MCU and the sketch, but to use a 'FTDI' and put the esp32 into flashing mode manually (io 0 low at reset)

https://forum.arduino.cc/t/ublox-nina-minimum-pins/576351/2

Sorry was distracted trying different options so the only option that hasn't been tried is what you just suggested, acutally 2, try different processor and use a FTDI and put it in manually. As Kurt mentioned just doesn't talk through the T4. But now off to do a few other things not computer related.
 
Sorry was distracted trying different options so the only option that hasn't been tried is what you just suggested, acutally 2, try different processor and use a FTDI and put it in manually. As Kurt mentioned just doesn't talk through the T4. But now off to do a few other things not computer related.

I have not tried this either, although I did use the Teensy USBToSerial sketch and tried setting up different IO pins in different states and never got it to talk...
I hacked up a version of it to try different states for different pins...
Code:
/* USB to Serial - Teensy becomes a USB to Serial converter
   http://dorkbotpdx.org/blog/paul/teensy_as_benito_at_57600_baud

   You must select Serial from the "Tools > USB Type" menu

   This example code is in the public domain.
*/

// set this to the hardware serial port you wish to use
#define HWSERIAL Serial1

unsigned long baud = 115200;
const int reset_pin = 2;
const int led_pin = 13; 

const int ESP32_BUSY_PIN = 5;  // a.k.a BUSY or READY pin
const int ESP32_GPIO0_pin = 6;
const int ESP32_CS_PIN = 10;


void setup()
{
  pinMode(led_pin, OUTPUT);
  digitalWrite(led_pin, LOW);
  pinMode(ESP32_CS_PIN, OUTPUT);
  digitalWrite(ESP32_CS_PIN, LOW);

  pinMode(reset_pin, OUTPUT);
  digitalWrite(reset_pin, HIGH);
  
  pinMode(ESP32_GPIO0_pin, INPUT_PULLDOWN);
  digitalWrite(ESP32_GPIO0_pin, HIGH);
  pinMode(ESP32_BUSY_PIN, INPUT_PULLDOWN);
  
  while(!Serial && millis() < 3000) ; // wait for serial port.

//  Serial.begin(baud);	// USB, communication to PC or Mac
  HWSERIAL.begin(baud);	// communication to hardware serial

  // See if we can get into some form of bootloader.  Let see if dual button like:
  EchoSerToUSB(0);
  //digitalWrite(ESP32_GPIO0_pin, LOW);
  //delay(250);
  //EchoSerToUSB(1);
  digitalWrite(reset_pin, LOW);
  delay(250);
  EchoSerToUSB(2);
  digitalWrite(reset_pin, HIGH);
  delay(250);
  digitalWrite(reset_pin, LOW);
  delay(250);
  EchoSerToUSB(2);
  digitalWrite(reset_pin, HIGH);
  delay(250);
  EchoSerToUSB(3);
  //digitalWrite(ESP32_GPIO0_pin, HIGH);
  
}

long led_on_time=0;
byte buffer[512];
unsigned char prev_dtr = 0;

void loop()
{
  unsigned char dtr;
  int rd, wr, n;

  // check if any data has arrived on the USB virtual serial port
  rd = Serial.available();
  if (rd > 0) {
    // check if the hardware serial port is ready to transmit
    wr = HWSERIAL.availableForWrite();
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > sizeof(buffer)) rd = sizeof(buffer);
      // read data from the USB port
      n = Serial.readBytes((char *)buffer, rd);
      // write it to the hardware serial port
      HWSERIAL.write(buffer, n);
      // turn on the LED to indicate activity
      digitalWrite(led_pin, HIGH);
      led_on_time = millis();
    }
  }

  // check if any data has arrived on the hardware serial port
  rd = HWSERIAL.available();
  if (rd > 0) {
    // check if the USB virtual serial port is ready to transmit
    wr = Serial.availableForWrite();
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > sizeof(buffer)) rd = sizeof(buffer);
      // read data from the hardware serial port
      n = HWSERIAL.readBytes((char *)buffer, rd);
      // write it to the USB port
      Serial.write(buffer, n);
      // turn on the LED to indicate activity
      digitalWrite(led_pin, HIGH);
      led_on_time = millis();
    }
  }

#if 0
  // check if the USB virtual serial port has raised DTR
  dtr = Serial.dtr();
  if (dtr && !prev_dtr) {
    digitalWrite(reset_pin, LOW);
    delayMicroseconds(250);
    digitalWrite(reset_pin, HIGH);
  }
  prev_dtr = dtr;
#endif

  // if the LED has been left on without more activity, turn it off
  if (millis() - led_on_time > 3) {
    digitalWrite(led_pin, LOW);
  }

  // check if the USB virtual serial wants a new baud rate
  if (Serial.baud() != baud) {
    baud = Serial.baud();
    if (baud == 57600) {
      // This ugly hack is necessary for talking
      // to the arduino bootloader, which actually
      // communicates at 58824 baud (+2.1% error).
      // Teensyduino will configure the UART for
      // the closest baud rate, which is 57143
      // baud (-0.8% error).  Serial communication
      // can tolerate about 2.5% error, so the
      // combined error is too large.  Simply
      // setting the baud rate to the same as
      // arduino's actual baud rate works.
      HWSERIAL.begin(58824);
    } else {
      HWSERIAL.begin(baud);
    }
  }
}

void EchoSerToUSB(uint8_t trace_num) {
  int rd, wr, n;
  // check if any data has arrived on the hardware serial port
  rd = HWSERIAL.available();
  if (rd > 0) {
    Serial.printf("@@%u %d\n", trace_num, rd);
    // check if the USB virtual serial port is ready to transmit
    wr = Serial.availableForWrite();
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > sizeof(buffer)) rd = sizeof(buffer);
      // read data from the hardware serial port
      n = HWSERIAL.readBytes((char *)buffer, rd);
      // write it to the USB port
      Serial.write(buffer, n);
      // turn on the LED to indicate activity
      digitalWrite(led_pin, HIGH);
      led_on_time = millis();
    }
  }
}

Currently trying sort of double click of reset

Also have code in it to see where it may be getting input from the ESP...
Output shows:
Code:
@@2 63
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x12 (@@3 63
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x12

So the double click actually returned the same message on each click...

I figure there may be some special state that:
BUSY, GPIO0, RESET pins need to be in and/or on/off or off/on...
and maybe CS ?

Again not sure, but nothing is talking...
 
Quick update: I was able to update, the firmware using FTDI cable... Have not tried running it yet since it updated, but:
Hooked up power, gnd, TX/RX, RX/TX, GPI0 to gnd, and I momentarily connected RST to GND...

Code:
C:\Users\kurte>esptool.py --port COM61 --before no_reset --baud 115200 write_flash 0 downloads\NINA_W102-1.7.4.bin
esptool.py v3.3
Serial port COM61
WARNING: Pre-connection option "no_reset" was selected. Connection may fail if the chip is not in bootloader or flasher stub mode.
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: a4:cf:12:61:95:60
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x0011afff...
Compressed 1159168 bytes to 633594...
Wrote 1159168 bytes (633594 compressed) at 0x00000000 in 56.4 seconds (effective 164.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Ran the firmware check program
Code:
Start WiFiNINA CheckFirmwareVersion on TEENSY 4.1/4.0
WiFiNINA_Generic v1.8.14-4
Firmware version installed: 1.7.4
Latest firmware version available : 1.4.8

Check result: PASSED
 
Last edited:
Back
Top