How to flash MIcroPython onto ESP-32s
An excellent reference is the official MicroPython one here.
Windows guide made at PyConZA sprints 2018
- Install CP210x drivers
- Find out COM port (in this case COM3)
- https://www.mathworks.com/help/supportpkg/arduinoio/ug/find-arduino-port-on-windows-mac-and-linux.html
- esptool.py --chip esp32 --port COM3 erase_flash
wget http://micropython.org/resources/firmware/esp32-20180511-v1.9.4.bin
- Note that this is now an old firmware
- esptool.py --chip esp32 --port COM3 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin
- Putty over serial to COM3 with baud rate 115200
import webrepl_setup
- On flash, the AP mode was not enabled
import network
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect('Brave-Fiber-Ruckus', 'braveGl0bal')
- Leave putty open, or else all this will be undone
- Load up a webrepl
- Connect via WebREPL
-
Download boot.py from the device and update it with the following lines:
1 2 3 4 5 6 7 8 9 10 11 12 13
import webrepl import network webrepl.start() sta_if = network.WLAN(network.STA_IF) if not sta_if.isconnected(): print('connecting to network...') sta_if.active(True) # Note that your WiFi details will be different sta_if.connect('WiFi SSID', 'password') while not sta_if.isconnected(): pass print('network config:', sta_if.ifconfig())
-
Send the updated file back to device.
- Now you can close Putty, reboot the device and it will immediately be on the network.
Reference pin-outs