This is an old revision of the document!
Table of Contents
Micropython
Python for microcontrollers.
Setup
ESP32
To reset the device for access by esptool, hold IO0 and tap EN. Release IO0.
Erase flash chip
esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash esptool.py v3.0-dev Serial port /dev/ttyUSB0 Connecting........_____. Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 30:ae:a4:fe:03:80 Uploading stub... Running stub... Stub running... Erasing flash (this may take a while)... Chip erase completed successfully in 6.4s Hard resetting via RTS pin...
Fetch firmware
wget "http://micropython.org/resources/firmware/esp32-idf3-20200816-unstable-v1.12-665-g60f5b941e.bin"
Write flash chip
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 esp32-idf3-20200816-unstable-v1.12-665-g60f5b941e.bin esptool.py v3.0-dev Serial port /dev/ttyUSB0 Connecting........_ Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 30:ae:a4:fe:03:80 Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Auto-detected Flash size: 4MB Compressed 1448240 bytes to 925586... Wrote 1448240 bytes (925586 compressed) at 0x00001000 in 23.4 seconds (effective 495.0 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
Verify flash
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 verify_flash 0x1000 esp32-idf3-20200816-unstable-v1.12-665-g60f5b941e.bin esptool.py v3.0-dev Serial port /dev/ttyUSB0 Connecting........_____....._____....._ Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 30:ae:a4:fe:03:80 Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Auto-detected Flash size: 4MB Verifying 0x161930 (1448240) bytes @ 0x00001000 in flash against esp32-idf3-20200816-unstable-v1.12-665-g60f5b941e.bin... -- verify OK (digest matched) Hard resetting via RTS pin...
Run
picocom -b 115200 /dev/ttyUSB0 picocom v3.1 port is : /dev/ttyUSB0 flowcontrol : none baudrate is : 115200 parity is : none databits are : 8 stopbits are : 1 escape is : C-a local echo is : no noinit is : no noreset is : no hangup is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv -E imap is : omap is : emap is : crcrlf,delbs, logfile is : none initstring : none exit_after is : not set exit is : no Type [C-a] [C-h] to see available commands Terminal ready MPY: soft reboot MicroPython v1.12-665-g60f5b941e on 2020-08-16; ESP32 module with ESP32 Type "help()" for more information.