Latest Espruino build for Esp8266

Posted on
Page
of 8
  • ESP8266 info can be found here: https://github.com/espruino/EspruinoDocs/blob/master/boards/EspruinoESP8266.md
    Or more nicely formatted but a tad older here http://www.espruino.com/EspruinoESP8266
    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:

    >analogRead(A0)
    Uncaught ReferenceError: "A0" is not defined
     at line 1 col 12
    analogRead(A0)
               ^
    

    .... 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.
    (screenshot).
    With this build s3.voneicken.com/espruino/espruinĀ­o_1v84.tve_master_588d193_esp8266.tgz everything works fine.

    Any idea ?

    Thanks in advance

    Juergen


    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

    esptool.py --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.

  • esptool.py --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.

    http://www.espruino.com/ESP8266_Flashing

  • 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_master_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 wiflash.sh
    ceremcem@cca-erik:espruino_1v86.tve_master_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:
    esptool.py --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:
    esptool.py --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 esptool.py from https://github.com/themadinventor/esptool

    *** 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:

    f2nn\0x9elnn\0x9c\0xe2\0xec\0x0cb\0x1cp\0x0clb\0x0elrlp\0xf2n\0xe0\0x10\0x02\0x0c\0x0c\0x82\0x0cl\0x0c\0x0c\0x0c\0x0c\0x0c\0x0cb\0x0cn\0xe2|\0x02l\0x0cl\0x8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02\0x0c\0x9en\0x8c\0x92\0xe2nl\0x9e|\0x12b\0x12\0x0c\0x0c\0x02l\0x0c\0x0c\0x0cl`\0x02rl\0x8c\0xe2\0xf2\0x92p\0x02\0x82nn\0x80l\0x12ll\0x0c\0x0c\0x02l\0x8eb\0xec\0x8e\0x02\0x0c\0x0c\0xe2\0xe2\0x92`\0x02rl\0x00l\0x9c\0x9e|\0x00\0x8cl\0xe0|\0x02\0x0c\0x0c\0x0c\0x8c\0x0cl\0xe
    

    Loading seems to success though:

    Connecting...
    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)...
    
    Leaving...
    
  • 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 ..\esptool.py --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 ..\esptool.py --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.

    Edit

    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 esptool.py 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/esptool.py --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
    ESP8266_FlashUpgrade

  • 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 esptool.py, but the lines 46..56 ( "add_spi_flash_subparsers" ) & 825..852 ( "write_flash" ) seems of interest, as well as the following links: https://github.com/themadinventor/esptool/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 http://www.espruino.com/binaries/travis/b3dc05b5378a9182eea44e8c47b15c54e788037d/espruino_1v87.tve_master_b3dc05b_esp8266.tgz and I opened a PR for Gordon https://github.com/espruino/Espruino/pull/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.

About

Latest Espruino build for Esp8266

Posted by Avatar for tve @tve

Actions