-
Thanks Gordon. Seeing a partial fix with 1v90; but now there's a clear memory leak.
I updated with 1v90.
I also soldered a 10uF ceramic capacitor between Vcc and GND on the ESP8266 Wifi Module.Adding process.memory() to the code the leak is clearly visible. It makes about 15 require("http").get() calls before it's out of memory. I then see ERROR: Out of memory! followed by ERROR: Error processing Serial data handler - removing it.
Here's the code I used:
var tries=0; function onInit() { digitalWrite(B9,1); // enable on Pico Shim V2 Serial2.setup(115200, { rx: A3, tx : A2 }); var wifi = require("ESP8266WiFi_0v25").connect(Serial2, function(err) { if (err) throw err; wifi.reset(function(err) { if (err) throw err; console.log("Connecting to WiFi"); wifi.connect("SSID","password", function(err) { if (err) throw err; console.log("Connected"); setInterval(function () { require("http").get("http://www.espruino.com", function(res) { }); console.log("Attempt #" + ++tries); console.log(process.memory()); }, 15000); }); }); }); } onInit();
It's leaking 100-200 with each call. Oddly, it's not constant.
Any idea where the leak is?
-
Ok, ran some tests over the last few days:
1) I'm using firmware 1v89.
2) With the 15-second interval the interpreter is unresponsive when connected via USB and there are no error messages.
3) I retried with a one-hour interval and the results are the same.
4) Even the number of attempts are the same before it locks up: google.com still makes 8 attempts and locks up, espruino.com makes only 4. Same JS code as above, only changed the interval.
5) I added another interval to blink an LED every couple seconds to see if the results change when connecting to a simple power-only USB vs. a PC's USB: eventually the LED stops blinking, indicating the lock ups are still occurring.I can certainly solder a cap between Vcc and GND, but I'm seeing a clear correspondence between the website and the number of require("http").get() calls before failure. This leads me to believe it's a problem in the software reading data rather than hardware. But what's different about the website data eludes me (nasa.gov's homepage has much more data than google.com but espruino makes more successful .get() calls before locking up...)
Does websockets use different underlying routines? I remember you saying to try websockets when I made 4 calls a second; can you tell me why?
Thanks,
Neil
-
Hi Gordon, thanks for getting back to me so quickly.
I only reduced the interval to 250ms to quickly illustrate the problem BUT I think what I've done is created a new one (and obscured the still-present issue.)
Increase the interval to 15000 (15 seconds) and you'll see the real issue: the Espruino locks up after a few attempts and no longer makes the require("http") call.
My project only demands a one-hour interval but that's a long time to wait to see it lock up. The same lock-ups appear with a 15-second interval, occuring on two Espruino/ESP8266 boards I soldered up. (They still respond to pings for some reason...)
And different websites fail after a different number of attempts, but are consistent for each site (google.com always fails with 8 tries, espruino.com always with 4):
google.com: 8 attempts
espruino.com 4 attempts
travelocity.com 20 attempts
youtube.com 22 attempts
nasa.gov 23 attemptsI hope this helps.
Thanks,
-Neil -
My code needs to load a web page multiple times. But after a few successful http calls it fails with "Uncaught Error: No free sockets".
I've removed my project-specific code to provide the simplest example of this error:
var tries=0; function onInit() { digitalWrite(B9,1); // enable on Pico Shim V2 Serial2.setup(115200, { rx: A3, tx : A2 }); var wifi = require("ESP8266WiFi_0v25").connect(Serial2, function(err) { if (err) throw err; wifi.reset(function(err) { if (err) throw err; console.log("Connecting to WiFi"); wifi.connect("SSID","password", function(err) { if (err) throw err; console.log("Connected"); setInterval(function () { require("http").get("http://www.google.com", function(res) { }); console.log("Attempt #" + ++tries); }, 250); }); }); }); } onInit();
Google.com is simply an example; it fails with any website.
When running the code you'll see the number of attempts increment until it fails around #7 or #8. Apparently the require("http") call generates it. Oddly, changing the interval from 250 to something larger generates different errors but the end result is the same: the Espruino freezes.
I really need this to work as there is no workaround. Can anyone provide some guidance?
Thanks,
-Neil
-
-
-
Thanks for your response. Your post was actually quite helpful. I discovered powercycling is a must when working with the ESP8266. After each failed flash the Espruino MUST be removed and reinserted or it won't properly connect and the Web IDE will ignore everything I type in the left edit screen. My ESP-01 however only produces one blue flash when put in bootloader mode. And I did erase using esptool.py but it didn't seem to be required to flash. What WAS required was dozens of attempts to finally get to 100% complete. Other forums suggested this very thing.
Beyond that I noticed the Espruino is very finicky about its USB slot, and after trying multiple computers only one slot in one PC recognized it. But what seemed to finally work was applying some physical pressure while flashing. Could be coincidence but after nearly 30 tries the flash worked flawlessly when I applied some finger pressure, pushing it down and into the USB slot.
Has anyone else noticed these eccentricities?
-
I have Espruino Pico with the v2. shim and ESP8266 soldered. When plugged into my USB the ESP8266 LED lights red. And when I check the installed firmware using your software it shows "AT+GMR\r\r\n00160901\r\n\r\nOK\r\n".
I set the ESP8266 into bootloader mode using your software and the blue LED flashes briefly once.
I set up the Python 2.7.12 environment and installed esptool.py, then edit it according to the Block Size edits you suggest. But I run esptool.py with the correct arguments I get "A fatal error occurred: Failed to connect to ESP8266."
I've tried different baud rates (9600, 74880, 115200) to no avail. And I know the COM3 port is correct since the same port is used by the Web IDE.
Incidentally, I tried connecting to my home AP using the ESP8266WiFi Module but I continually get "Uncaught No 'ready' after AT+RST." It never says "Connecting to WiFi"
Any ideas?
-Neil
-
-
-
Hi all-
I'm new user to the forum and Espruino.I couldn't find a way to edit code created for E.on('init'). Is there a way to do this?
Or do I have to erase the entire handler with E.removeAllListeners('init')?
Or use reset() ?
Thanks for your help.
-Neil
(oh also couldn't find a way to change my username from the memorable "user70118." Wouldn't preserve my changes after hitting Save.)
-
Hello all-
Saw a video where I think it said the maximum supply voltage for the pico is +5v. But scanning the forums I saw folks talking about the pico being able to handle +16v. Then looking at the data sheet (STM32401xD, right...?) it says "... VDD operating voltage range 1.8 V to 3.6 V." Can someone provide a range on what voltage supply the pico can tolerate (and at which pins)?
Background: I have an industrial control panel housing +12 VDC DIN-rail power supplies and would prefer not to install another just for the Espruino.
Thank you!
-Neil