Flashing micropython on Wemos D1 Mini Pro

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
blckpstv
Posts: 28
Joined: Thu Dec 15, 2016 9:11 pm
Location: Belgium

Flashing micropython on Wemos D1 Mini Pro

Post by blckpstv » Wed Dec 28, 2016 6:07 pm

I'm following a guide to flash micropython on the Wemos D1 Mini Pro and I get the following error.

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 460800 write_flash --flash_size=detect 0 esp8266-2016-05-03-v1.8.bin
usage: esptool write_flash [-h] [--flash_freq {40m,26m,20m,80m}]
[--flash_mode {qio,qout,dio,dout}]
[--flash_size {detect,4m,2m,8m,16m,32m,16m-c1,32m-c1,32m-c2}]
[--no-progress] [--verify]
<address> <filename> [<address> <filename> ...]
esptool write_flash: error: argument <address> <filename>: [Errno 2] No such file or directory: 'esp8266-2016-05-03-v1.8.bin'

Where do I get the bin and where do I place it?

tutorial link

https://docs.micropython.org/en/latest/ ... intro.html

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Flashing micropython on Wemos D1 Mini Pro

Post by Roberthh » Wed Dec 28, 2016 8:08 pm

Here
http://micropython.org/download/
are all the binaries. You can take any build from the esp8266 section, and use that filename in the load command.

blckpstv
Posts: 28
Joined: Thu Dec 15, 2016 9:11 pm
Location: Belgium

Re: Flashing micropython on Wemos D1 Mini Pro

Post by blckpstv » Wed Dec 28, 2016 9:23 pm

Ok so I did that and flashed the new bin file.

resulting :

Code: Select all

esptool.py v1.2.1
Connecting...
Warning: Could not auto-detect Flash size (FlashID=0x1840ef, SizeID=0x18), defaulting to 4m
Running Cesanta flasher stub...
WARNING: Unlikely to work as data goes beyond end of flash. Hint: Use --flash_size
Flash params set to 0x0200
Writing 569344 @ 0x0... 569344 (100 %)
Wrote 569344 bytes at 0x0 in 49.4 seconds (92.3 kbit/s)...
Leaving...
When I look in Coolterm nothing shows up directly.

When I reset my Wemos D1 Mini Pro 16mb
I get loads and loads of asci data that is not readable. Checked every baudrate.

Also the led keeps on blinking? Is this because my Wemos module is connected to a usb uart?

User avatar
ernitron
Posts: 89
Joined: Fri Jun 03, 2016 5:53 pm
Location: The Netherlands

Re: Flashing micropython on Wemos D1 Mini Pro

Post by ernitron » Wed Dec 28, 2016 11:15 pm

This is almost a FAQ ;)

The symptoms are pretty clear: your chip goes into a rebooting loop (that's why it blinks continuously and you see a lot of garbage on uart whatever speed you set). The cause most probably, is because esptool.py flashed a WeMos D1 Mini Pro with 4m but it has 128mb (16MB) flash.

Moreover, your esptool.py fails to get the right size with detect because is probably outdated. I would recommend to:

1. Read carefully the three topics at head of esp8266 forum. The ones by pfalcon which has more detailed instruction on get and check the development environment especially this http://forum.micropython.org/viewtopic.php?f=16&t=1689
2. Update the whole toolchain (esp-open-sdk with xtensa compiler, micropython 1.8.6, esptool.py, etc)
3. Make erase first (then reset the machine)
4. Make flash with -fs 128m or with auto detect which works on WeMos D1 Mini and latest version of esptool.py

If it can help, this is an excerpt from a Makefile I use to install software from scratch (I use a WeMos D1 Mini with 4MB=32mb).
Change according to your configuration.

Code: Select all

# Serial port configuration
# Windows
#PORT=/dev/cu.SLAB_USBtoUART
# MAC
#PORT=/dev/ttyACM0
# Linux Debian/Ubuntu
PORT=/dev/ttyUSB0

SPEED=115200

# Path to programs
MPYCROSS=/opt/ESP8266/micropython/mpy-cross/mpy-cross
ESPTOOL=/opt/ESP8266/esp-open-sdk/esptool/esptool.py
# Install with sudo pip2 install adafruit-ampy
AMPY=ampy -p $(PORT)
FIRMWARE=/opt/ESP8266/micropython/esp8266/build/firmware-combined.bin

erase:
        $(ESPTOOL) --port $(PORT) erase_flash

flash:
        @echo "Be sure about MEMORY SIZE"
        $(ESPTOOL) --port $(PORT) --baud 115200 write_flash --verify --flash_size=32m --flash_mode=qio 0x00000 $(FIRMWARE)        
        @echo 'Power device again'


blckpstv
Posts: 28
Joined: Thu Dec 15, 2016 9:11 pm
Location: Belgium

Re: Flashing micropython on Wemos D1 Mini Pro

Post by blckpstv » Thu Dec 29, 2016 10:40 pm

Hi,

I followed Pfalcons info https://github.com/micropython/micropyt ... er/esp8266

And got to the make -C mpy-cross

But this isn't a directory on the case-sensitive img.

So i'm stuck a tried to build/make the crosstool-NG and that worked. But that didn't gave me the esp8266 folder to flash the micropython on the wemos.

The github doesn't follow the older info on this page http://docs.micropython.org/en/latest/e ... intro.html

Any idea.

Also I don't really know how to make a makefile like yours, so I can't really redo that to try it that way.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Flashing micropython on Wemos D1 Mini Pro

Post by pythoncoder » Sat Dec 31, 2016 7:22 am

I'm a bit puzzled as to what you're trying to achieve. There are two approaches, depending on your needs and/or level of experience. The first set of instructions you referenced, from @pfalcon, are intended for experienced users who want to build the firmware from source. Unless you have specific reasons for building from source I'd recommend downloading and installing a standard binary build.

The second set of instructions, from the official documentation, are what you need if you wish to do this. Note that the line

Code: Select all

esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-2016-05-03-v1.8.bin
will need adapting for the name of the firmware file you've downloaded. You might also want to try 115200 in place of 460800 if you have problems.

If following those instructions fails please post a message explaining what goes wrong.
Peter Hinch
Index to my micropython libraries.

igraczech
Posts: 3
Joined: Mon Jan 02, 2017 9:45 pm

Re: Flashing micropython on Wemos D1 Mini Pro

Post by igraczech » Mon Jan 02, 2017 9:48 pm

I have to say I have same issue with Wemos D1 mini Pro (blinking and not responding to USB except for erase_flash), where I have used 512k image from http://micropython.org/resources/firmwa ... efd650.bin

igraczech
Posts: 3
Joined: Mon Jan 02, 2017 9:45 pm

Re: Flashing micropython on Wemos D1 Mini Pro

Post by igraczech » Mon Jan 02, 2017 9:54 pm

So I've changed baud rate to 74880 and that discovered following debug log on the serial port:

#0 ets_task(40209c10, 31, 3ffe9000, 4)
rf_cal[0] !=0x05,is 0xFF

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 31812, room 16
tail 4
chksum 0xd9
load 0x3ffe8000, len 1068, room 4
tail 8
chksum 0x17
load 0x3ffe8430, len 3000, room 0
tail 8
chksum 0x99
csum 0x99

igraczech
Posts: 3
Joined: Mon Jan 02, 2017 9:45 pm

Re: Flashing micropython on Wemos D1 Mini Pro

Post by igraczech » Mon Jan 02, 2017 10:02 pm

Also it happens with other firmwares than Micropython (just tried NodeMCU and it behaves the same).

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Has anyone had success?

Post by pythoncoder » Tue Jan 03, 2017 8:08 am

Is there an issue with the D1 Mini Pro? The D1 Mini works fine and is widely used. Alas I don't have a Pro: has anyone managed to run MicroPython on one?

There is this issue https://github.com/micropython/micropython/issues/2335 which appears unresolved.
Peter Hinch
Index to my micropython libraries.

Post Reply