ESP8266 firmware update using espruino pico

Posted on
  • Hi,
    I try to update the firmware of the ESP8266 like described here using the espruino pico: http://www.espruino.com/ESP8266

    I am using 1.80 on the espruino pico. My ESP8622 is soldered. I think I understood the description, but I always get "Failed to connect" with esptool. Since I am not a native speaker this is a litle bit hard to understand:

    Take 2 wires and connect one side of each to GND. Connect the first to GPIO0, while connecting and releasing the second to RST

    When I do it like I understand a blue LED on the ESP8622 flashes shortly while releasing the wire from RST. Is this correct?

    Here is the output of esptool and I am using OSX, if that matters.

    {20:16}[1.9.3]~/Downloads/esptool:master­ ✗ ➭ ./esptool.py -p /dev/tty.usbmodem80111 -b 19200 write_flash 0 ESP8266_AT25-SDK112-512k.bin
    Connecting...
    Traceback (most recent call last):
      File "./esptool.py", line 532, in <module>
        esp.connect()
      File "./esptool.py", line 159, in connect
        raise Exception('Failed to connect')
    Exception: Failed to connect
    

    Best regards,
    Ben

  • Hi Ben,

    Does testing the firmware version work with the ESP8266 as it is normally? If it doesn't, it may be some wiring problem.

    When I do it like I understand a blue LED on the ESP8622 flashes shortly while releasing the wire from RST. Is this correct?

    Yes.

    • When done right, the blue LED should blink quickly
    • When not done right, the blue LED will either not blink, or will blink twice (for longer).

    When pasting the code to Espruino, did you press 'enter' after pasting the code in? The last command will need to be executed as well, and it may not be if it is just pasted in.

  • Hi Gordon,
    thanks for your quick reply. What do you mean with

    Does testing the firmware version work with the ESP8266 as it is normally?

    If I try to print the version with wifi.getVersion I get errors. Maybe I already bricked the ESP ;-) I have another pico and another ESP. I will try them, but this needs some soldering.

    When done right, the blue LED should blink quickly
    When not done right, the blue LED will either not blink, or will blink twice (for longer).

    Then I've done it right. The blue led blinked exactly once.

    Of course, I did press enter.

    Regards,
    Ben

  • One more question. Does the revision of esptool matter? I used the latest master from 2.9.15

  • With 'Does testing the firmware version work with the ESP8266 as it is normally?', I mean does running this command work:

    function test(serial, baud, pins) {
      serial.removeAllListeners();
      var l="";
      serial.on('data', function(d) {l+=d});
      serial.setup(baud, pins);
      serial.write("AT+GMR\r\n");
      setTimeout(function(){console.log(JSON.s­tringify(l));},1000);
    }
    test(Serial2, 9600, { rx: A3, tx : A2 });
    // wait 1 sec
    

    And then:

    test(Serial2, 115200, { rx: A3, tx : A2 });
    

    The revision of esptool shouldn't matter - but I have to admit I haven't tried with the absolute latest version (although I don't think there are major changes).

  • With 9600 baud it prints "AT+GMR\r\r\n0018000902-AI03\r\n\r\nOK\r­\n" and it prints garbage with 57600 and 115200 baud, which seems to be expected with this old firmware. Correct?

    I tested 7 revisions of esptool back to a commit in January. As expected, no change.

    The next step would be to solder my other espruino with another wifi module.

  • which seems to be expected with this old firmware. Correct?

    Yes... So that sounds like everything is connected right.

    I've just tried this here and it works for me with 1v80. However, if I didn't reset the ESP8266 right (with GPIO0+RST) I get exactly the error you described.

    • Did you disconnect the Web IDE after writing the code
    • When you run the esptool command, does the blue LED on the ESP8266 flash at all?
  • For what it's worth, I failed to get esptool on OS X to connect via the Espruino proxy; OS X is my main programming platform so I do know it quite well. I ended up connecting the Espruino to a Raspberry Pi and did it from there: much easier.

    Getting the shimmed ESP8266 from the Pico Kickstarter flashed was a bit of a chore, but after some tweaking, I managed it.

    Getting three more ESPs I bought from Amazon was another matter: it turned out two of them had dud firmware anyway, so getting a version string was impossible; however, they did go into Flash mode automatically, so once I realised that, I managed to flash them. The third had 0.21.0.0 on it and required some baud rate tweaking before I could flash that.

    I also had quite a bit of trouble with the reset line floating and so forth, so used a pull-up 10K, and ended up building a jig on veroboard. Finally, shortening the wires between Espruino and the ESP8266 helped, I think... by that time I was trying just about anything.

  • Just in case it helps ... there is a whole ESP8266 community of support staff at your disposal ... see:
    http://www.esp8266.com/

    The forums are active and friendly and there is a ton of historic information about all things ESP8266. Flashing the ESP8266 is a story that has to be done all the time for those who like to play with ESP8266 by itself so you will likely find a ton of useful posts, tips and tools present there.

  • Hmm... interesting about the reset line float... Maybe later ESP8266 modules 'cost-cut' by removing the pullups?

    What was the error from esptool when going through Espruino? Were you using Espruino 1v80, and did you tweak those lines in esptool as well? To be fair I haven't tried on OSX, but it really shouldn't be any different.

  • I was just about to put it all away in the loft when I got this message notification. Lucky!

    I'm fairly sure it was a Exception: Failed to connect error, and this was definitely on 1v80 with tweaked esptool. The script's on an NFS mount shared with both Mac and Pi, so I'm sure both the espruino js and the tweaked esptool were the same.

    Of course, typically now I try a read_mac call and it works just fine! That was with one of the ESP8266 you supplied with the Kickstarter, whereas the ones I were programming are visually identical but from Amazon.

  • Hmm... strange. So does it look like you'll be able to update the KickStarter one via the Pico?

    It's classic cheap chinese module stuff - happened with the NRF24. You get good quality modules that work fine, they get popular, and then the manufacturers see what bits they can leave off to drive the price down :)

    ... of course that may not actually be what's happened, it's just likely.

  • I've updated all of them successfully now via the Raspberry Pi. The first one was a KS module using the shim included with the KS five-pack, but still needed to be via Raspbian rather than Mac. The next three were from Amazon, done using the veroboard jig. This one I just successfully tested on the Mac (albeit just read_mac rather than write_flash) was already upgraded to 0.25.0.0 using the jig on Raspbian.

    So, basically no useful information there at all :) However, if someone is having trouble using esptool on Mac, it might be worth trying a Pi or similar.

    Oh, one thing I forgot to mention... I didn't have any luck flashing it on Mac using an FTDI232 USB/TTL board instead of the Pico either.

    EDIT: Ah, just noticed that the ESP8266 (actually ESP-01) modules didn't come with the KS Picos after all. I got the five-pack, Dad got another reward, and gave me one of his shims and an ESP8266. I hadn't realised he'd bought the ESP8266s elsewhere. So, basically even less useful information to deduce a pattern! I'll shut up now.

  • I know that the esp-01 fits the shim, but I'd highly recommend moving to the esp-12 (best the new esp-12f version) because they have 10dB better RF, that makes a huge difference!

  • just noticed that the ESP8266 (actually ESP-01) modules didn't come with the KS Picos after all

    Actually you could add them to the order after the KickStarter, so he might have got some?

    Interesting about signal strength of ESP-12. (Is 12f different?)

    I've done some adaptors for ESP-12: https://github.com/espruino/EspruinoBoar­d/tree/master/Pico/Adaptors

    Still waiting to get some boards back from the PCB manufacturer so I can test them though.

  • Hi everybody, I'm having same problem(A fatal error occurred: Failed to connect to ESP8266), may be someone could give a hint.
    I've wired ESP8266 with Espruino Pico using Shim v.1
    I've updated Espruino to 1v84. Using MacOS 10.8.5 and Python 2.7 I've installed PySerial 2.7 I've modified esptool.py and used following code to upload firmware.

    python esptool.py -p /dev/tty.usbmodem1441 -b 9600 write_flash 0 your_firmware.bin
    

    A fatal error occurred: Failed to connect to ESP8266

    OK, after that using same /dev/tty.usbmodem1441 I've connected Esprino and tested connection as it was written in reply #5:

    test(Serial2, 9600, { rx: A3, tx : A2 });
    

    gives "AT+GMR\r\r\n0018000902-AI03\r\n\r\nOK\r­\n"

    test(Serial2, 115200, { rx: A3, tx : A2 });
    

    gives "\x00"
    Should it be like this?

    Also I don't quite understand instruction from(espruino.com/ESP8266):" If you don't have the Pico's new ESP8266 shim, you'll need to boot the ESP8266 into bootloader mode manually. Take 2 wires and connect one side of each to GND. Connect the first to GPIO0, while connecting and releasing the second to RST (see the diagram under 'Wiring Up' to find which pins are which)."
    I have Shim v.1 does it mean a new ESP8266 shim? Or I should I connect use wires?

    Current situation with ESP8266 it blinks twice with blue when I connect and lights red all the time.

  • Hi, What you're doing with the test commands sounds fine - that's as expected.

    The Shim v2 has an angled edge on it, whereas the v1 has only 90 degrees edges. The difference is that the v2 shim has other Espruino Pins used up that mean the Pico can put the ESP8266 into bootloader mode rather than you having to mess around with wires.

    The problem you've having is almost certainly that the ESP8266 isn't in bootloader mode. Since you have the v1 you'll have to do what those instructions say about connecting the wires. When you do it, the blue LED should flash once (red light on is expected)

    It really not that hard once you figure out which 2 pins to connect, but it's hard to explain. I'll see if I can do a video on it.

  • Video here - hopefully it clears it up a bit:

    https://youtu.be/X12YdIhaauI

  • Thank you very much Gordon, now everything clear and it works :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

ESP8266 firmware update using espruino pico

Posted by Avatar for badben @badben

Actions