• Hi all,

    I see this issue has gone around the houses a few times. I've followed all the threads and tried all the variations of esptools settings. I've also tried a few different versions of Espruino it's something in the flashing process / settings I think.

    Board is as so:

    $ esptool.py --port /dev/tty.wchusbserial14220 --baud 115200 flash_id
    esptool.py v2.8
    Serial port /dev/tty.wchusbserial14220
    Connecting....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    Crystal is 26MHz
    MAC: 84:f3:eb:5a:85:df
    Uploading stub...
    Running stub...
    Stub running...
    Manufacturer: 68
    Device: 4016
    Detected flash size: 4MB
    Hard resetting via RTS pin...
    

    Erasing looks like so:

    $ esptool.py --port /dev/tty.wchusbserial14220 --baud 115200 erase_flash
    esptool.py v2.8
    Serial port /dev/cu.wchusbserial14220
    Connecting....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    Crystal is 26MHz
    MAC: 84:f3:eb:5a:85:df
    Uploading stub...
    Running stub...
    Stub running...
    Erasing flash (this may take a while)...
    Chip erase completed successfully in 5.7s
    Hard resetting via RTS pin...
    

    Flashing via best practice examples (1V99 combined):

    $ esptool.py --port /dev/cu.wchusbserial14220 --baud 115200 write_flash --flash_freq 80m --flash_mode dio --flash_size 4MB-c1 0x0000 espruino_1v99_esp8266_4mb_combined_4096.bin
    esptool.py v2.8
    Serial port /dev/cu.wchusbserial14220
    Connecting....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    Crystal is 26MHz
    MAC: 84:f3:eb:5a:85:df
    Uploading stub...
    Running stub...
    Stub running...
    Configuring flash size...
    Flash params set to 0x026f
    Compressed 4194304 bytes to 353774...
    Wrote 4194304 bytes (353774 compressed) at 0x00000000 in 31.5 seconds (effective 1065.0 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting via RTS pin...
    

    Screen output:

    $ screen /dev/tty.wchusbserial14220 115200
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    dl sl����n�r��n|�lddd`��s�$��
     ____                 _ 
    |  __|___ ___ ___ _ _|_|___ ___ 
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     1v99 (c) 2018 G.Williams
    
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:1024/1024, manuf 0x68 chip 0x4016
    
    >
    

    Flashing to latest (2v04):

    $ esptool.py --port /dev/tty.wchusbserial14220 --baud 115200 write_flash --flash_freq 80m --flash_mode dio --flash_size 4MB-c1 0x0000 espruino_2v04_esp8266_4mb_combined_4096.bin
    esptool.py v2.8
    Serial port /dev/cu.wchusbserial14220
    Connecting....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    Crystal is 26MHz
    MAC: 84:f3:eb:5a:85:df
    Uploading stub...
    Running stub...
    Stub running...
    Configuring flash size...
    Flash params set to 0x026f
    Compressed 4194304 bytes to 351432...
    Wrote 4194304 bytes (351432 compressed) at 0x00000000 in 31.3 seconds (effective 1072.3 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting via RTS pin...
    

    Screen Output

    $ screen /dev/tty.wchusbserial14220 115200
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    R��b�&A��-�B�1�����B�R2-����y�$!c������sll��|�d�<�d�c|����{�#�b��gg�dog���cx��drl{d8�o��lco�|��c��oo�d��l`�nol or���o��d`x�'�s�����c'�|�ǎ�c��gn�l`�gd`'s���g�$p�o�{�ܜ���lbo�|���c��og�$`�gd`'{���g�l`{ےg�l sl��'���gg����soog�d�c�l��l�����dll~{$��$dlo���؄~�`��l��n�g�o��dl�c��ldp#�cp���crcp���bbld��n�g���gl�|cdd`sd����o�s��o|�dlll`c��|{�d�o��g�$`��s�$�l�
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:1024/1024, manuf 0x68 chip 0x4016
    
    >
    

    In all cases I can connect via the screen terminal app. It spits out garbage at the top but otherwise works. I can use the REPL no problem. However when I use the IDE the connection never fails or succeeds, it always looks like the screenshot provided, hung.

    I've done a few things too:

    • I've messed with the flash_frequency and other params
    • I've used CU instead of TTY drivers
    • I've used non combined files in all tests too (just in case)
    • I've used tried qio (that makes it worse)

    Anyone have any suggestions on what to try next?


    1 Attachment

    • Screenshot 2019-11-21 at 21.39.53.png
  • Thr 2019.11.21

    Hi @mcdonnelldean haven't played with one of these in quite a while, so just attempting to clarify a comment for others:

    'but otherwise works.'
    'it always looks like the screenshot provided, hung.'

    By 'otherwise works' does entering commands in the Left-Hand console side provide expected output?

    When does the state 'hung' occur? Could it be related to the comment that follows?



    I noticed that reset() is being used without an argument. Was this intentional?

    http://www.espruino.com/Reference#l__global_reset

    Has reset(true) been tried before disconnect and the (next) connection attempt?



    Is 'Erase Flash' being used between version changes?

    http://www.espruino.com/ESP8266_Flashing



    Were these the instructions that are being followed?

    http://forum.espruino.com/conversations/335394/



    What PC/OS is in use? (Win10,Mac,Linux)

  • The "garbage" in the beginning is because the ESP8266's sends debug messages through the UART at a different baud rate. So that part is expected.

    But (unless you intentionally pressed reset on the ESP when you tried to connect) I think something is not correct with the reset / Serial adapter circuit of your board. It should not start up when it's powered, and that garbage should long be gone by the time you connect to it.
    This might be the reason why the web ide hangs: garbage sent first, and that "confuses" the IDE.

    What board do you have?

  • Hi Robin, thanks for your response, to answer you questions in order:

    • Otherwise means I can connect to it via a terminal app, I still get garbage but the REPL is usable when I connect with "screen /my/port/here " for instance. If I do a reset(true) in the repl the restart happens and I get no garbage (I only get garbage on connection), again only via a terminal session.

    • I cannot use the IDE left hand (or right hand at all). The reset bit is a hold over and should not be considered (I simply didn't clear out the editor before screenshot. When in the IDE, neither left or right pane worked as the device is always stuck in "connecting" mode. The splash loads but otherwise the repl is hung.

    • Yes, I erase using the same baud as I flash too (I don't know if that makes a difference)

    • Yes and also later threads where "4m-c1" is used (based on observing my chip code and using the reference in the docs). Interestingly my board(s) needs dio, not qio to be set to flash properly.

    • OSX (esptool v2.8)

  • This is interesting info! I have a bunch of different ones. Specifically this is trying a D1 (big style NodeMCU like board) and a few D1 Mini's. I think they are all using a CH340 chip for serial.

    EDIT:
    I'd like to confirm that the length of time doesn't matter. The garbage is reproduced for every connection regardless of how long I let it start up and stay idle.

    I can also confirm the board itself is not hung. I can get it to spit something out on a timeout which does happen even though the IDE says it is still "connecting".

    I might have a look through the Web Terminal code tonight. My suspicion is that while it won't fix the issue directly, the IDE problem is likely the garbage tripping up the IDE and making it think it is still waiting for connection, even though in the background it is connected (as evidenced by the timeout test).

  • Hi all, I thought this might help folks out, in the end flashing was not the problem at all, it was using a USB adapter to extend the number of USB's I had available, this seems to have borked the flashing.

    I confirmed with a few other folks that they also get the junk at the top which, as was mentioned, is just debug bits with at a different baud.

    I am now able to flash all varius ESP boards I have, and can confirm the combined file is fine:

    esptool.py 
      --port /dev/cu.wchusbserial1410 
      --baud 115200 
      write_flash 
      --flash_freq 80m 
      --flash_mode dio 
      --flash_size 4MB-c1 0x0000 
      espruino_2v04_esp8266_4mb_combined_4096.bin
    

    I have another few boards to set up too so I can confirm all is good. But just a note to all others, if your having serial problems and are using a USB hub, that is likely why.

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

[Resolved] Flashing an ESP8266EX results in garbage output on boot

Posted by Avatar for mcdonnelldean @mcdonnelldean

Actions