The ESP32-S2 has a built in bootloader, which means you never have to worry about 'bricking' your board. You can use it to load code directly, say CircuitPython or the binary output of an Arduino compilation or you can use it to load a second bootloader on, like UF2 which has a drag-n-drop interface.
The ROM bootloader can never be disabled or erased, so its always there if you need it!
Entering the bootloader is easy. Complete the following steps.
On Windows check the Device manager - you will see a COM port, for example here its COM88. You may also see another "Other device" called ESP32-S2
It's best to do this with no other dev boards plugged in so you don't get confused about which COM port is the ESP32-S2
On Mac/Linux you will need to find the tty name which lives under /dev
On Linux, try ls /dev/ttyS* for example, to find the matching serial port name. In this case it shows up as /dev/ttyS87. If you don't see it listed try ls /dev/ttyA* on some Linux systems it might show up like /dev/ttyACM0
On Mac, try ls /dev/cu.usbmodem* for example, to find the matching serial port name. In this case, it shows up as /dev/cu.usbmodem01
It's best to do this with no other dev boards plugged in so you don't get confused about which serial port is the ESP32-S2
Once you have entered ROM bootloader mode, you can then use Espressif's esptool program to communicate with the chip!
esptool is the 'official' programming tool and is the most common/complete way to program an ESP chip.
You will need to use the command line / Terminal to install and run
You will also need to have pip and Python installed (any version!)
Install the latest version using pip (you may be able to run
pip without the
3 depending on your setup):
pip3 install --upgrade esptool
Then, you can run:
esptool.py in a new terminal/command line and verify you get something like the below:
Run the following command, replacing the identifier after
--port with the
/dev/ttySxx you found above.
esptool.py --port COM88 chip_id
You should get a notice that it connected over that port and found an ESP32-S2
You can now upload a binary file with the following command
esptool.py --port COM88 --after=no_reset write_flash 0x0 firmware.bin
don't forget to change the
--port name to match, and the file name from firmware.bin to whatever the firmware file name is.
For example, I downloaded CircuitPython .bin and programmed it thus:
Once the data is verified, press the Reset button once more to launch the code you just programmed in!