Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Flash with Local Setup

This chapter covers how to compile and flash the Crimpdeq firmware to your device.

Prerequisites

To build and upload the firmware, install:

  • Rust
    • The repository’s rust-toolchain.toml installs the stable toolchain, rust-src, and the ESP32-C3 target on the first build.
  • probe-rs, see installation instructions

    ⚠️ Note: Depending on your OS, you may need extra setup steps:

    • Linux: set up udev rules for your debug probe or USB-serial device (see the probe-rs udev guide).
    • Windows/macOS: ensure the correct USB drivers are installed and select the appropriate serial port in your tooling.

How to Build the Firmware

The main branch of the firmware repository targets PCB V4. For an older PCB, check out the release tag for your revision first, for example:

git checkout v3.1.0

To build the firmware, run:

cargo build --release

This compiles the firmware only. To build and flash the device, see Build and Flash your Device.

How to Flash Your Crimpdeq

Erase Device Memory

If this board was previously used for other projects, erase its flash once:

probe-rs erase

⚠️ Note: Erasing is only needed once. Avoid erasing routinely, or you will lose your calibration values.

Build and Flash Your Device

The custom runner configured in .cargo/config.toml builds, flashes, and starts the firmware with:

cargo run --release

Logging is off by default (DEFMT_LOG = "off" in .cargo/config.toml), so the command exits once the firmware starts.

To see log messages, set the log level in .cargo/config.toml or when running the command. The runner then keeps a log monitor open:

DEFMT_LOG=debug cargo run --release

⚠️ Note: On release tags up to v3.0.0, cargo run --release opens a serial monitor even with logging off.

⚠️ Note: If flashing fails to connect to the device, see If the flasher cannot connect.

⚠️ Note: If your DevKit does not include USB-Serial-JTAG, flash over UART by replacing the runner in .cargo/config.toml with espflash instead of probe-rs.

Try the Firmware Without a Load Cell

From firmware v3.1.0, the mock feature simulates the load cell and battery, so you can test the firmware and apps without a load cell or battery on the PCB of the release (V3 for v3.1.0, V4 for v4.x) or on an ESP32-C3 Rust board:

cargo run --release --features mock

The simulated load cell repeats pulls up to 30 kg, the battery discharges to 20 % and charges back, and the device logs the idle timeout instead of going to sleep.

Configuring Environment Variables

If you need to change DEVICE_ID, DEVICE_NAME, or DEVICE_VERSION_NUMBER, update their values in .cargo/config.toml.

After making changes, rebuild and flash the device for the new values to take effect.