<!-- Source: https://medius.k4tech.net/native/flashing -->
# Flashing

_Writing new firmware_

Flashing writes new firmware onto the box, to update or recover it. The box has two chips; flash each separately. With firmware already running, no physical button is needed: a [`REBOOT`](/native/commands/admin.md#reboot) command restarts a chip into ROM download mode (a built-in loader that takes firmware over serial), then a flashing tool writes the image.

## Two chips

_Flash each separately_

Pick the chip with the [`REBOOT`](/native/commands/admin.md#reboot) `target` byte, then flash it over the link in the table.

| Chip | Reboot | Flashed over |
| --- | --- | --- |
| [Device chip](/native/architecture.md) | `target = 0` | The same [CH343](/native/transport.md) serial link, with [`esptool`](https://github.com/espressif/esptool). |
| [Host chip](/native/architecture.md) | `target = 1` | Its own USB connection; the device relays the reboot over the inter-chip link. |

## Version scheme

_major.minor.patch_

Read the running version with [`QUERY(VERSION)`](/native/commands/requests.md#version).

## Notes

> **Warning**
>
> -   The [`REBOOT`](/native/commands/admin.md#reboot) path needs working firmware to receive the frame. A chip with no firmware yet (a first flash) or a bad image can't, so enter download mode the hardware way: hold the chip's BOOT button while you reset or power on the box.
> -   A run reboot (`target = 2` or `3`) is the only software cold-reboot; `DTR`/`RTS` aren't wired to a reset on this board.
> -   After a download reboot the serial port sits in the ROM bootloader (plain ASCII the [frame decoder](/native/frame.md) ignores) until you finish flashing or power-cycle.
> -   Persisted per-box data survives an app reflash.

> **Note**
>
> The `medius` crate's [flash feature](/library/features/flash.md) does this from Rust.
