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.
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.
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 - 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. You may want to remove all other USB devices so only the ESP32-S2 board is attached, that way there's no confusion over multiple ports!
Once you have successfully connected, the command toolbar will appear.
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.
A progress bar will appear and after a minute or two, you will have written the firmware.
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!