-
• #52
Ok, this is the problem with multiple connections... But then a connection really shouldn't still be open after 60 seconds.
Do you have the latest Espruino firmware installed? It should be 1v79
-
• #53
I just fixed the formatting for you - just make sure you highlight code and click the 'code' button - and you need to make sure you keep the blank line before and after the code markers (```) that the editor puts in.
-
• #54
Thanks Gordon,
I do have the latest 1.79 firmware installed. Perhaps this is my service provider in Spain taking ages to complete the connection to your test URL?
I can set up a local server and test again to rule out ISP delays etc. I will check back later.
-
• #55
Yup, you're running into trying to use two sockets at once. It tries to add a line handler for unlink, but there's already one there from the last socket. There is an analogous problem with a few other handlers
-
• #56
There's a bug for this and I'll try and get a fix in soon. It shouldn't be too hard - although having said that the
Unlink
doesn't say which socket has closed, so it could still cause problems.You could check if sockets are closing by doing something like:
http.get("http://www.espruino.com", function(res) { digitalWrite(LED1,1); res.on('data', function(data) { console.log(data); }); res.on('close', function(data) { digitalWrite(LED1,0); }); });
As a stop-gap you could do something similar to make sure you don't fire off multiple requests at once I guess.
-
• #57
Hi Gordon, DrAzzy,
I tried your suggestion to check the if the socket is closed before attempting a request. The results are varied. I can call around 30 requests in a row using a 10 second interval, but eventually the socket remains open and no further requests are possible.
I tried using a local server, my Raspberry Pi to simply echo back a status check and being local the response was very fast but I was unable to request as many calls as using an external website. Strange.
Will continue to test with other parameters.
-
• #58
Hi guys,
is it possible to flash ESP8266 firmware through Pico?
I just mounted one ESP01 to the Pico by shim and now it is more difficult flash the ESP, because of short pins on bottom... -
• #59
Right now, it should be possible to flash it if someone wrote some code that would control Espruino. Ideally it'd be in JavaScript and then I add the firmware updater to the Espruino Web IDE. I haven't had time for that yet though :(
Theoretically you could just set Espruino up as a pass-thru, with:
Serial2.setup(57600, { rx: A3, tx : A2 }); // or whatever baud rate Serial2.on('data',function(d) {USB.write(d);}); USB.on('data',function(d) {Serial2.write(d);}); LoopbackA.setConsole(); // move console out the way
And then you can just point the flasher at Espruino's USB port - however I think there are some issues with lost bytes on USB when sending big chunks of data. As part of the USB HID work I've been rewriting the USB drivers to fix that, but it's proving very difficult to fix the lost characters - I think it might be an issue with ST's USB library :(
-
• #60
ok. I'll try this tomorrow and give feedback.
To pass serial data is exactly the solution I already done on other projects with Teensy + ESP8266 >> it worked perfect so far. -
• #61
Hello friends. I have a problem with
Uncaught No 'ready' after AT+RST at line 2 col 18 if (err) throw err;
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("WiFi_Name","WPA2_Key", function(err) { if (err) throw err; console.log("Connected"); // Now you can do something, like an HTTP request require("http").get("http://www.pur3.co.uk/hello.txt", function(res) { console.log("Response: ",res); res.on('data', function(d) { console.log("--->"+d); }); }); }); }); });
When I was testing baud rates, only reasonable output was:
AT+GMR\r\r\nAT version:0.21.0.0\r\nSDK version:0.9.5\r\n\r\nOK\r\n
What am I doing wrong? Red light is on. When I removed the "if(err) throw err;" the script continues and Blue light is sometimes blinking (when trying to connect)
-
• #62
please try the baud test code with AT+RST instead of AT+GMR and post the result
-
• #63
Personally I'd think about updating the firmware on your ESP8266. I haven't come across version 0.21 before and it may behave differently - 0.25 (linked off the ESP8266 page) is the one that we've been developing/testing with...
-
• #64
Was getting nowhere with my ESP8266 on a breadboard - nothing back from the firmware detection script save for empty quotes. Connected CH_PD to 3.3 on a whim (as out of ideas) and I got the expected return telling me what board version I have.
Is the documentation not very clear on this point? It reads like CH_PD is not required for Pico, and I'm pretty sure @Gordon has confirmed this elsewhere, but I can get nothing back from the Pico without that connection being made. -
• #65
The tables for wiring on http://www.espruino.com/ESP8266 do mention that you should connect CH_PD to 3.3v... Or were you looking somewhere else for wiring info?
I think CH_PD stands for 'Chip Power Down' - it would have been nice if the board was set up so it powered on at startup, but unfortunately it looks like you do have to connect it to 3.3v to get it to start...
-
• #66
I've sent you a PR with the table that confused me amended. It did not show requirement for 3.3v on CH_PD in the Pico column, just the Espruino column.
-
• #67
Thanks - looks like a bit of a copy/paste error on my part :)
-
• #68
I'm not able to connect to Wifi either, similar issue as others have had with the uncaught no ready.
I can send AT commands, I have the red light, I get the blue light when sending a commandI have the 0.25 version ESP8266 (AT+GMR) am loading the right module and baud is set to 115200. I have a 10uF capacitor between ground and +3.3v at the connections on the ESP8266.
I've logged the ouput of AT+RST below, I've no idea what I'm looking at but it seems to suggest a memory issue MEM CHECK FAIL.
Can anyone help me move forwards?
AT+RST > > OK > > ets Jan 8 2013,rst cause:2, boot mode:(3,0) > > load 0x40100000, len 1396, room 16 > tail 4 > chksum 0x89 > load 0x3ffe8000, len 776, room 4 > tail 4 > chksum 0xe8 > load 0x3ffe8308, len 540, room 4 > tail 8 > chksum 0xc0 > csum 0xc0 > > 2nd boot version : 1.4(b1) > SPI Speed : 40MHz > SPI Mode : QIO > SPI Flash Size & Map: 8Mbit(512KB+512KB) > jump to run user1 @ 1000 > > ?ՁMEM CHECK FAIL!!! > ?rl??n? > Ai-Thinker Technology Co. Ltd.
This is the output of AT+GMR
> AT+GMR > AT version:0.25.0.0(Jun 5 2015 16:27:16) > SDK version:1.1.1 > Ai-Thinker Technology Co. Ltd. > Jun 23 2015 23:23:50 > > OK
-
• #69
i have the same problem, my findings so far:
- seems to be a faulty flash chip
- does not interfere with the function of the ESP8266
- try it out, with AT commands i can join a network etc.
- try it out, with AT commands i can join a network etc.
- does not work with the current Espruino ESP8266 module
- i tried to flash another firmware, no success so far
.. in the end i gave up for now and ordered some ESP8266 ESP-01 from ebay, look for "tested", i am still waiting for them to arrive
- seems to be a faulty flash chip
-
• #71
Not your fault @Gordon!! I'll get there don't worry - will give your suggestion a try.
@MichaelPralow thanks for posting up. That helps to know that others are seeing similar. I suppose with the price of these ESP8266 boards, have to expect some variation in quality!What I would add, is unlike your experience, I've not had much back from the ESP8266 running other AT commands - for example for listing access points, and haven't been able to connect to anything by trying to talk to it directly with AT commands - as yet.
-
• #72
you could try using the ESP8266 without calling the reset function
that's in the example code?under the hood, the ESP8266 module uses reset a lot
and haven't been able to connect to anything by trying to talk to it
directly with AT commandsthat might be a problem with the pins (CH_PD needs 3.3v too) or not enough power, i had some strange behaviour while using the esp8266 directly with an espruino pico, powered by laptop usb, with one of those breadboard power supply thingies and 100uF it works reliable
-
• #73
Thanks. I've got CH_PD connected. I guess a bigger capacitor is worth a shot though.
-
• #74
100uf capacitors in the post tonight when I got home - so back at it.
Didn't help with the more advanced AT commands initially... but then in a stroke of "random" I upped the timeout in my test script - and started to get returns.
So...
I noticed the ESP8266 module calls the AT module with a timeout of 1000, which in my scripts couldn't do anything more than get a return from basic AT commands; other stuff like
AT+CWLAP
never returned (at least never to console output).So at the risk of more noobness... could more generous timeouts in the ESP8266 js module help in the problems lots of folk seem to be seeing?
-
• #75
you can test it out by yourself, save the module js https://github.com/espruino/EspruinoDocs/blob/master/devices/ESP8266WiFi_0v25.js in your WebIDE project/modules folder, rename it (e.g. My_ESP8266WiFi_0v25.js) and use that in your code with
require("My_ESP8266WiFi_0v25");
if that works, start hacking away and change the used timeout
@Gordon it might be a good move to futureproofness (does that word even exist?) in adding some timeout argument to the modules methods (with 1000 as default), it really looks like the ESP8266 is a lottery
@Ollie can you test the power with a multimeter, as far as i remember with my breadboard power supply thingie (connected to wall power supply) i got enough to even work without capacitor
Oh dear folks, the formatting has gone a bit pear shaped in my last post post!
Sorry