Now, use the breakout USB connection in lieu of either of the built-in USB Micro B ports to install and use CircuitPython.
Start by connecting the USB Breakout Cable to the Kaluga board.
- Black: Use a Male/Female Extension Jumper Wire to connect to GND
- White: Connect to IO19
- Green: Connect to IO20
- Red: Use a Male/Female Extension Jumper Wire to connect to 5V
If you're familiar with our other products and chipsets you may be famliar with our drag-n-drop bootloader, a.k.a UF2. We have a UF2 bootloader for the ESP32-S2, that will let you drag firmware on/off a USB disk drive.
However, thanks to the ROM bootloader, you don't have to worry about it if the UF2 bootloader is damaged. The ROM bootloader can never be disabled or erased, so its always there if you need it! You can simply re-load the UF2 bootloader (USB-disk-style) with the ROM bootloader (non-USB-drive)
You can use the TinyUF2 bootloader 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.
This section outlines using WebSerial ESPTool or
esptool to flash the UF2 bootloader onto your ESP32-S2 board.
Note that this file is 3MB but that's because the bootloader is near the end of the available flash. It's not actually 3MB large, most of the file is empty but its easier to program if we give you one combined 'swiss cheese' file. Save this file to your desktop or wherever you plan to run esptool from
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 - If your board has a power 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
Because there are several incompatible versions of the Kaluga TFT display, the bootloader's screen may appear incorrectly or not at all. This does not affect its operation.
Check for a new serial / COM port
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
The WebSerial ESPTool was designed to be a web-capable option for programming ESP32-S2 boards. It allows you to erase the contents of the microcontroller and program up to 4 files at different offsets.
You will have to use the Chrome browser for this to work, Safari and Firefox, etc are not supported because we need Web Serial and only Chrome is supporting it to the level needed.
Enable Web Serial (For older chrome)
Visit chrome://flags from within Chrome. Find and enable the Experimental Web Platform features
In the Chrome browser visit https://adafruit.github.io/Adafruit_WebSerial_ESPTool/. It should look like the image to the left.
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-S2 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.
Erasing the Contents
If you would like to erase the entire flash area so that you can start with a clean slate, you can use the erase feature. We recommend doing this if you are having issues.
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.
Programming the Microcontroller
Programming the microcontroller can be done with up to 4 files at different locations, but with the tinyuf2combo BIN file, which you should have downloaded under Step 1 on this page, you only need to use 1 file.
You can click on Choose a file... from any of the available buttons. It will only attempt to program buttons with a file and a unique location. Then select the Adafruit CircuitPython BIN files (not the UF2 file!)
Verify that the Offset box next to the file location you used is 0x0.
Once you choose a file, the button text will change to match your filename. You can then select the Program button to start flashing.
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:
Test the Installation
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
Installing the Bootloader
Run this command and replace the serial port name with your matching port and the file you just downloaded
esptool.py --port COM88 write_flash 0x0 tinyuf2_combo.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:
Click the RESET button to launch the bootloader. You'll see a new disk drive on your computer with the name KALUGA1BOOT.
You're now ready to copy the CircuitPython UF2 on to the drive which will set up CircuitPython!
This section outlines flashing an Arduino sketch onto your ESP32-S2 board, which automatically installs the UF2 bootloader as well.
If you don't already have the Arduino IDE installed, the first thing you will need to do is to download the latest release of the Arduino IDE. ESP32-S2 requires version 1.8 or higher. Click the link to download the latest.
After you have downloaded and installed the latest version of Arduino IDE, you will need to start the IDE and navigate to the Preferences menu. You can access it from the File > Preferences menu in Windows or Linux, or the Arduino > Preferences menu on OS X.
The Preferences window will open.
In the Additional Boards Manager URLs field, you'll want to add a new URL. The list of URLs is comma separated, and you will only have to add each URL once. The URLs point to index files that the Board Manager uses to build the list of available & installed boards.
Copy the following URL.
Add the URL to the the Additional Boards Manager URLs field (highlighted in red below).
Click OK to save and close Preferences.
In the Tools > Boards menu you should see the ESP32 Arduino menu. In the expanded menu, it should contain the ESP32 boards along with all the latest ESP32-S2 boards.
Now that your IDE is setup, you can continue on to loading the sketch.
In the Tools > Boards menu you should see the ESP32 Arduino menu. In the expanded menu, look for the menu option for the ESP32S2 Dev Module, and click on it to choose it.
Open the Blink sketch by clicking through File > Examples > 01.Basics > Blink.
Once open, click Upload from the sketch window.
Once successfully uploaded, the little red LED will begin blinking once every second. At that point, you can now enter the bootloader.