Esp8266 tutorial

Posted on
  • I started a tutorial on how to flash the esp8266 with Espruino and, more importantly, how to use it without wires: connecting with the IDE over Wifi and updating the firmware over Wifi. Unless Gordon is willing to update the site soon, you will have to look at it on github:

    I tested the various commands, but I'm sure I made mistakes and I'm also sure there are portions that are not understandable as written. Please let me know here (or in github issues) so I can improve the tutorial!

  • Great, I like it very much... with all the background info provided.

  • Thanks - you mention how to flash on linux, but it doesn't look like you cover flashing on windows? If the procedure is the same, that should be clarified, and if not, it should be covered for windows. There are lots of windows users out there...

  • Agreed on windows and that's why I mentioned that at the beginning of the tutorial. I use Windows as desktop but not to do any IoT stuff. The only real difference is how to flash the esp8266. I can point to a version of esptool.py or the official espressif flashing tool, those are known to work... But it would be better for someone who actually uses Windows for this stuff to write up what works for them.

  • Hi!

    Flashing on windows with esptool and the same command works just fine. Sent a pull-request to update the flashing docs.
    Don't really know how detailed the windows instructions should be. Almost could be just one line. Replace "/dev/ttyUSB0" with "COMxx", and you are good to go :)

    Thanks for your work!

  • Thanks for the info!

  • happy gasp
    I just got my ESP8266, can't wait to try Espruino out.

  • There's a typo in the sample command - a stray quote, that results in the following error:

    
    D:\esptool-master\espruino_1v84.tve_mast­er_9aa07bc_esp8266>..\esptool.py --port COM12 --baud 115200 write_flash --flash_freq 80m --flash_mode qio --flash_size 32m 0x0000 boot_v1.4(b1).bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
    Connecting...
    Traceback (most recent call last):
      File "D:\esptool-master\esptool.py", line 727, in <module>
        main()
      File "D:\esptool-master\esptool.py", line 631, in main
        image = file(filename, 'rb').read()
    IOError: [Errno 2] No such file or directory: 'boot_v1.4(b1).bin 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin'
    
    
  • Thanks! fixed.

  • Also, note this thread:
    http://forum.espruino.com/conversations/­279475

    I guess it's wifi.getIP() not wifi.getIPInfo() now? And getIPInfo() force-reboots the ESP8266?

  • yes to #1; the second issue is a bug I just fixed, testing the new version now...

  • Any idea why the ESP8266 12 keeps restarting after flashing when I check via picocom/screen? It keeps showing this over and over:

    ets Jan  8 2013,rst cause:4, boot mode:(3,7)
    
    wdt reset
    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      : 80MHz
      SPI Mode       : QIO
      SPI Flash Size & Map: 32Mbit(512KB+512KB)
    jump to run user1 @ 1000
    
    rS
     _____                 _ 
    |   __|___ ___ ___ _ _|_|___ ___ 
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v84.tve_master_588d193 Copyright 2015 G.Williams
    WARNING: the esp8266 port is in beta!
    Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
    

    Could that be the power supply?

  • That's an old version of the FW - since it's now been officially released, it's part of the download package. I'd atleast step up to using the v85 release http://www.espruino.com/Download

    That said - wdt reset generally means you did something that kept it busy for too long without returning to idle loop, which causes the ESP8266 to assume your code is hung and reboot itself. You need to make sure you don't do anything that prevents it from coming back to the idle loop every so often (at which point it yields to the RTOS, which pets the dog as well as performing required, time sensitive network related tasks). Could this be explaining it? What were you doing at the time?

    I think power supply problems generally manifest as a different sort of reset (I always use my ESP8266-Espruinii via the network after the initial flashing, so I don't see what kind of reset it was usually). I've been impressed at how stable they are. Even without save()ing my code, I've had two devices running continuously since thursday evening, at near maxed CPU use.

  • @DrAzzy. How do you measure the cpu use on the esp8266?

  • I don't. There was some other thread here where I was hand-profiling my code to try to figure out how to make it run faster, so I could get more frames per second of animation. At this point, it's safe to say that it's at near full utilization. The console also lags badly, further supporting the theory that the processor is pinned.

  • If you haven't entered any JS code, try a full flash erase (erase_flash option, I believe in esptool.py).

  • load 0x40100000, len 1396, room 16  tail 4 chksum 0x89 load 0
    

    Connected
    $ÝabQbÁaL@€$ÙabÁaLBERROR: Prompt not detected - upload failed. Trying to recover...
    ```

    I keep getting these errors on nodemcu 0.9
    tried esptool.py and nodemcu GIU, esptool flasher etc.

    any suggestion?

  • I was having similar, interesting problems with a HiLetgo NodeMCU board, and found it was a poor ground near the micro USB connector, such that if I just rested my fingertip there I could connect successfully (115200 baud), get a prompt, and interact normally with the board after removing my finger. It seems to be only on initial connection that there's this noise flakiness.

    After getting in, I set up connecting the console via wifi (telnet), and connect that way without issue.

  • still no luck :(

  • It could be power supply - when the default wifi access point fires up, the current drain is enough to cause it lock up, and then the watch dog fires and it resets.

    Try another port or on another computer - or plug it into a wall plug 5v charger and see if you can see it as a wifi access point the Sid would show as ESPxxxx . If you can connect to that ok, then you can connect the web ide to that on 192.168.4.1

    Then get it to join your wifi network and use the local address it gets assigned in the web ide...

  • i am using separate power supply. i usually use arduino + blynk without problem. everytime the flashing finishes it resets in a weird way with no led lighting up!

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

Esp8266 tutorial

Posted by Avatar for tve @tve

Actions