airlift websrver problems with big transfers

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
SJM_MCL
 
Posts: 8
Joined: Sun Apr 23, 2023 1:24 pm

airlift websrver problems with big transfers

Post by SJM_MCL »

Hi, I'm using an esp32 AirLift breakout board with a Teensy4.1 on Arduino. The AP_SimpleWebServer sketch worked perfectly (once I moved the LED to a differenet GPIO) and is a perfect starting point for my application - which is to serve a jpg file from an SD-card to a web client. When I modified the code to send a 2MB jpg file instead of the 2-line static text I ran into reliability problems. The server is never able to send the whole file, the connection always fails at some random point, leaving a partial or corrupted image on the client screen.

Code: Select all

            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:image/jpeg");
            client.println();

            // open the file for read. 
            srcFile = SD.open("/DCIM/100DSCIM/DSC04656.JPG");
            if (!srcFile) Serial.println("no src");
            Serial.println("sending JPG...");
            while((rdlen > 0) && (wrlen > 0))
             {
              n++;
              rdlen = srcFile.read(buf, 1024);
              wrlen = client.write(buf, rdlen);
             }
            Serial.print("\r\n");
            Serial.print("[ ");
            Serial.print(rdlen); Serial.print("  ");
            Serial.print(wrlen); Serial.print("  ");
            Serial.print(n); Serial.println(" ]");

            srcFile.close();
Any ideas? Any more info required? Many thanks for your time.

User avatar
SJM_MCL
 
Posts: 8
Joined: Sun Apr 23, 2023 1:24 pm

Re: airlift websrver problems with big transfers

Post by SJM_MCL »

So eventually I checked the AirLift firmware version:

Code: Select all

WiFiNINA firmware check.
Firmware version installed: 1.2.2
Latest firmware version available : 1.5.0
Check result: NOT PASSED
 - The firmware version on the module does not match the version required by the library, you may experience issues or failures.
Will re-post once I've updated it.

User avatar
SJM_MCL
 
Posts: 8
Joined: Sun Apr 23, 2023 1:24 pm

Re: airlift websrver problems with big transfers

Post by SJM_MCL »

So my AirLift firmware is now at v1.7.4 and sadly there's no change.
BTW I also tried decoupling the AirLift's power supplies with a 10uF tant cap, upping the power-supply currentl limit to 1Amp (it never reads more than 250mA), slowing down the SPI clock speed (to 4 and 2MHz), trying different SPI_MODEs (only MODE0 works), loading the SPI_CLK pin with a 47pF cap, or loading the MISO/MOSI pins with 47pF caps, I also got hold of the latest WiFiNINA library (not the Adafruit one, the original - v1.8.14) and hacked it to work with my Teensy's pin configuration, I tried using different buffer sizes when writing data blocks to the client (64B & 8192B stopped it pretty much dead, other sizes in between had marginal effects on how the broken image looked) but NONE of the above had any significant effect on the problem - the whole image never makes it through, and the bits of image that do always look broken or corrupted, and always in different random ways.
I am now seriously struggling - any help or ideas very much apreciated. Thanks for reading this far.

User avatar
SJM_MCL
 
Posts: 8
Joined: Sun Apr 23, 2023 1:24 pm

Re: airlift websrver problems with big transfers

Post by SJM_MCL »

I also found a v1.7.5 airlift firmware: no difference!

User avatar
SJM_MCL
 
Posts: 8
Joined: Sun Apr 23, 2023 1:24 pm

Re: airlift websrver problems with big transfers

Post by SJM_MCL »

To anyone else having similar problems with the Airlift: dump it! Get yourself a ATWINC1500 and use the old Wifi101 library - it works like a charm.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”