• NodeMCU ESP8266-12E Flashing Espruino

    This is still a work in progress. Posting here hopefully with all exact error messages that were gotchas for me so it can be found more easily. More likely, I'll publish a github project to keep track of NodeMCU flashing info for Espruino and otherwise specific to this make/model.

    Thanks to the Espruino forum admins to let use third-party board users have a lil' space on their forum to discuss this. I must mention, it seems if you want to use javascript on a microcontroller the best way to go is a genuine Espruino board NodeMCU and the like will likely take a lot of your free time for a couple weeks to get things working the way you thought they would :D

    On with it then below you'll find:

    • Model Info Sheet
    • Flashing Espruino
    • Additional Notes

    ESP8266 Model Info

    Results of esptool's flash_id:

    esptool.py --port /dev/cu.SLAB_USBtoUART flash_id
    Chip: ESP8266
    Manufacturer: c8
    Device: 4016
    Detected flash size: 4MB

    This is what I bought: HiLetgo New Version ESP8266 NodeMCU LUA CP2102 ESP-12E Internet WIFI Development Board Open source Serial Wireless Module Works Great with Arduino IDE/Micropython

    NodeMCU v2 ESP8266 ESP-12E CP2102 - topNodeMCU v2 ESP8266 ESP-12E CP2102 - bottom

    Flashing Espruino Firmware

    • Setup directories for your NodeMCU firmware, download latest ('cutting edge') Espruino, unpack it, and enter directory. (setup nested directory, because I also have nodemcu lua firmware I use on this device).

      mkdir 'nodemcu-firmware' && cd 'nodemcu-firmware' # create firmware directory and enter it
      mkdir 'espruino' && cd 'espruino' # create espruino directory and enter it
      curl -O 'http://www.espruino.com/binaries/travis­/master/espruino_1v94.136_esp8266_4mb.tg­z' # download the firmware
      tar -xvzf espruino_1v94.136_esp8266_4mb.tgz # upack the .tgz file
      rm espruino_1v94.136_esp8266_4mb.tgz # if tar was success full clean up and remove .tgz file
      cd espruino_1v94.136_esp8266_4mb # enter the new extracted directory
    • Connect via USB

    • Run erase_flash command.

      esptool.py --port /dev/cu.SLAB_USBtoUART erase_flash
      • /dev/ is specific to macOS
      • I don't believe it matters if you use /dev/cu.* or /dev/tty.*
      • SLAB_USBtoUART is what shows up for me your's may be different. I'll add directions to figure this out when I get to it :D

    • Disconnect/Reconnect USB from device. (I haven't tested this to see if it's necessary)

    • Run write_flash command:

      esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --verify --flash_freq 80m --flash_mode dio --flash_size 32m 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x37E000 blank.binaries
      • Use dio to flash the device properly. -- Below, @Gordon mentions that some other boards are able to handle qio and those boards can use it '...for faster access'.

    Common Errors

    • Using qio option when running the write_flash command to flash the firmware:

      • Esptool flashes the firmware to the device without triggering any errors
      • Espruino Web IDE connects to device, but doesn't seem to work properly and may exhibit these issues:
      • Terminal window will not respond. When clicking in terminal window, no text cursor is displayed and will not respond to keyboard entries. (Terminal window still triggered the ':active' state color change when clicked).
      • Settings >> Console -- the console log:

        >>> Connecting...
        Set Slow Write = true
        Unable to open device (connectionInfo=undefined)
        ERROR: Unable to open device (connectionInfo=undefined)
        ERROR: [notify_error] Connection Failed.
        >>> Connection Failed.
        >>> Connecting...
        Set Slow Write = true
        Unable to open device (connectionInfo=undefined)
        ERROR: Unable to open device (connectionInfo=undefined)
        ERROR: [notify_error] Connection Failed.
        >>> Connection Failed.
        >>> Connecting...
        Set Slow Write = true
        [object Object]
        Connected [object Object]
        Found a prompt... great!
        >>> Sending...
        ---> "\u0010console.log(\"<\",\"<<\",JSON.str­ingify(process.env),\">>\",\">\")\n"
        >>> Sent
        WARNING: No result found - just got ""
        >>> Sent


Avatar for stevo @stevo started