Uploading MicroPython to Wemos D1 leads to garbage

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
ris8_allo_zen0
Posts: 6
Joined: Sun Mar 11, 2018 4:55 pm

Uploading MicroPython to Wemos D1 leads to garbage

Post by ris8_allo_zen0 » Sun Mar 11, 2018 5:23 pm

Hi all,
I've used the my WeMos D1 Mini clone for other projects before, but seems like MicroPython doesn't want to run correctly.
I used the following command to flash (from https://docs.micropython.org/en/latest/ ... e-firmware):

esptool.py --port /dev/tty.wchusbserial1420 --baud 115200 write_flash --flash_size=detect 0 ~/Downloads/esp8266-20171101-v1.9.3.bin

Here's the output:

esptool.py v2.3.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0040
Compressed 600888 bytes to 392073...
Wrote 600888 bytes (392073 compressed) at 0x00000000 in 34.9 seconds (effective 137.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

And after typing "screen /dev/tty.wchusbserial1420 115200", this is all I get:

sdl��|�l�|�l�c|����r�c�c��og�lnn���cx��drlslx�g�

Typing on the keyboard doesn't show any reaction.

What I've tried so far:
* change baudrate of screen: just garbage of different length.
* change baudrate of esptool to 460800: uploading fails in the step "Configuring flash size...".
* uploading another program with PlatformIO: works fine.
* using the same esptool executable and command line of the PlatformIO program above: same result.
* adding parameter "-fm dio": the garbage output continues in loop.
* uploading a previous version like 1.8.7: same result.
* uploading a 512k version of 1.9.3: same result.

Thanks for any help or suggestion!
Kind regards,
Enrico

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by mattyt » Sun Mar 11, 2018 10:59 pm

I assume you've tried erasing the flash first?

Code: Select all

esptool.py --port /dev/tty.wchusbserial1420 erase_flash
Otherwise you've been trying the right things...

ris8_allo_zen0
Posts: 6
Joined: Sun Mar 11, 2018 4:55 pm

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by ris8_allo_zen0 » Mon Mar 12, 2018 8:16 am

[quote=mattyt post_id=26101 time=1520809160 user_id=2488]
I assume you've tried erasing the flash first?
[/quote]
I did erase the flash a couple of times, but not in all attempts. Will retry.

bitninja
Posts: 165
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by bitninja » Mon Mar 12, 2018 4:40 pm

Yes, you should definitely try erasing the flash first.

If that doesn't help there are a couple of caveats surrounding esptool.py, but I have not had any of these issues with any of my D1 Minis (or clones).
HTH

ris8_allo_zen0
Posts: 6
Joined: Sun Mar 11, 2018 4:55 pm

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by ris8_allo_zen0 » Mon Mar 12, 2018 9:06 pm

Erasing the flash then using "-fm dio" did the trick. Thanks!!!

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by mattyt » Mon Mar 12, 2018 10:31 pm

Yes, if you are still stuck @ris8_allo_zen0, please try to list the exact specs (or provide a link where you bought it?) of your clone and we'll be able to suggest the other more nitpicky parameters. :)

Henrique Miranda
Posts: 9
Joined: Sun Mar 18, 2018 3:05 pm

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by Henrique Miranda » Sat Mar 24, 2018 4:04 pm

[quote=ris8_allo_zen0 post_id=26111 time=1520888793 user_id=3811]
Erasing the flash then using "-fm dio" did the trick. Thanks!!!
[/quote]

Hi, i'm getting the same problem with my d1 mini, how exactly you solved your issue?

ris8_allo_zen0
Posts: 6
Joined: Sun Mar 11, 2018 4:55 pm

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by ris8_allo_zen0 » Sun Mar 25, 2018 12:44 pm

Henrique Miranda wrote:
Sat Mar 24, 2018 4:04 pm
Hi, i'm getting the same problem with my d1 mini, how exactly you solved your issue?
These are the commands:

Code: Select all

esptool.py --port /dev/tty.wchusbserial1420 --baud 115200 erase_flash
esptool.py --port /dev/tty.wchusbserial1420 --baud 115200 write_flash -fm dio --flash_size=detect 0 ~/Downloads/esp8266-20171101-v1.9.3.bin
"/dev/tty.wchusbserial1420" and "~/Downloads/" are specific to my environment, so you might need to change them.

Henrique Miranda
Posts: 9
Joined: Sun Mar 18, 2018 3:05 pm

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by Henrique Miranda » Sun Mar 25, 2018 1:07 pm

ris8_allo_zen0 wrote:
Sun Mar 25, 2018 12:44 pm
Henrique Miranda wrote:
Sat Mar 24, 2018 4:04 pm
Hi, i'm getting the same problem with my d1 mini, how exactly you solved your issue?
These are the commands:

Code: Select all

esptool.py --port /dev/tty.wchusbserial1420 --baud 115200 erase_flash
esptool.py --port /dev/tty.wchusbserial1420 --baud 115200 write_flash -fm dio --flash_size=detect 0 ~/Downloads/esp8266-20171101-v1.9.3.bin
"/dev/tty.wchusbserial1420" and "~/Downloads/" are specific to my environment, so you might need to change them.
I used now

Code: Select all

esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash -fm dio --flash_size=detect 0 esp8266-20180325-v1.9.3-477-g7b0a020a.bin
and i still geting a loop on serial using -baud at 74800(if i use diferent baud i get only garbages from serial)

Code: Select all

Fatal exception (0): 
epc1=0x4020e754, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

ris8_allo_zen0
Posts: 6
Joined: Sun Mar 11, 2018 4:55 pm

Re: Uploading MicroPython to Wemos D1 leads to garbage

Post by ris8_allo_zen0 » Sun Mar 25, 2018 1:26 pm

My "gotcha" was to do erase_flash before every attempt at write_flash. Also the usage of -fm dio, but your mileage may vary.
Also try a non-ultra-recent version of Micropython, like esp8266-20171101-v1.9.3.bin.

Post Reply