Your microcontroller ships running a factory demo. It's lovely, but you probably had other plans for the board. As you start working with your board, you may want to return to the original code to begin again, or you may find your board gets into a bad state. Either way, this page has you covered.
If you're still able to load Arduino sketches, you can load the following sketch onto your board to return it to its original state.
// SPDX-FileCopyrightText: 2024 ladyada for Adafruit Industries // // SPDX-License-Identifier: MIT #include <Adafruit_NeoPixel.h> #include "Adafruit_TestBed.h" extern Adafruit_TestBed TB; Adafruit_NeoPixel pixel(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800); void setup() { //while (! Serial) delay(10); Serial.begin(115200); TB.neopixelPin = PIN_NEOPIXEL; TB.neopixelNum = 1; TB.begin(); TB.setColor(WHITE); } uint8_t j = 0; void loop() { TB.setColor(TB.Wheel(j++)); delay(10); if (j == 0) { TB.printI2CBusScan(); } }
Your board is now back to its factory-shipped state! You can now begin again with your plans for your board.
If your board is in a state where Arduino isn't working, you may need to use these tools to flash a .bin file directly onto your board.
There are two ways to do a factory reset. The first is using WebSerial through a Chromium-based browser, and the second is using esptool
via command line. We highly recommend using WebSerial through Chrome/Chromium.
First you'll need to download the factory-reset.bin file. Save the following file wherever is convenient for you. You'll need access to it for both tools.
Now that you've downloaded the .bin file, you're ready to continue with the factory reset process. The next two sections walk you through using WebSerial and esptool
.
This method uses the WebSerial ESPTool through Chrome or a Chromium-based browser. The WebSerial ESPTool was designed to be a web-capable option for programming ESP32 boards. It allows you to erase the contents of the microcontroller and program up to four files at different offsets.
You will have to use a Chromium browser (like Chrome, Opera, Edge...) for this to work, Safari and Firefox, etc. are not supported because we need Web Serial and only Chromium is supporting it to the level needed.
Follow the steps to complete the factory reset.
Connect
You should have plugged in only the ESP32 that you intend to flash. That way there's no confusion in picking the proper port when it's time!
In the Chrome browser visit https://adafruit.github.io/Adafruit_WebSerial_ESPTool/. You should see something like the image shown.
Press the Connect button in the top right of the web browser. You will get a pop up asking you to select the COM or Serial port.
Remember, you should remove all other USB devices so only the ESP32 board is attached, that way there's no confusion over multiple ports!
On some systems, such as MacOS, there may be additional system ports that appear in the list.
The Javascript code will now try to connect to the ROM bootloader. It may timeout for a bit until it succeeds. On success, you will see that it is Connected and will print out a unique MAC address identifying the board along with other information that was detected.
Erase the Contents
To erase the contents, click the Erase button. You will be prompted whether you want to continue. Click OK to continue or if you changed your mind, just click cancel.
You'll see "Erasing flash memory. Please wait..." This will eventually be followed by "Finished." and the amount of time it took to erase.
Do not disconnect! Immediately continue on to programming the ESP32.
Program the ESP32
Programming the microcontroller can be done with up to four files at different locations, but with the board-specific factory-reset.bin file, which you should have downloaded earlier, you only need to use one file.
Click on the first Choose a file.... (The tool will only attempt to program buttons with a file and a unique location.) Then, select the *-factory-reset.bin file you downloaded in Step 1 that matches your board.
Verify that the Offset box next to the file location you used is (0x) 0.
Once you choose a file, the button text will change to match your filename. You can then select the Program button to begin flashing.
Once completed, you can skip down to the section titled Reset the Board.
Alternatively, you can 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.
Install ESPTool.py
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
Test the Installation
Run esptool.py
in a new terminal/command line and verify you get something like the below:
Connect
Run the following command, replacing the COM88
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.
Installing the Factory Test file
Run this command and replace the serial port name, COM88
, with your matching port and *-factory-reset.bin
with file you just downloaded
esptool.py --port COM88 write_flash 0x0 *-factory-reset.bin
Don't forget to change the --port
name to match.
There might be a bit of a 'wait' when programming, where it doesn't seem like it's working. Give it a minute, it has to erase the old flash code which can cause it to seem like it's not running.
You'll finally get an output like this:
Once completed, you can continue to the next section.
Now that you've reprogrammed the board, you need to reset it to continue. Click the reset button to launch the new firmware.
The NeoPixel LED on the ESP32-C6 Feather will show a rainbow swirl. Every few seconds, you'll see an I2C scan print to the Serial Monitor with address 0x36 for the onboard battery monitor.
You've successfully returned your board to a factory reset state!
We suggest updating to Chrome 89 or newer, as Web Serial is enabled by default.
If you must continue using an older version of Chrome, follow these steps to enable Web Serial.
If you receive an error like the one shown when you visit the WebSerial ESPTool site, you're likely running an older version of Chrome.
You must be using Chrome 78 or later to use Web Serial.
Text editor powered by tinymce.