Firmware build
Compile and run the Rust firmware on opentag one V2 with the repository-pinned Embassy tree.
Use the project checkout.
The application depends on the Embassy submodule through local paths. Initialize submodules in your existing project checkout before building.
Toolchain
cd firmware/rust_bringup/stm32g4
rustup target add thumbv7em-none-eabi
cargo install probe-rs-tools --locked
Firmware targets
| Binary | Purpose | Interface |
|---|---|---|
twr_init | 40 Hz two-way-ranging initiator | DWM3000 + USB CDC |
twr_resp | Ranging responder, calibration, distance stream | DWM3000 + USB CDC |
can_tx | Classical CAN request / echo test | FDCAN2 at 500 kbit/s |
can_rx | Classical CAN echo peer | FDCAN2 at 500 kbit/s |
can_fd_tx | 64-byte CAN FD load generator | 1 Mbit/s nominal, 2 Mbit/s data |
can_fd_rx | CAN FD sequence, loss, and throughput receiver | 1 Mbit/s nominal, 2 Mbit/s data |
Build without hardware
cargo check --release --bin twr_init
cargo check --release --bin twr_resp
cargo check --release --bin can_tx --bin can_rx
cargo check --release --bin can_fd_tx --bin can_fd_rx
Flash and attach RTT
Connect a compatible SWD probe to the 10-pin Cortex Debug header. The package runner is already configured for STM32G474CC.
DEFMT_LOG=info cargo run --release --bin can_tx
probe-rs erases and programs the image, resets the target, and displays defmt RTT output. For release role images and no local toolchain, use the browser DFU console.
Clocking assumptions
The current V2 examples configure the 8 MHz HSE through PLL1 for a 170 MHz system clock. CAN FD explicitly routes FDCAN from PCLK1; timing constants on every bus node must match.