Page 1 of 2

Flashing the D1 Mini Lite

Posted: Thu Mar 30, 2017 6:28 pm
by deshipu
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.

Re: Flashing the D1 Mini Lite

Posted: Sat Apr 01, 2017 10:11 am
by mattyt
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.

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 2:36 am
by devnull
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

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 5:33 am
by Roberthh
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.

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 5:42 am
by devnull
@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

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 5:48 am
by Roberthh
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.

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 6:04 am
by devnull
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.

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 6:13 am
by Roberthh
Ctrl-A A should send Ctrl-A to the device.

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 6:24 am
by devnull
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 !

Re: Flashing the D1 Mini Lite

Posted: Mon Apr 10, 2017 9:49 am
by devnull
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.