Skip to content

Commit 600e468

Browse files
projectgusdpgeorge
authored andcommitted
docs/esp32: Update tutorial flashing steps to match deploy.md.
Includes fixing the flashing address for newer SoCs, as reported in discussion https://github.com/orgs/micropython/discussions/16417 Also removes some redundant or out of date information, and adds links to the Espressif esptool docs which are quite comprehensive. Information about ESP32_GENERIC variants is moved to the board page, as it only applies to that board. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent d89e71e commit 600e468

File tree

2 files changed

+86
-58
lines changed

2 files changed

+86
-58
lines changed

docs/esp32/tutorial/intro.rst

+72-53
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,26 @@ Getting the firmware
3636

3737
The first thing you need to do is download the most recent MicroPython firmware
3838
.bin file to load onto your ESP32 device. You can download it from the
39-
`MicroPython downloads page <https://micropython.org/download#esp32>`_.
40-
From here, you have 3 main choices:
39+
`MicroPython download page`_. Search for your particular board on this page.
4140

42-
* Stable firmware builds
43-
* Daily firmware builds
44-
* Daily firmware builds with SPIRAM support
41+
.. note:: If you don't see your specific board on the download page, then it's
42+
very likely that one of the generic firmwares will work. These are
43+
listed at the top of the download page and have names matching the
44+
onboard Espressif chip (i.e. `ESP32 / WROOM`_, `ESP32-C3`_,
45+
`ESP32-S3`_, etc).
4546

46-
If you are just starting with MicroPython, the best bet is to go for the Stable
47-
firmware builds. If you are an advanced, experienced MicroPython ESP32 user
48-
who would like to follow development closely and help with testing new
49-
features, there are daily builds. If your board has SPIRAM support you can
50-
use either the standard firmware or the firmware with SPIRAM support, and in
51-
the latter case you will have access to more RAM for Python objects.
47+
However, you may need to double check with the vendor you purchased
48+
the board from.
49+
50+
From here, you have a choice to make:
51+
52+
* Download a stable firmware release.
53+
* Download a daily firmware "Preview" build.
54+
55+
If you are just starting with MicroPython, the best bet is to go for the stable
56+
Release firmware builds. If you are an advanced, experienced MicroPython ESP32
57+
user who would like to follow development closely and help with testing new
58+
features, then you may find the Preview builds useful.
5259

5360
.. _esp32_flashing:
5461

@@ -71,71 +78,83 @@ For best results it is recommended to first erase the entire flash of your
7178
device before putting on new MicroPython firmware.
7279

7380
Currently we only support esptool.py to copy across the firmware. You can find
74-
this tool here: `<https://github.com/espressif/esptool/>`__, or install it
81+
this tool here: `<https://docs.espressif.com/projects/esptool/>`__, or install it
7582
using pip::
7683

7784
pip install esptool
7885

79-
Versions starting with 1.3 support both Python 2.7 and Python 3.4 (or newer).
80-
An older version (at least 1.2.1 is needed) works fine but will require Python
81-
2.7.
82-
8386
Using esptool.py you can erase the flash with the command::
8487

85-
esptool.py --port /dev/ttyUSB0 erase_flash
88+
esptool.py erase_flash
89+
90+
.. note:: On Windows, the command may be named ``esptool`` not ``esptool.py``
91+
92+
Then deploy the new firmware. Use this command for original ESP32 and ESP32-S2 SoCs::
93+
94+
esptool.py --baud 460800 write_flash 0x1000 ESP32_BOARD_NAME-DATE-VERSION.bin
8695

87-
And then deploy the new firmware using::
96+
Use this command for all other SoCs (including ESP32-S3, ESP32-C3, and all newer chips)::
8897

89-
esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin
98+
esptool.py --baud 460800 write_flash 0 ESP32_BOARD_NAME-DATE-VERSION.bin
9099

91-
Notes:
100+
Replace ``ESP32_BOARD_NAME-DATE-VERSION.bin`` with the name of your firmware .bin file.
92101

93-
* You might need to change the "port" setting to something else relevant for your
94-
PC
95-
* You may need to reduce the baudrate if you get errors when flashing
96-
(eg down to 115200 by adding ``--baud 115200`` into the command)
97-
* For some boards with a particular FlashROM configuration you may need to
98-
change the flash mode (eg by adding ``-fm dio`` into the command)
99-
* The filename of the firmware should match the file that you have
102+
.. note:: If you're unsure which command line to use, check the `MicroPython
103+
download page`_ for your board. Each download page shows an accurate command
104+
line example for that board and its SoC.
100105

101106
If the above commands run without error then MicroPython should be installed on
102-
your board!
107+
your board! If the command fails, see :ref:`esp32_troubleshooting_install` below.
103108

104109
Serial prompt
105110
-------------
106111

107112
Once you have the firmware on the device you can access the REPL (Python prompt)
108-
over UART0 (GPIO1=TX, GPIO3=RX), which might be connected to a USB-serial
109-
converter, depending on your board. The baudrate is 115200.
113+
over either UART0, which might be connected to a USB-serial converter depending
114+
on your board, or the chip's built-in USB device. The baudrate is 115200.
110115

111116
From here you can now follow the ESP8266 tutorial, because these two Espressif chips
112117
are very similar when it comes to using MicroPython on them. The ESP8266 tutorial
113118
is found at :ref:`esp8266_tutorial` (but skip the Introduction section).
114119

120+
.. _esp32_troubleshooting_install:
121+
115122
Troubleshooting installation problems
116123
-------------------------------------
117124

118125
If you experience problems during flashing or with running firmware immediately
119-
after it, here are troubleshooting recommendations:
120-
121-
* Be aware of and try to exclude hardware problems. There are 2 common
122-
problems: bad power source quality, and worn-out/defective FlashROM.
123-
Speaking of power source, not just raw amperage is important, but also low
124-
ripple and noise/EMI in general. The most reliable and convenient power
125-
source is a USB port.
126-
127-
* The flashing instructions above use flashing speed of 460800 baud, which is
128-
good compromise between speed and stability. However, depending on your
129-
module/board, USB-UART converter, cables, host OS, etc., the above baud
130-
rate may be too high and lead to errors. Try a more common 115200 baud
131-
rate instead in such cases.
132-
133-
* To catch incorrect flash content (e.g. from a defective sector on a chip),
134-
add ``--verify`` switch to the commands above.
135-
136-
* If you still experience problems with flashing the firmware please
137-
refer to esptool.py project page, https://github.com/espressif/esptool
138-
for additional documentation and a bug tracker where you can report problems.
139-
140-
* If you are able to flash the firmware but the ``--verify`` option returns
141-
errors even after multiple retries the you may have a defective FlashROM chip.
126+
after flashing, here are some troubleshooting recommendations:
127+
128+
* Esptool will try to detect the serial port where your ESP32 is connected. If
129+
this doesn't work, or you have multiple serial ports, then you may need to
130+
manually specify the port by adding the ``--port`` option to the start of the
131+
``esptool.py`` command line. For example, ``esptool.py --port /dev/ttyUSB0
132+
<rest of line>`` for Linux or ``esptool --port COM4 <rest of line>`` for
133+
Windows.
134+
* If the board isn't responding to esptool at all, it may need to be manually
135+
reset into the bootloader download mode. Look for a button marked "BOOT" or
136+
"IO0" on your board and a second button marked "RESET" or "RST". If you have
137+
both buttons, try these steps:
138+
139+
1. Press "BOOT" (or "IO0") and hold it down.
140+
2. Press "RESET" (or "RST") and immediately release it.
141+
3. Release "BOOT" (or "IO0").
142+
4. Re-run the flashing steps from the download page.
143+
144+
If your board doesn't have these buttons, consult the board manufacturer's
145+
documentation about entering bootloader download mode.
146+
* If you get errors part-way through the flashing process then try reducing the
147+
speed of data transfer by removing the ``--baud 460800`` argument.
148+
* Hardware problems can cause flashing to fail. There are two common problems:
149+
bad power source quality, and defective hardware (especially very low cost
150+
unbranded development boards). Speaking of power source, not just raw amperage
151+
is important, but also low ripple and noise/EMI in general. The most reliable
152+
and convenient power source is a USB port.
153+
* If you still experience problems with flashing the firmware then please also
154+
refer to the `esptool Troubleshooting documentation`_.
155+
156+
.. _esptool Troubleshooting documentation: https://docs.espressif.com/projects/esptool/en/latest/esp32/troubleshooting.html
157+
.. _MicroPython download page: https://micropython.org/download/?port=esp32
158+
.. _ESP32 / WROOM: https://micropython.org/download/ESP32_GENERIC
159+
.. _ESP32-C3: https://micropython.org/download/ESP32_GENERIC_C3
160+
.. _ESP32-S3: https://micropython.org/download/ESP32_GENERIC_S3
+14-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
The following files are firmware that should work on most ESP32-based boards
22
with 4MiB of flash, including WROOM WROVER, SOLO, PICO, and MINI modules.
33

4-
If your board is based on a WROVER module, or otherwise has SPIRAM (also known
5-
as PSRAM), then use the "spiram" variant.
4+
This board has multiple variants available:
65

7-
The "d2wd" variant is for ESP32-D2WD chips (with 2MiB flash), and "unicore" is
8-
for single-core ESP32 chips (e.g. the "SOLO" modules). The "ota" variant sets
9-
up the partition table to allow for Over-the-Air updates.
6+
* If your board is based on a WROVER module, or otherwise has SPIRAM (also known
7+
as PSRAM) then it's recommended to use the "spiram" variant. Look for heading
8+
**Support for SPIRAM / WROVER)**.
9+
* If your board has a ESP32-D2WD chip (with only 2MiB flash) then use the "d2wd"
10+
variant. Look for heading **ESP32 D2WD**.
11+
* If your board has a single-core ESP32 (e.g. the "SOLO" modules) then choose
12+
the "unicore" variant. Look for heading **ESP32 Unicore**.
13+
* If you'd like to perform Over-the-Air updates of the MicroPython firmware,
14+
then choose the "ota" variant. This variant has less room in the flash for
15+
Python files as a result of supporting OTA. Look for heading **Support for
16+
OTA**.
17+
18+
Otherwise, download the generic variant (under the first heading below).

0 commit comments

Comments
 (0)