esp8266nodemcumicropythonmcu

ESP8266 NodeMCU MicroPython garbage in serial, cannot erase_flash or upload files


Looks like I broke my NodeMCU Lolin esp8266 module, please confirm)

Firstly everything worked fine, but then...

  1. I uploaded a bit strange boot.py to play with UART0
#boot.py
import uos, machine
import gc
gc.collect()

import esp
import time

esp.osdebug(None)
uart = machine.UART(0, 115200)

def uart_test():
    print('before disabling REPL on UART')
    uos.dupterm(None, 1) # disable REPL on UART(0)
    print('after detaching REPL')
    time.sleep(5)
    uart.write('123')
    r=uart.read()
    # reattach REPL
    uos.dupterm(uart, 1)
    print('after attaching REPL')
    print('r: ')
    print(r)
  1. Then I uploaded main.py with blink in infinity loop with time.sleep() to check state while I mount module in box.
#main.py
import time
from machine import Pin, Signal

led = Signal(2, mode=Pin.OUT, invert=True)
while True:
    led.on()
    time.sleep(1)
    led.off()
    time.sleep(1)
  1. Then, when I was mounting module in box I accidentally tore one element from PCB, but then solder it back. I don't know what is this element and what purpose of it. I marked this element on image IMG: broken element

And after all of that I cannot connect to module by serial port, I see only garbage in screen, tried different baud rates. IMG: screen is empty and doesen't react to keys or Ctrl+C

After resetting board only garbage in screen IMG: garbage after reset

Also I cannot erase flash using esptool.

MCU is working because when it powered led is blinking as it programmed in main.py

I tried to enable bootloader mode by connecting GPIO0 with GND, blink is not working in this mode, but esptool.py also doesn't work in this mode. esptool log

python3 -m esptool --port /dev/cu.usbserial-142240 --baud 9600 erase_flash
esptool.py v3.1
Serial port /dev/cu.usbserial-142240
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header

esptool log with --trace arg

python3 -m esptool --port /dev/cu.usbserial-142240 --baud 115200 --trace erase_flash
esptool.py v3.1
Serial port /dev/cu.usbserial-142240
Connecting...TRACE +0.000 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes: 
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.023 Read 1 bytes: e2
TRACE +0.000 Read invalid data: e2
TRACE +0.000 Remaining data in serial buffer: 
    6efe6ee43cfe2792 07eceeee708ef21c | n.n.<.'.....p...
    1e0e1c906e6c6c1c 9227c71eeee76c   | ....nll..'....l
.TRACE +0.056 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes: 
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.002 Read 1 bytes: ee
TRACE +0.000 Read invalid data: ee
TRACE +0.000 Remaining data in serial buffer: 
    240eec6e9c9c8c9c e70e026c6ce4ee9c | $..n.......ll...
    6e6e00f26c62e4ee 70e26ee2ec626c   | nn..lb..p.n..bl
...
# and a lot of similar messages

What is with my nodemcu module is it died or not? What can I try to do?


Solution

  • Conclusion:

    Today I received USB to UART converter, connected it to TX and RX of my ESP8266 board and everything works well. So the problem is with onboard CH340 converter.