embassy-rs/embassy · error
not implemented
Error message
not implemented
What it means
The DTS (digital temperature sensor) factory_calibration() reads T0VALR1 and maps the encoded reference temperature t0: 0 => 30 °C, 1 => 130 °C; any other encoded value hits an unimplemented!() panic. The library throws it because the register encoding is documented as 2 values and anything else indicates silicon/register surprises. In practice it fires when the DTS calibration block was not programmed (reads 0xFF / reserved values).
Solutions
- Ensure the DTS peripheral clock is enabled (via RCC) before calling factory_calibration()
- Verify factory calibration data exists in the calibration area for your exact chip part number
- Call the runtime calibration path (calibrate / measure with the driver's calibration routine) instead of relying on factory constants
- If the chip encodes additional t0 values, patch the match arms in embassy-stm32/src/dts/mod.rs
Example fix
// before let cal = Dts::factory_calibration(); // panics if t0 encoding unexpected // after let cal = dts.calibrate(&mut sensor).await; // runtime calibration instead
Defensive patterns
Strategy: fallback
Validate before calling
let t0 = Dts::regs().t0valr1().read().t0();
if t0 > 1 {
// fall back to runtime calibration
return None;
} Type guard
fn valid_t0_encoding(t0: u8) -> bool {
matches!(t0, 0 | 1)
} Try / catch
// panic-based; guard reads first
if !valid_t0_encoding(t0_raw) {
let cal = runtime_calibration();
} Prevention
- Enable DTS clock before reading calibration registers
- Verify your chip's calibration OTP is intact
- Prefer runtime calibration over factory constants
- Check chip errata for DTS register encodings
When it happens
Trigger: Calling Dts::factory_calibration() when T0VALR1.T0 contains a value other than 0 or 1 — typically because DTS calibration data was never written to OTP/system flash, or reading before the DTS/its clock is enabled so the read returns garbage.
Common situations: Using DTS on an STM32 whose factory calibration area is erased or not loaded (custom bootloader, clone/defective chip); forgetting to enable the DTS peripheral clock before reading calibration registers.
Related errors
- DTS PCLK frequency must be less than 127 MHz.
- SYS not supported yet
- AUDIOCLK not supported yet
- invalid burst size
- invalid word size
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/33692e13f4089299.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-stm32/src/dts/mod.rs:128
Self { _peri }
}
/// Reconfigure the driver.
pub fn set_config(&mut self, config: &Config) {
Self::regs().cfgr1().modify(|w| {
w.set_smp_time(config.sample_time as u8);
w.set_intrig_sel(config.trigger as u8);
});
}
/// Get the read-only factory calibration values used for converting a
/// measurement to a temperature.
pub fn factory_calibration() -> FactoryCalibration {
let t0valr1 = Self::regs().t0valr1().read();
let t0 = match t0valr1.t0() {
0 => 30,
1 => 130,
_ => unimplemented!(),
};
let fmt0 = Hertz::hz(t0valr1.fmt0() as u32 * 100);
let ramp_coeff = Self::regs().rampvalr().read().ramp_coeff();
FactoryCalibration { t0, fmt0, ramp_coeff }
}
/// Perform an asynchronous temperature measurement. The returned future can
/// be awaited to obtain the measurement.
///
/// The future returned waits for the next measurement to complete.
///
/// # Example
///
/// ```no_run
/// use embassy_stm32::{bind_interrupts, dts};
/// use embassy_stm32::dts::Dts;View on GitHub (pinned to 463a07b963)