{"record":{"id":"469ebdcb080b8dea","repo":"embassy-rs/embassy","slug":"time-driver-any-requested-but-the-chip-doesn-t-ha","errorCode":null,"errorMessage":"time-driver-any requested, but the chip doesn't have a TIM with at least 2 capture/compare channels.","messagePattern":"time-driver-any requested, but the chip doesn't have a TIM with at least 2 capture/compare channels\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/build.rs","lineNumber":391,"sourceCode":"                .filter_map(|p| {\n                    let regs = p.registers.as_ref()?;\n                    if regs.kind != \"timer\" {\n                        return None;\n                    }\n                    let category = match regs.block {\n                        \"TIM_GP32\" => 0,\n                        \"TIM_2CH\" => 1,\n                        \"TIM_2CH_CMP\" => 2,\n                        \"TIM_GP16\" => 3,\n                        \"TIM_ADV\" => 4,\n                        _ => return None,\n                    };\n                    let number: u32 = p.name.strip_prefix(\"TIM\")?.parse().ok()?;\n                    Some(((category, std::cmp::Reverse(number)), p.name))\n                })\n                .min_by_key(|(rank, _)| *rank)\n                .map(|(_, name)| name.to_string())\n                .expect(\"time-driver-any requested, but the chip doesn't have a TIM with at least 2 capture/compare channels.\")\n        }\n        Some(x) => x.to_ascii_uppercase(),\n    };\n\n    let time_driver_irq_decl = if !time_driver_singleton.is_empty() {\n        cfgs.set(format!(\"time_driver_{}\", time_driver_singleton.to_lowercase()), true);\n\n        let Some((p, regs)) = peripheral_map.get(time_driver_singleton.as_str()) else {\n            panic!(\"Tried to select {time_driver_singleton}, which is not available on this device\");\n        };\n\n        // Tell the time driver how wide the timer's counter is.\n        if regs.kind == \"timer\" {\n            cfgs.enable(if regs.block == \"TIM_GP32\" {\n                \"time_driver_32bit\"\n            } else {\n                \"time_driver_16bit\"\n            });","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/build.rs#L373-L409","documentation":"When the 'time-driver-any' feature is enabled, embassy-stm32's build script scans the chip's TIM peripherals for one with at least 2 capture/compare channels to back the internal time driver. If no such timer exists in the chip metadata, the build script panics. This is a compile-time error meaning the selected chip cannot supply a default time driver.","triggerScenarios":"Building with features embassy-stm32/time-driver-any on a chip whose TIM list contains no timer with >=2 CC channels (very small parts), or on a chip whose timers aren't named TIM*.","commonSituations":"Selecting a tiny/odd STM32 variant for a library default target; typos in the chip feature name resolving to an unsupported metapac entry; adding time-driver-any to a shared base feature set used by all targets in a workspace.","solutions":["Pick an explicit time-driver timer feature (e.g. time-driver-tim2) matching a timer the chip actually has.","Verify the selected chip's timer inventory in the datasheet / stm32-metapac.","Use a chip variant with a standard TIM2/TIM3 if the application needs the built-in time driver.","Provide your own time driver via embassy-time-driver instead of time-driver-any."],"exampleFix":"# before\nembassy-stm32 = { features = [\"stm32wba52cg\", \"time-driver-any\"] }\n\n# after\nembassy-stm32 = { features = [\"stm32wba52cg\", \"time-driver-tim2\"] }","handlingStrategy":"validation","validationCode":"# Verify the chip has a TIM with >=2 CC channels (e.g. TIM2/TIM3) and use an explicit driver:\n# embassy-stm32 = { features = [\"<chip>\", \"time-driver-tim2\"] }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer explicit time-driver-timX features over time-driver-any on unusual chips.","Confirm the timer exists in the chip's datasheet before selecting the feature.","Do not put time-driver features into a shared base feature list for all targets."],"tags":["build-script","cargo-features","stm32","time-driver"],"backgroundTag":"missing-required-config-field","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}