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-08-01

How to Write Firmware

How to write firmware to TWELITE SPOT
This guide explains how to write firmware to the ESP32 and TWELITE embedded in the TWELITE SPOT.

1 - 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.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

1.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

1.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.

2 - How to Write Firmware to TWELITE

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

Install TWELITE STAGE APP

Download the TWELITE STAGE SDK and extract the downloaded file directly under the C drive.

Connect to Host

Connect TWELITE R3 / R2

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

Connect Power

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

Connection Example (TWELITE)

Connection Example (TWELITE)

Operating the TWELITE STAGE APP

  1. Launch the TWELITE STAGE APP (TWELITE_Stage.exe).

  2. Select the TWELITE R3 / TWELITE R2 on the serial port selection screen.

  3. From the main menu, select “Rewrite Application” and choose the application you want to rewrite.

3 - How to Initialize Firmware

How to restore TWELITE SPOT firmware to the factory default state
This guide explains how to initialize the firmware written to the ESP32 and TWELITE installed on the TWELITE SPOT back to the factory default state.

3.1 - How to Initialize ESP32 Firmware

How to restore ESP32 firmware on TWELITE SPOT to the factory default state
This guide shows how to manually restore the firmware written to the ESP32 on TWELITE SPOT to the factory default state using esptool.

Install esptool

Install Python

If Python 3.7 or later is not installed, please install Python 3.7 or later.

https://www.python.org/downloads/

Install esptool itself

Install esptool from PyPI.


pip install esptool

Connect 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)

Obtain the binary file

Please download spot-server-2023-05-bin.zip from the link below.

spot-server-2023-05-bin.zip

After downloading, unzip the file.

Start 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 locations

Button locations

Write with esptool

On the terminal where esptool is installed, navigate to the folder where you extracted spot-server-2023-05-bin.zip, and run the following:


esptool --chip esp32 --port {Serial Port} --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode qio --flash_freq 80m --flash_size 16MB 0x1000 spot-server.ino.bootloader.bin 0x8000 spot-server.ino.partitions.bin 0xe000 boot_app0.bin 0x10000 spot-server.ino.bin 0x100000 spot-server.littlefs.bin

Reset ESP32

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

Reset switch location

Reset switch location

3.2 - How to Initialize TWELITE Firmware

How to restore TWELITE firmware on TWELITE SPOT to the factory default state
This guide explains how to restore the firmware written to the TWELITE mounted on the TWELITE SPOT to the factory default state using the TWELITE STAGE APP.

Install the TWELITE STAGE APP

Download the TWELITE STAGE SDK and extract the downloaded file directly under the C drive (for Windows).

Obtain the Firmware

Download the binary file from the link below and place it in the BIN folder inside the MWSTAGE folder.

Connect to the Host

Connect TWELITE R3 / R2

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

Connect Power

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

Connection Example (TWELITE)

Operating the TWELITE STAGE APP

  1. Launch the TWELITE STAGE APP (TWELITE_Stage.exe).

  2. Select the TWELITE R3 / TWELITE R2 in the serial port selection screen.

  3. From the main menu, choose “Rewrite Application” -> “Select from BIN” and write the previously obtained binary (App_Wings_TWELITESPOT_BLUE_L1305_V1-3-0.bin).