embassy-rs/embassy · error

unknown time_driver

Error message

unknown time_driver {:?}

What it means

After resolving which `time_driver_*` feature is set, the build script matches its name against the list of supported timers per chip. Any unrecognized value falls into the catch-all `_` arm and panics with `unknown time_driver <name>`, meaning the enabled time-driver feature names a timer the build script doesn't handle for this chip.

Solutions

  1. Use one of the supported time-driver features for your chip (per embassy-mspm0 docs, e.g. time_driver_tima0/time_driver_tima1), or none for the default timer.
  2. Fix typos in the feature name in Cargo.toml.
  3. Verify the timer exists on your exact part and is generated as a singleton (the panic above the match, 'Could not find any timer', guards this for defaults).
  4. Upgrade or downgrade embassy-mspm0 to a version supporting the time-driver feature you want.

Example fix

// before
features = ["mspm0g350x", "time_driver_timb0"] // TIMB0 unsupported here
// after
features = ["mspm0g350x", "time_driver_tima0"]
Defensive patterns

Strategy: validation

Validate before calling

// Only use documented timers for your chip, e.g.:
// features = ["mspm0g350x", "time_driver_tima0"]

Prevention

When it happens

Trigger: Enabling a `time_driver_<timer>` feature whose timer doesn't exist on the selected chip (e.g. `time_driver_timB0` on a part without TIMB0, or `time_driver_tik0` typo), or the `CARGO_FEATURE_TIME_DRIVER_*` env var produced by an unexpected feature name.

Common situations: Typos in feature names; copying a time-driver feature from a different MSPM0 family example where that timer singleton isn't generated; using a newer timer feature against an older embassy-mspm0 version that doesn't support it.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10). Data as JSON: /api/errors/c1fdee374156a098. Report an issue: GitHub.

Appendix: source

Thrown at embassy-mspm0/build.rs:475

            // 4. 16-bit, 4 channel
            // 5. 16-bit with QEI
            // 6. Advanced timers
            //
            // TODO: 32-bit timers are not considered yet
            [
                // basic timers. No PWM pins
                // "TIMB0", // 16-bit, 2 channel
                "TIMG0", "TIMG1", "TIMG2", "TIMG3", // 16-bit, 2 channel with shadow registers
                "TIMG4", "TIMG5", "TIMG6", "TIMG7",  // 16-bit, 4 channel
                "TIMG14", // 16-bit with QEI
                "TIMG8", "TIMG9", "TIMG10", "TIMG11", // Advanced timers
                "TIMA0", "TIMA1",
            ]
            .iter()
            .find(|tim| singletons.iter().any(|s| s.name == **tim))
            .expect("Could not find any timer")
        }
        _ => panic!("unknown time_driver {:?}", time_driver),
    };

    if !selected_timer.is_empty() {
        cfgs.enable(format!("time_driver_{}", selected_timer.to_lowercase()));
    }

    // Apply cfgs to each timer and it's pins
    for singleton in singletons.iter_mut() {
        if singleton.name.starts_with("TIM") {
            // Remove suffixes for pin singletons.
            let name = if singleton.name.contains("_CCP") {
                singleton.name.split_once("_CCP").unwrap().0
            } else if singleton.name.contains("_FAULT") {
                singleton.name.split_once("_FAULT").unwrap().0
            } else if singleton.name.contains("_IDX") {
                singleton.name.split_once("_IDX").unwrap().0
            } else {
                &singleton.name

View on GitHub (pinned to 463a07b963)