{"record":{"id":"ce3a1d9c3c55fea6","repo":"embassy-rs/embassy","slug":"could-not-find-any-timer","errorCode":null,"errorMessage":"Could not find any timer","messagePattern":"Could not find any timer","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-mspm0/build.rs","lineNumber":473,"sourceCode":"            // 2. 16-bit, 2 channel\n            // 3. 16-bit, 2 channel with shadow registers\n            // 4. 16-bit, 4 channel\n            // 5. 16-bit with QEI\n            // 6. Advanced timers\n            //\n            // TODO: 32-bit timers are not considered yet\n            [\n                // basic timers. No PWM pins\n                // \"TIMB0\", // 16-bit, 2 channel\n                \"TIMG0\", \"TIMG1\", \"TIMG2\", \"TIMG3\", // 16-bit, 2 channel with shadow registers\n                \"TIMG4\", \"TIMG5\", \"TIMG6\", \"TIMG7\",  // 16-bit, 4 channel\n                \"TIMG14\", // 16-bit with QEI\n                \"TIMG8\", \"TIMG9\", \"TIMG10\", \"TIMG11\", // Advanced timers\n                \"TIMA0\", \"TIMA1\",\n            ]\n            .iter()\n            .find(|tim| singletons.iter().any(|s| s.name == **tim))\n            .expect(\"Could not find any timer\")\n        }\n        _ => panic!(\"unknown time_driver {:?}\", time_driver),\n    };\n\n    if !selected_timer.is_empty() {\n        cfgs.enable(format!(\"time_driver_{}\", selected_timer.to_lowercase()));\n    }\n\n    // Apply cfgs to each timer and it's pins\n    for singleton in singletons.iter_mut() {\n        if singleton.name.starts_with(\"TIM\") {\n            // Remove suffixes for pin singletons.\n            let name = if singleton.name.contains(\"_CCP\") {\n                singleton.name.split_once(\"_CCP\").unwrap().0\n            } else if singleton.name.contains(\"_FAULT\") {\n                singleton.name.split_once(\"_FAULT\").unwrap().0\n            } else if singleton.name.contains(\"_IDX\") {\n                singleton.name.split_once(\"_IDX\").unwrap().0","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mspm0/build.rs#L455-L491","documentation":"embassy-mspm0's build script, when generating the timer time-driver for a chip whose best timer cannot be auto-selected, searches the list of preferred timers (TIMG14, TIMG8-TIMG11, TIMA0, TIMA1) against the chip's available singletons and panics if none of them exist in the package. This means the selected chip package has no timer instance matching any of the known preferred candidates, so the time driver cannot be wired to a hardware timer.","triggerScenarios":"Running `cargo build` on embassy-mspm0 for a chip variant where none of the hardcoded preferred timer names (TIMG14, TIMG8, TIMG9, TIMG10, TIMG11, TIMA0, TIMA1) appear among the peripherals generated from the chip metadata, while the time_driver feature arm in generate_code reaches the timer-selection branch.","commonSituations":"Building for a rare or new MSPM0 package variant that lacks the timers hard-coded in the build script; using a chip metadata YAML whose timer naming differs from the expected TIMG/TIMA prefixes; a new chip added to the family that the build script timer list has not been updated for.","solutions":["Pick a different chip variant that includes TIMA0/TIMA1 or one of the preferred TIMG timers (check the datasheet or the generated singletons list).","Add the timer instance name present on your chip to the preferred-timer array in embassy-mspm0/build.rs so the .find() matches.","Update the chip metadata so the timer peripheral name matches the names expected by the build script.","File an issue upstream with the exact chip part number so the timer list can be extended."],"exampleFix":"// before (build.rs preferred timer list)\n\"TIMG8\", \"TIMG9\", \"TIMG10\", \"TIMG11\", \"TIMA0\", \"TIMA1\",\n// after\n\"TIMG8\", \"TIMG9\", \"TIMG10\", \"TIMG11\", \"TIMA0\", \"TIMA1\", \"TIMG0\", \"TIMG6\",","handlingStrategy":"validation","validationCode":"// build-time guard: fail before build.rs panics\n// check your chip's timers via `cargo doc` of embassy_mspm0::peripherals\n// or inspect the pac crate:\nfn has_preferred_timer(pac_timers: &[&str]) -> bool {\n    const PREFERRED: &[&str] = &[\"TIMG14\", \"TIMG8\", \"TIMG9\", \"TIMG10\", \"TIMG11\", \"TIMA0\", \"TIMA1\"];\n    PREFERRED.iter().any(|t| pac_timers.contains(t))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Before targeting a new MSPM0 part, verify it has TIMA0/TIMA1 or a preferred TIMG timer.","Keep the build script's preferred-timer list in sync with newly supported chips.","When adding chip metadata, run a build immediately to catch missing-timer panics early."],"tags":["build-script","embedded","timer","panic","rust"],"backgroundTag":"resource-not-found","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"}