This is the multi-page printable view of this section. Click here to print...

Return to the regular view of this page

As of 2025-07-24

How to Write Firmware to ESP32

How to write firmware to the ESP32 mounted on TWELITE SPOT
This guide explains how to write firmware to the ESP32 mounted on the TWELITE SPOT.

1 - How to Write Sketches to ESP32

How to write sketches to the ESP32 mounted on TWELITE SPOT
This guide explains how to write Arduino sketches to the ESP32 mounted on TWELITE SPOT.

Connecting to the Host

Connect TWELITE R3 / R2

Connect the TWELITE R3 / R2 to the 7P interface (the side labeled ESP32).

Connect Power

Supply 5V power to the USB-C connector on the side.

Connection Example (ESP32)

Connection Example (ESP32)

Operating Arduino IDE

Open the Sketch

Launch the Arduino IDE and open the sketch you want to write.

Select the Serial Port

From the Tools -> Serial Port menu, select the port for the TWELITE R3 / R2.

Selecting the Serial Port

Selecting the Serial Port

Start ESP32 in Programming Mode

Press the ESP32 reset switch EN(RST) and the ESP32 boot switch BOOT on the TWELITE SPOT, then release them in the order of EN(RST) -> BOOT.

Button Positions

Button Positions

Execute Writing

Click the Write to Microcontroller Board button in Arduino IDE.

Write to Microcontroller Board

Write to Microcontroller Board

Reset ESP32

After writing is complete, press and release the ESP32 reset switch EN(RST) on the TWELITE SPOT to reset the ESP32.

Reset Switch Position

Reset Switch Position

Writing Completion Screen

Writing Completion Screen

2 - How to Write Files to ESP32

How to write files to the ESP32 mounted on TWELITE SPOT
This guide explains how to write files (the files under the data/ folder) to the ESP32 mounted on TWELITE SPOT.

Installing the Plugin

Install the Arduino plugin (arduino-esp32fs-plugin) to write files to the ESP32 flash area.

Downloading the Plugin

Download esp32fs.zip from the following page:

Release Update to support Big Sur · lorol/arduino-esp32fs-plugin

Installing the Plugin

  1. Extract the downloaded esp32fs.zip.

  2. If there is no tools folder in your Arduino sketchbook location (set in Arduino IDE preferences, e.g., C:\Users\foo\Documents\Arduino), create it.

  3. Create the folder ESP32FS/tool inside the tools folder and place the esp32fs.jar file extracted from the zip there. (Example path: C:\Users\foo\Documents\Arduino\tools\ESP32FS\tool\esp32fs.jar).

  4. The plugin will be available the next time you start Arduino IDE.

Connecting to the Host

Connect TWELITE R3 / R2

Connect TWELITE R3 / R2 to the 7P interface side labeled ESP32.

Connect Power

Supply 5V power to the USB-C connector on the side.

Connection Example (ESP32)

Connection Example (ESP32)

Arduino IDE Operations

Open the Sketch

Start Arduino IDE and open the sketch.

Place Files to Write

  1. Open Sketch -> Show Sketch Folder.

  2. Create a data folder at the same level as the sketch file (.ino).

  3. Place the files to write inside the data folder.

Select Serial Port

From the Tools -> Port menu, select the port for TWELITE R3 / R2.

Serial Port Selection

Serial Port Selection

Boot ESP32 in Programming Mode

Press the ESP32 reset switch EN(RST) and the ESP32 boot switch BOOT on TWELITE SPOT, then release them in the order EN(RST) -> BOOT.

Button Positions

Button Positions

Execute Writing

  1. Click Tools -> ESP32 Sketch Data Upload.

  2. At Select FS for /data folder, select LittleFS.

File System Selection Screen

File System Selection Screen

  1. Click OK.

Reset ESP32

After writing completes, press and release the ESP32 reset switch EN(RST) on TWELITE SPOT to reset ESP32.

Reset Switch Position

Reset Switch Position

3 - How to Specify the Partition Table for Writing to ESP32

How to apply any partition table when writing to the ESP32 mounted on TWELITE SPOT
This guide explains how to apply any partition table when writing sketches or files to the ESP32 mounted on TWELITE SPOT.

Creating the Definition File

The partition table is defined in a csv file.

In the example below, out of the 16MB flash area, 8MB is allocated for the file system.

# TWELITE SPOT 16MB with 8MB LittleFS
# Name,  Type, SubType, Offset,   Size,     Flags
nvs,     data, nvs,     0x9000,   0x5000,
otadata, data, ota,     0xE000,   0x2000,
app0,    app,  ota_0,   0x10000,  0x7F0000,
spiffs,  data, spiffs,  0x800000, 0x800000,
  • TWELITE SPOT 16MB with 8MB LittleFS is the name displayed in the Arduino IDE.
  • nvs is the area used by the system. Do not change.
  • otadata is the area used when using OTA. Do not change.
  • app0 is the area where the firmware is written.
  • spiffs is the area used by the LittleFS file system.

The units of the Offset and Size columns in the csv file are bytes, expressed in hexadecimal.

Therefore, the usable sizes for firmware and file system in the above example can be calculated as follows:

  • Size of app0: 0x7F0000 = 8323072, approximately 7.875MB
  • Size of spiffs: 0x800000 = 8388608, exactly 8MB

Registering the Definition File

Open the Arduino15 folder and add the csv file to the following path:

Arduino15/packages/esp32/hardware/esp32/x.x.x/tools/partitions

x.x.x is the version of Arduino core for the ESP32

Applying the Partition Table

From the Arduino IDE toolbar, open Tools -> Partition Scheme and select the added partition table.

The selected partition table will be applied to subsequent firmware and file system writes.