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!
Enter ROM Bootloader Mode
Entering the bootloader is easy. Complete the following steps.
- Make sure your ESP32-S2 is plugged into USB port to your computer using a data/sync cable. Charge-only cables will not work!
- Turn on the On/Off switch - check that you see the OK light on so you know the board is powered, a prerequisite!
- Press and hold the DFU / Boot0 button down. Don't let go of it yet!
- Press and release the Reset button. You should have the DFU/Boot0 button pressed while you do this.
- Now you can release the DFU / Boot0 button
- Check your computer for a new serial / COM port. On windows check the Device manager
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
Run esptool and check connection
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 esptool
.
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
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 COMxx
, /dev/cu.usbmodemxx
or /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!
Text editor powered by tinymce.