Cannot start REPL after successful flash

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
mjoelner
Posts: 3
Joined: Sat Mar 12, 2016 12:57 pm

Cannot start REPL after successful flash

Post by mjoelner » Sat Mar 12, 2016 1:23 pm

I have two esp8266 boards:
* esp8266-01
* Olimex esp8266 - https://www.olimex.com/Products/IoT/MOD ... e-hardware

I can flash both boards successfully but when I connect to the REPL I just get a blank screen. I press 'Enter' but nothing happens.

I can flash and run C programs on both the esp8266 boards that I have so there is nothing wrong with the boards.

After flashing C programs the programs automatically start to run without changing any pin levels. Is that not true for micropython? Do I need to put it into boot after flashing?

This is the flash command that I use:
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=2m 0 ../mp-esp8266-firmware-v01.bin
Output:
Connecting...
Erasing flash...
Wrote 451584 bytes at 0x00000000 in 45.3 seconds (79.7 kbit/s)...

Leaving...

Then I connect to the REPL like this:
screen /dev/ttyUSB0
or
screen /dev/ttyUSB0 -b 115200

Edit:
I think I know the error.
By default micropython is compiled to use port /dev/ttyACM0 as the port but I have /dev/ttyUSB0.
Is this it (or at least one of the errors)?
Could you please supply one firmware with each port option so no build is needed?

Update:
I did try to erase the flash as described in the email:
esptool.py --port /dev/ttyUSB0 erase_flash
But the result was just "Connecting...". No confirmation.
Last edited by mjoelner on Sun Mar 13, 2016 1:02 pm, edited 1 time in total.

mjoelner
Posts: 3
Joined: Sat Mar 12, 2016 12:57 pm

Re: Cannot start REPL after successful flash

Post by mjoelner » Sat Mar 12, 2016 8:12 pm

On the Olimex board, if I unplug the board (remove the USB from the computer), unplug GPIO_0=0V and then plug the USB back in, I get a lot of UART activity back but no REPL. Just an endless stream of unredable characters.

I also tried setting GPIO_0 and 2 high but it is the same result as if they are not connected.

Any ideas?

User avatar
deshipu
Posts: 1346
Joined: Thu May 28, 2015 5:54 pm

Re: Cannot start REPL after successful flash

Post by deshipu » Sat Mar 12, 2016 8:55 pm

Don't forget to erase the flash completely. Sometimes, when the configuration area of the flash gets into a certain state, those boards get into a restart loop.

mad474
Posts: 60
Joined: Sun Dec 29, 2013 7:48 pm

Re: Cannot start REPL after successful flash

Post by mad474 » Sat Mar 12, 2016 11:23 pm

mjoelner wrote:screen /dev/ttyUSB0 -b 115200 ... stream of unredable characters ...
Any ideas?
Try picocom:

Code: Select all

picocom -b 115200 /dev/ttyUSB0
Or use screen and omit "-b":

Code: Select all

screen /dev/ttyUSB0 115200
Last edited by mad474 on Sat Mar 12, 2016 11:54 pm, edited 2 times in total.

slzatz
Posts: 92
Joined: Mon Feb 09, 2015 1:09 am

Re: Cannot start REPL after successful flash

Post by slzatz » Sun Mar 13, 2016 3:24 am

My experience after my first attempt at flashing the adafruit huzzah feather is to have the following characters on the screen after a bunch that are unreadable and the esp8266 is unresponsive. Any thoughts?

Code: Select all

lbl▒▒l▒could not find module 'boot'

>>>
MicroPython v1.6-214-ge5c39a3 on 2016-03-12; ESP module with ESP8266
Type "help()" for more information.
>>> #4 ets_task(40100470, 2, 3fff8a04, 16)
task prio out of range: 2
task prio out of range: 2

mjoelner
Posts: 3
Joined: Sat Mar 12, 2016 12:57 pm

Re: Cannot start REPL after successful flash

Post by mjoelner » Sun Mar 13, 2016 12:45 pm

I got an advice from the IRC channel to flash the device with some NodeMcu files:
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=2m 0x7E000 ../luabins/blank.bin
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=2m 0x7C000 ../luabins/esp_init_data_default.bin

After doing that successfully I tried to flash the micropython firmware but it did not work. After unplugging the USB and then plugging it back in I could flash the firmware but still no luck with the REPL.
I used:
picocom -b 115200 /dev/ttyUSB0

I got garbage back from the terminal but at 9600 at least I had some time to read the beginning of the screen:
xxxx@yyyy:~/dev/esp8266/esptool$ sudo picocom -b 9600 /dev/ttyUSB0
picocom v1.7

port is : /dev/ttyUSB0
flowcontrol : none
baudrate is : 9600
parity is : none
databits are : 8
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv
imap is :
omap is :
emap is : crcrlf,delbs,

Terminal ready
22 20 08 31 41 31 dd c8 21 4a 22 d8 11 12 c1 10 0d f0 1�i!BH)HBB��!!
�HBHRRSBRR!Bh�BBBiB
BRBJRj�BiBbBB)bjfBc@)BBBH%BRBHcS!`BBB�
%!
ZJ)Bi))J�C#B!RBR)!9FBB!RH!j!BBBJB)+JCJBΚjBJ�)BJ!B B�HR;!
HB)FB)1BJB!BR!BRBBHR!JRBCR!B8�A)
9J!RI#!R�RB!!QS!HR)HHC�HB�R�)����rHR"v
����H�Y:y�k��BB)B�����^gB�jR�H��jR�HΈ����BBBJB
B
RK)BB-BB)K�V9H!rBbRB�!NB�RRRBBHb1
�HBRBb�B%R�B!
RR�CGBRR9k)BB)�BBBCBb�BB!RΧ)BHR)�)�JBJRB!B)B��B�!LBRRBLBBK)B
�Xq!J!bJa !BBBaR1k!�(�RB!(�B3RHRJRRBRBH�R!BJ!�Bj�BBR)!J b�!�
RjZ!
B��BBBB9! F�CX)ƄHR1HbRFB
RjR:nBJB
R+F�B
B
BBCBN)Bj!BQ!JB!J-B
BBC)X�B!J!R9Bk!B))
!BZB��)Ri�H!j��BiRK)B3�H�!B+!J�)�RB1JR1RBB) !
1J)BB)CB+)�B�B K�B-j!Bk�BQC)�5RR!LJBBBBB!*)BBR3�HR!H)�B)H!�ÄfBcbBXaR
)�))=R9JBRR!HRH!j!BBBJB)+JCJBΚjBJ�)BJ!B B�HR;!
HB)FB)1BJB!BR!BRBBHR!JRBCR!B8�A)
9J!RI#!R�RB!!QS!HR)HHC�HB�R�)����rHRv
�곇I�Y9�w#!CBB�BzCB
�^gB�jR�H��jR�H�(����BBBJB
B
RK)BB-BB)K�V9H!rBbRB�!NB�RRRBBHb1
�HBRBb�B%R�B!
RR�CGBRR9k)BB)�BBBCBb�BB!RΧ)BHR)�)�JBJRB!B)B��B�!LBRRBLBBK)B
�Xq!J!bJa !BBBaR1k!�(�RB!(�B3RHRJRRBRBH�R!BJ!�Bj�BBR)!J b�!�
RjZ!
B��BBBB9! F�CX)ƄHR1HbRFB
RjR:nBJB
R+F�B
B
BBCBN)Bj!BQ!JB!J-B
BBC)X�B!J!R9Bk!B))
!BZB��)Ri�H!j��BiRK)B3�H�!B+!J�)�RB1JR1RBB) !
1J)BB)CB+)�B�B K�B-j!Bk�BQC)�5RR!LJBBBBB!*)BBR3�HR!H)�B)H!�ÄfBcbBXaR
)�))=R9JBRR!HRH!j!BBBJB)+JCJBΚjBJ�)BJ!B B�HR;!
HB)FB)1BJB!BR!BRBBHR!JRBCR!B8�A)
9J!RI#!R�RB!!QS!HR)HHC�HB�R�)��ƒRvJ����H�Y9�k��BB)B�����^gB�jR�H��jR�H����BBBJB
B
RK)BB-BB)K�V9H!rBbRB�!NB�RRRBBHb1

At 115200:
xxxx@yyyy:~/dev/esp8266/esptool$ sudo picocom -b 115200 /dev/ttyUSB0
picocom v1.7

port is : /dev/ttyUSB0
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv
imap is :
omap is :
emap is : crcrlf,delbs,

Terminal ready
!RJH�08 71 c8 61 d8 51 e8 41 f8 31 12 c1 20 0d f0 00 00 00 12 c1 f0 09 31 c5 b3 0e 08 31 12 c1
10 0d f0 00 68 99 26 40 12 c1 f0 c2 61 02 02 61 03 45 b2 0e 20 c2 20 c6 01 00 00 00 85 b0 03 16
e2 00 c0 2c 20 05 bc 0e 56 02 ff 21 f6 ff 86 00 00 21 43 e2 08 31 c8 21 12 c1 10 0d f0 00 00 00

deshipu wrote:Don't forget to erase the flash completely. Sometimes, when the configuration area of the flash gets into a certain state, those boards get into a restart loop.
You gave me the advice to flash with the Lua files. Is that what you mean by erasing the flash completely or is there another way?
I tried the way described in the email from micropython: esptool.py --port /dev/ttyUSB0 erase_flash
But the result was just "Connecting...". No confirmation.

gschmott
Posts: 6
Joined: Sun Mar 13, 2016 5:03 pm

Re: Cannot start REPL after successful flash

Post by gschmott » Sun Mar 13, 2016 5:11 pm

slzatz wrote:My experience after my first attempt at flashing the adafruit huzzah feather is to have the following characters on the screen after a bunch that are unreadable and the esp8266 is unresponsive. Any thoughts?

Code: Select all

lbl▒▒l▒could not find module 'boot'

>>>
MicroPython v1.6-214-ge5c39a3 on 2016-03-12; ESP module with ESP8266
Type "help()" for more information.
>>> #4 ets_task(40100470, 2, 3fff8a04, 16)
task prio out of range: 2
task prio out of range: 2
If it's any comfort, I'm seeing the identical thing after flashing a plain-vanilla ESP-12 module. It seems the indication that it could not find the module 'boot' is a very bad thing. ;) I hope someone can point us in the right direction with respect to this missing module. As a recent Kickstarter backer I'd like to play around with the image even though it's still a few weeks away from a general release.

mad474
Posts: 60
Joined: Sun Dec 29, 2013 7:48 pm

Re: Cannot start REPL after successful flash

Post by mad474 » Sun Mar 13, 2016 5:48 pm

gschmott wrote:indication that it could not find the module 'boot' is a very bad thing. ;) I hope someone can point us in the right direction
The boot module is not essential. If you follow the suggestions over here and on the other thread starting with http://forum.micropython.org/viewtopic. ... 1631#p9388 which is referring to this Github issue https://github.com/micropython/micropython/issues/1895 you should be getting a working REPL.

gschmott
Posts: 6
Joined: Sun Mar 13, 2016 5:03 pm

Re: Cannot start REPL after successful flash

Post by gschmott » Sun Mar 13, 2016 7:07 pm

mad474 wrote:
gschmott wrote:indication that it could not find the module 'boot' is a very bad thing. ;) I hope someone can point us in the right direction
The boot module is not essential. If you follow the suggestions over here and on the other thread starting with http://forum.micropython.org/viewtopic. ... 1631#p9388 which is referring to this Github issue https://github.com/micropython/micropython/issues/1895 you should be getting a working REPL.
Yep, that did the trick for me. I now have a working REPL. Thanks for the help!

crizeo
Posts: 41
Joined: Sun Aug 06, 2017 12:55 pm
Location: Germany

Re: Cannot start REPL after successful flash

Post by crizeo » Tue Mar 19, 2019 10:14 pm

Just for those coming across this post: I had the same problem, checked my setup (bare ESP8266 module) 100+ times and it definitely was correct. I could flash the ESP most of the times, but could not connect afterwards. Problem had something to do with my breadboard/wiring; bad junctions (maybe because of dirt/glue). Did the exact same wiring on another board with cleaned resistors, now it works.

Post Reply