Flashing the D1 Mini Lite

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Flashing the D1 Mini Lite

Post by deshipu » Thu Mar 30, 2017 6:28 pm

I just got this new WeMos board, with an esp8285 on board, and figured out I will try to flash it. A little bit of experimenting with different settings, and I got it working with --flash_size detect and --flash_mode dout using a recent esptool.py. That's it, just a note for others who might be trying it.

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

Re: Flashing the D1 Mini Lite

Post by mattyt » Sat Apr 01, 2017 10:11 am

Much appreciated deshipu! :) I have three of these boards on the way and it's nice to know it's that simple to flash them.

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Flashing the D1 Mini Lite

Post by devnull » Mon Apr 10, 2017 2:36 am

Just received a batch of these and can confirm that the flashing was a breeze.

Code: Select all

esptool.py --port /dev/tty.wchusbserialfa120 --baud 115200 write_flash --flash_mode=dout --flash_size=detect 0 esp8266-20170108-v1.8.7.bin
I can login to the REPL via usb, but are unable to access the file system via RAW REPL using ampy, mpfshell or rshell:

Code: Select all

ampy -p /dev/tty.wchusbserialfa120 ls

ampy.pyboard.PyboardError: could not enter raw repl

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

Re: Flashing the D1 Mini Lite

Post by Roberthh » Mon Apr 10, 2017 5:33 am

If you have REPL, can you enter raw REPL via Ctrl-A/Ctrl_B?
And if you enter:

Code: Select all

import uos
uos.listdir()
do you see files? If not, try erase_flash and reflash.

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Flashing the D1 Mini Lite

Post by devnull » Mon Apr 10, 2017 5:42 am

@roberthh - I can upload and download files using web-repl but not via the usb console.

os.listdir() does list the files and I have even re-formatted and tried again and the result is the same.

I can access other esp8266 devices from the same console using ampy, rshell, mpfshell, but not the mini lite.

All other REPL commands work fine, I can run libraries imported via web-repl but it just refuses to enter raw repl mode for the shell programs !

FYI - this device is using the ESP8285

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

Re: Flashing the D1 Mini Lite

Post by Roberthh » Mon Apr 10, 2017 5:48 am

That's strange, if you cannot enter raw REPL from the REPL prompt manually. Because that should not be in any way related to the model.

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Flashing the D1 Mini Lite

Post by devnull » Mon Apr 10, 2017 6:04 am

Sorrie, I have never attempted (never needed to) use RAW REPL before, I understand it is REPL without echo ?

I am using OSX, when in the REPL, If I type CTRL-A and then type any letter, the console immediately errors with:

Code: Select all

No Other Window
My intention was to print('hello') in RAW mode, but that throws the osx error above.

This same effect appears to happen on any device, not just the new wee mos, however all other esp8266 devices respond as expected to the ampy, rshell, mpfshell

It appears that in OSX screen app, ctrl-A is reserved:

Code: Select all

Interactive commands (default key bindings):

     Control-a ?    Display brief help
     Control-a "    List all windows for selection
     Control-a '    Prompt for a window name or number to switch to.
     Control-a 0    Select window 0
     Control-a 1    Select window 1
However I need to re-iterate that ampy, rshell and mpfshell all work in OSX, it is just that the screen utility reserves CTRL-A for it's onw usage.

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

Re: Flashing the D1 Mini Lite

Post by Roberthh » Mon Apr 10, 2017 6:13 am

Ctrl-A A should send Ctrl-A to the device.

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Flashing the D1 Mini Lite

Post by devnull » Mon Apr 10, 2017 6:24 am

Roberthh wrote:Ctrl-A A should send Ctrl-A to the device.
Ahh, yes that works, never needed to do that before.

That works on both the new wee-mos device and a esp-12/8266 device, but after closing the screen and running the ampy command to list the files, on the wee-mos I get the raw repl error and on the ESP-12S I get the list of files !

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Flashing the D1 Mini Lite

Post by devnull » Mon Apr 10, 2017 9:49 am

Well I have found how to hack / fix this, but are not sure why it is needed:

Code: Select all

    
    ### pyboard.py
    def enter_raw_repl(self):
        self.serial.write(b'\r\x03\x03') # ctrl-C twice: interrupt any running program

        # flush input (without relying on serial.flushInput())
        n = self.serial.inWaiting()
        while n > 0:
            self.serial.read(n)
            n = self.serial.inWaiting()
        
        time.sleep(0.5)  ## HACK FOR 8285 / WEE-MOS MINI LITE #
I believe that the esp8285 may output additional characters or data during bootup that the 8266 (and possibly other devices) don't, and that this means that the device is not ready when enter_raw_repl() is called.

I have injected this delay in the first position that worked and have not researched alternative or better ways of doing this.

Post Reply