You are reading a single comment by @Pinnchus and its replies. Click here to read the full conversation.
  • Hello everybody,
    I tried with different versions of firmware (2.04) and have every time the same issue:

    Uncaught InternalError: Failed! mbedtls_ssl_setup: Not enough memory
    
    >process.env
    ={
      VERSION: "2v04",
      GIT_COMMIT: "3956264e",
      BOARD: "ESP32",
      FLASH: 0, RAM: 524288,
      SERIAL: "240ac40a-ef84",
      CONSOLE: "Serial1",
      MODULES: "Flash,Storage,hea" ... "r,crypto,neopixel",
      EXPTR: 1073484860 }
    >process.memory()
    ={ free: 2267, usage: 33, total: 2300, history: 10,
      gc: 0, gctime: 1.86 }
    >WARNING: Scan stop failed
    WARNING: set rssi scan not implemeted yet
    

    Code Testing:

    var ssid = "******";
    var password = "*****";
    var port = 80;
    var wifi = require('Wifi');
    console.log("started");
    wifi.connect(ssid, {password: password}, function() {
        console.log('Connected to Wifi.  IP address is:', wifi.getIP().ip);
        var http = require('http');
        http.get("https://www.google.com", function(res) {
          res.on('data', function(data) {
            console.log(data);
          });
        });
        // wifi.save(); // Next reboot will auto-connect
    });
    

    Full Error:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >started
    ERROR: Wifi: event_handler STA_START: esp_wifi_connect: 12298(SSID is invalid)
    WARNING: Wifi:startMDNS - espressif
    Connected to Wifi.  IP address is: 192.168.2.54
    Uncaught InternalError: Failed! mbedtls_ssl_setup: Not enough memory
     at line 13 col 6
        });
         ^
    in function called from system
    

    Any help will be appreciated

    Regards, pinnchus

  • Sat 2019.12.21

    Good morning @Pinnchus, while I've chosen not to provide support for non official supported boards, I commend you on the structure of your request. Providing that detail is what is necessary for others to grasp what is going on.

    In the mean time, some thoughts. . . .

    Is there any additional detail spelled out in the console dump?
    WebIDE >> Settings >> Console

    From the error 'mbedtls_ssl_setup' for memory requirements, I'm not sure https is supported for the ESP32. Could it be the 's' in L9?

    See forum post HTTPS on ESP32

    Are any of the other WiFi functions returning valid detail after L7 but before L8? I ran into a situation a year ago and the others walked me through that.

    See forum post STA or AP mode browser

    See forum post SSL on ESP32



    EDIT:
    Had an Espruino Wifi lying around to check for memory size/usage.

    The second 'Code Testing' snippet, while it doesn't run without error (it does when I strip out L7-L13 -- callback missing perhaps?), doesn't appear to use but a quarter of available memory. So should be good for the ESP32

    EDIT: See last snippet in this post #2 and note an add'l ~1000+ JsVars are required for the 'http' require section. So I retract the above last sentence. Most likely will fail.

    >process.memory()
    ={ free: 6543, usage: 605, total: 7148, history: 50,
      gc: 292, gctime: 7.61032104492, "stackEndAddress": 536991644, flash_start: 134217728, "flash_binary_end": 460040,
      "flash_code_start": 134283264, flash_length: 524288 }
    >
    
    >process.env
    ={
      VERSION: "2v04",
      GIT_COMMIT: "3956264e",
      BOARD: "ESPRUINOWIFI",
      FLASH: 524288, RAM: 131072,
      SERIAL: "3d003100-0b513532-39333638",
      CONSOLE: "USB",
      MODULES: "Flash,Storage,hea" ... ",neopixel,Wifi,AT",
      EXPTR: 536871212 }
    > 
    

    Did a quick sanity test using the first example at Connecting to an AP as run time errors occurred using the above snippet, and that ran without fail. Maybe the subtle code line differences will assist in locating the error in your particular case.

     2v04 (c) 2019 G.Williams
    >
    Connected!
    Response:  httpCRs: { "hdrs": true,
      "headers": {
        "Date": "Sat, 21 Dec 2019 15:55:20 GMT",
        "Server": "Apache/2.4.18 (Ubuntu)",
        "Last-Modified": "Fri, 15 Nov 2013 15:42:26 GMT",
        "ETag": "\"d-4eb390b887c80\"",
        "Accept-Ranges": "bytes",
        "Content-Length": "13",
        "Connection": "close",
        "Content-Type": "text/plain"
       },
      "cRcv": 0,
      "httpVersion": "1.1",
      "statusCode": "200",
      "statusMessage": "OK"
     }
    --->Hello World!
    > 
    



    EDIT:
    Remove L7 and it works on an Espruino Wifi

     2v04 (c) 2019 G.Williams
    >started
    Connected to Wifi
    <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more
    . Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/goo­gleg_standard_color_128dp.png" itemprop="image"
    > 
    

    But, look at the usage

    >process.memory()
    ={ free: 5414, usage: 1734, total: 7148, history: 69,
      gc: 712, gctime: 8.23497772216, "stackEndAddress": 536991644, flash_start: 134217728, "flash_binary_end": 460040,
      "flash_code_start": 134283264, flash_length: 524288 }
    > 
    

    My S.W.A.G. guess is that the ESP32 doesn't have sufficient memory with less than ~400JsVars remaining for Espruino housekeeping. The Wifi has nearly three times. Maybe build a custom .hex to flash?

    also see post #6   SSL on ESP32
    ~600K+ data returned - won't fly

About

Avatar for Pinnchus @Pinnchus started