failed flash of nodemcu esp8266

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
tmountjr
Posts: 4
Joined: Thu Mar 10, 2022 3:40 pm

failed flash of nodemcu esp8266

Post by tmountjr » Thu Mar 10, 2022 3:48 pm

Hey all, I've been following the docs on installing MicroPython on my Amica NodeMcu 8266. I have a RPi Pico and have been using "screen" on my mac to connect to the repl on that hardware, so I figured it'd work on this as well. I downloaded the normal 2+MiB flash (v1.18) and used esptool.py to flash the board. The flash succeeds but the onboard LED (pin 2, on the actual ESP, not the dev board) started flashing like crazy. When I connected to the serial console my terminal started filling up with ascii junk characters non-stop (not like one or two, literally printing characters non-stop). Couldn't get into the actual repl; had to use Ctrl+A+\ to quit the connection. I ran "esptool.py erase_flash" and reflashed, and this time the light isn't going crazy, but when I go into the serial console again there are just a handful of the same junk characters printed, and then nothing - can't use Ctrl+D to reboot, can't get to the prompt, etc. I've tried flashing with a lower baud rate (115200; when I tried 74880 the tool wouldn't even connect) and still got nowhere. Are there any other steps I can try?

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

Re: failed flash of nodemcu esp8266

Post by Roberthh » Thu Mar 10, 2022 3:53 pm

try the flash-mode option variants of esptool.py, like
-fm=dio
or
-fm=dout

tmountjr
Posts: 4
Joined: Thu Mar 10, 2022 3:40 pm

Re: failed flash of nodemcu esp8266

Post by tmountjr » Thu Mar 10, 2022 5:28 pm

I tried "-fm dout" - that got me a little farther:
* I can now get a prompt two out of three resets.
* Only once have I been able to type into the terminal on that prompt. Ctrl+D doesn't work (it's like it's not accepting input).
* Using ampy, I can push up a blink sketch and download boot.py even when the serial console is "frozen". The main.py will run, but instead of blinking it seems to freeze right after enabling the led:

Code: Select all

from machine import Pin
import time

led = Pin(2, Pin.out)
for i in range(20):
  led.toggle()
  time.sleep(0.5)

tmountjr
Posts: 4
Joined: Thu Mar 10, 2022 3:40 pm

Re: failed flash of nodemcu esp8266

Post by tmountjr » Thu Mar 10, 2022 5:37 pm

As a followup...I was either following the wrong tutorial or had a moment...using this code seems to blink and then complete the program:

Code: Select all

from machine import Pin
import time

led = Pin(2, Pin.OUT)

for i in range(20):
  print(i)
  led.on()
  time.sleep(0.5)
  led.off()
  time.sleep(0.5)
And I can see the counter incrementing when I connect to the serial console. So I suppose it's mostly working, though I'm still unclear why the serial console won't let my type anything, even after the program finishes executing. Worth noting that I thought maybe it was just a quirk with the screen program and tried using the serial monitor within the Arduino app - same thing, sending lines there will put the line on the screen but not execute them.

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

Re: failed flash of nodemcu esp8266

Post by Roberthh » Thu Mar 10, 2022 5:50 pm

Do you have a modem manager running? These send sometimes commands to an attached serial device, like ctrl-a , which switches the device to raw mode. To end raw mode, press ctrl-b.

tmountjr
Posts: 4
Joined: Thu Mar 10, 2022 3:40 pm

Re: failed flash of nodemcu esp8266

Post by tmountjr » Thu Mar 10, 2022 5:56 pm

Nothing like that - only oddball thing I can think is that I'm using one of those OTG adapters because I don't have a Micro USB-to-USB C cable (TIL they do exist and I may buy one). Tried Ctrl+B in the frozen terminal (along with D and C) and got nothing. Running "lsof | grep tty" shows that nothing else is trying to connect to that particular device. The screen app itself is responsive, I can hit ctrl+A and then ? and get into the help screen, and all the other commands seem to be registering.

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

Re: failed flash of nodemcu esp8266

Post by Roberthh » Thu Mar 10, 2022 7:19 pm

Cables & adapters are always a problem.
There are USB-C to cables available, e.g. at Amazon, and USB-C to USB-Micro adapters at both directions.

Post Reply