Reset trouble with ESP8266 and MicroPython

While preparing boards for a workshop, I got some WeMos D1 mini (ESP8266) modules that continuously reset just after MicroPython boot. Here’s how I flashed them and how I fixed:

To flash MicroPython:
esptool.py –port /dev/ttyUSB0 erase_flash

esptool.py –port /dev/ttyUSB0 –baud 115200 write_flash –flash_size=detect -fm dio 0 esp8266-20210418-v1.15.bin

After resetting, the board continuously resets. The problem is a power issue related to MicroPython when it started its default Access Point.

To fix the problem, simple disable the AP mode just after the board boots:

minicom -b 115200 -D /dev/ttyUSB0

import network; network.WLAN(network.AP_IF).active(False)

The commands above should fix the issue. Then you can connect to an existing Access Point:
import network
sta_if = network.WLAN(network.STA_IF); sta_if.active(True)
sta_if.connect("<**>", "<**>")
print(sta_if.isconnected())

Helpful link:
https://forum.micropython.org/viewtopic.php?f=16&t=9046

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s