Medius - Native APIFlashing

Flashing

First install and recovery

A box already running Medius takes new firmware over the control port with UPDATE, and nothing on this page applies. What follows is for a chip that cannot do that: one that has never had the two-slot layout written, or one whose app will not boot.

No physical button is needed while firmware still runs. A 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.

Write the bootloader, the partition table, the app and a blank otadata together, or use the factory image, which contains all four. An app image on its own keeps whatever layout the chip already has, and a chip with one app slot answers NOSLOT to an UPDATE. Installing the two slots is a partition-table change, which an update cannot perform, so it takes one flash from here per chip, once per box.

Two chips

Flash each separately

Pick the chip with the REBOOT target byte, then flash it over the link in the table.

ChipRebootFlashed over
Device chiptarget = 0The same CH343 serial link, with esptool.
Host chiptarget = 1Its own USB connection; the device relays the reboot over the inter-chip link.

Version scheme

major.minor.patch

Both chips carry the same firmware version, stamped into their app descriptors from one source, so the binary and the tag cannot drift apart.

The protocol version is a separate byte and is the one a host checks for compatibility; the firmware version identifies the build. Both come back in the same reply, from QUERY(VERSION).

Notes

A run reboot (target = 2 or 3) is the only software cold-reboot; DTR/RTS are not wired to a reset on this board.

After a download reboot the serial port sits in the ROM bootloader, plain ASCII the frame decoder ignores, until you finish flashing or power-cycle. Persisted per-box data survives an app reflash.

The REBOOT path needs working firmware to receive the frame. A chip with no firmware yet, or a bad image, cannot, so enter download mode the hardware way: hold the chip's BOOT button while you reset or power on the box.

None of this is needed for a box that already runs Medius. From Rust, the crate's firmware update calls write both chips over the open connection.