Latest Espruino build for Esp8266

Posted on
of 8
  • ESP8266 info can be found here:­/blob/master/boards/
    Or more nicely formatted but a tad older here
    There is no analog output and the HW PWM doesn't work. I haven't tried what happens with AnalogWrite, but it would have to be a "D" pin. A0 is only for analog input (and very limited plus noisy at that).

  • @DrAzzy @tve I am very sorry, I meant to say analogRead()... but thanks for all the information!!! It has opened new resources I was not aware of!

  • Aaah, ya. Last I checked, analogRead read from the adc pin ( the only one it can read analog voltages on) regardless of what pin you told it to read. The adc is 0~1 volt only.

  • Now I understand - I used to send it this way and it complained:

    Uncaught ReferenceError: "A0" is not defined
     at line 1 col 12

    .... All I had to do was send it like this analogRead(); to get it work!

    NOTE: On the WeMos website they mention that max on the analog read is 3.2v... we sill see.

    Thank you all!

  • The ADC pin itself is 0~1v only.

    I can't help but notice, however, that 3.2v is the maximum you'd be able to read if you used a voltage divider with 10k and 22k resistors (two common values) - maybe the board being referenced has that on it to make it easier for people to use the ADC?

  • You are correct! Voltage Divider on-board! Thanks

  • Hello,

    im trying to flash the latest build but after flashing and reboot it ends up in and endless loop.
    With this build­tve_master_588d193_esp8266.tgz everything works fine.

    Any idea ?

    Thanks in advance


    1 Attachment

    • Bildschirmfoto 2016-08-02 um 15.37.10.png
  • Are you using esptool to flash? Maybe do "erase_flash" first. This will clear any saved javascript code. I understand that sometimes addresses of stuff change between builds so you can't guarantee that previously saved code will run. Wiping the board entirely with erase_flash usually sorts problems like this.

  • Hi Ollie,

    thanks for your advise. It seems i got some ESP8266 Modules from AliExpress with less then 4MB. I have some modules with 4MB and it works fine.

    How can i erase the flash ? I just started to work with espurino and esptools.

  • Something like this --port /dev/tty.SLAB_USBtoUART --baud 460800 erase_flash

    Note there is a different flashing command for smaller boards - 512k? Check the README_flash.txt included in the build's .tgz to make sure you're using the right command for your board.

  • --port /dev/tty.SLAB_USBtoUART --baud 460800 erase_flash

    Thanks a lot. Everthing works fine so far.

  • The first link on this page titled "reference section" seems to be broken.­

  • Thanks, fixed, will appear with the next release.

  • Hi @tve,

    Latest build seems to use espressif sdk 1.5, but README gives a command example for 1.4(b1):

    ceremcem@cca-erik:espruino_1v86.tve_mast­er_8d2f1b4_esp8266$ ls
    blank.bin boot_v1.5.bin esp_init_data_default.bin espruino_esp8266_user1.bin >espruino_esp8266_user2.bin README_flash.txt
    ceremcem@cca-erik:espruino_1v86.tve_mast­er_8d2f1b4_esp8266$ cat README_flash.txt

    How to flash Espruino esp8266

    *** To flash a 512KB esp8266 (e.g. esp-01) using the serial port use: --port [/dev/ttyUSB0|COM1] --baud 460800 write_flash \
    --flash_freq 40m --flash_mode qio --flash_size 4m \
    0x0000 "boot_v1.4(b1).bin" 0x1000 espruino_esp8266_user1.bin 0x7E000 blank.bin

    *** To flash a 4MB esp8266 (e.g. esp-12) using the serial port use: --port [/dev/ttyUSB0|COM1] --baud 460800 write_flash \
    --flash_freq 80m --flash_mode qio --flash_size 32m \
    0x0000 "boot_v1.4(b1).bin" 0x1000 espruino_esp8266_user1.bin 0x37E000 blank.bin

    *** Get from­l

    *** To flash a 4MB esp8266 (e.g. esp-12) via wifi use (with appropriate hostname):
    ./scripts/wiflash espruino.local:88 espruino_esp8266_user1.bin >espruino_esp8266_user2.bin

    When I load the firmware with the same command I was using before (which is just the same as in this README) by replacing boot_v1.4(b1).bin with boot_v1.5.bin, I can only see random(?) hex flow in the serial console:


    Loading seems to success though:

    Erasing flash...
    Took 0.08s to erase flash block
    Wrote 4096 bytes at 0x00000000 in 0.4 seconds (82.1 kbit/s)...
    Erasing flash...
    Took 1.68s to erase flash block
    Wrote 478208 bytes at 0x00001000 in 46.4 seconds (82.5 kbit/s)...
    Erasing flash...
    Took 0.08s to erase flash block
    Wrote 4096 bytes at 0x0037e000 in 0.4 seconds (85.5 kbit/s)...
  • I had same random characters on console as you when using the released v1.86 version. I got the latest build running ok with the following:

    c:\python27\python ..\ --port COM15 --baud 230400 write_flash --flash_freq 40m --flash_mode dio --flash_size 32m 0x0000 "boot_v1.5.bin" 0x1000 espruino_esp8266_user1.bin 0x37E000 blank.bin
  • c:\python27\python ..\ --port COM15 --baud 230400 write_flash --flash_freq 40m --flash_mode dio --flash_size 32m 0x0000 "boot_v1.5.bin" 0x1000 espruino_esp8266_user1.bin 0x37E000 blank.bin

    This options didn't work for me with espruino_1v86.tve_master_8d2f1b4_esp8266­. There is no boot_v1.5.bin file the build in your link.


    As the latest build (1v86.171) uses boot_v1.4...., the old flashing options work as expected.

  • Hi there !

    I just upgraded the flash chip on an ESP-01 ( yup ... ) to a W25Q128FV without too much hurdles, but I'm not confident in the settings to be passed to during the flashing procedure ..

    what'd be needed to pull that off with the latest build ?

    my wild [ and uncomplete/errored ] guess:

    /path/to/esptool/ --port /dev/ttyUSB0 --baud 115200 \
      write_flash --flash_freq 80m* --flash_mode qio* --flash_size 128m* \
      0x0000 "boot_v1.4(b1).bin" 0x1000 espruino_esp8266_user1.bin \
      0xFFFF00* esp_init_data_default.bin 0xFFFF00* blank.bin

    *I'm really not sure about these, although the datasheet specifies a SPI clock rate ip to 104MHz, "dio" up to 208MHz & "qio" ( "and qpi instructions" ) up to 416MHz ..
    .. and I'm pretty sure the memory addresses I'm looking for are not 0xFFFF00 ( 0xFFFE00 ? )
    -> this being said, any good hint on how to be sure to read those pages-heavy datasheets diagrams correctly is very much appreciated ;)

    4 Attachments

    • IMG_1275.PNG
    • IMG_1276.PNG
    • IMG_1277.PNG
    • step08__compareStdAndUpgraded.png
  • Assuming that the esp8266 and the bootloader support that size flash, then:

    0xFFFF00* esp_init_data_default.bin 0xFFFF00* blank.bin

    that should be 0xFFC000 esp_init_data_default.bin 0xFFE000 blank.bin

    There is no harm in you programming it for a smaller size to test and work your way up.

  • I hope so .. ( I'll know soon enough ;p )

    Also, what's the underneath logic for the "0x[YY]C[YYY] 0x[YY]E[YYY] rule" ?
    I noticed the ..C.. & ..E.. endings, but didn't saw that in the datasheet ? ( I may be blind sometimes .. )
    Additionally, is the "_freq" param's value changing ? ( or is it somehow related to the ".setCPUFreq(80)" call for the esp chip :| ? )

    I'l try your suggestion as soon as I get up after some rest ;)
    -> yes, from what I could read, it should be happy with whatever until saving up .. I'll see that :)

    Thanks for the quick answer

    ps: not yet ready but it may be useful - sorry for messing with the branch troubles ;p

  • For those without the soldering skills, see here.

  • back :)

    from what I could read in the esptool repo:

    • flash_mode: when using "dio" instead of "qio", GPIO 9& 10 are freed & available for other purposes
    • flash_size: the value of my flash chip is not in the 2m..32m range, so not a valid value [ yet* ]
    • flash_freq: clock freq for SPI interaction, 20..80MHz - not related to esp cpu freq ^^

    *I'll digg, but the lines 46..56 ( "add_spi_flash_subparsers" ) & 825..852 ( "write_flash" ) seems of interest, as well as the following links:­l/issues/105 , from a coment in previous link's page - spi_flash.h

    lastly, from the esp8266 datasheet:

    1 Attachment

    • esp8266_datasheet_16Mbytes_theoricallySupported.png
  • But only 1 meg for programs and possibly another meg for the OTA copy - the rest of the space could only be used for data - using for example the file system in the Arduino environment...

  • I created a fresh build using everything in v1.87 plus the latest Espressif SDK v2.0.0 with the latest patch. This build has crypto support but not graphics. Both just don't fit into flash :-(. The esp8266 runs at 160Mhz and Espruino gets 1700 jsvars. The free heap comes out to ~8KB and the build uses lwip_536 so packet buffers aren't as big as they would be otherwise.

    I have not done extensive testing, please let me know if I botched something. You can download the build from­b3dc05b5378a9182eea44e8c47b15c54e788037d­/espruino_1v87.tve_master_b3dc05b_esp826­6.tgz and I opened a PR for Gordon­l/925

  • @tve
    Is version 2.0 sdk larger - is that why the rom size had to drop, and therefore the graphics library?

  • No, it had to drop because it never fit. It was in the previous build because someone just changed the max size in the makefile without considering whether there actually is space. So code overlapped the eeprom flash area and other stuff.


Latest Espruino build for Esp8266

Posted by Avatar for tve @tve