embassy-rs/embassy · error
Timer does not exist
Error message
Timer does not exist
What it means
generate_timers iterates every TIM* (non-TIMB) peripheral of the chip and looks up its configuration in the static TIMERS table, panicking if the timer model is unknown. The TIMERS map must contain an entry (bit width, capabilities) for every timer instance present in the package metadata.
Solutions
- Add an entry for the missing timer (with its bits/capabilities) to the TIMERS map in embassy-mspm0/build.rs.
- Build against a chip variant whose timers are all covered by the TIMERS table.
- Report the missing timer for your part number upstream so the table is extended.
Example fix
// before (TIMERS map)
"TIMG0": TimerInfo { bits: 16, .. },
// after
"TIMG0": TimerInfo { bits: 16, .. },
"TIMG12": TimerInfo { bits: 32, .. }, Defensive patterns
Strategy: validation
Validate before calling
// verify all TIM peripherals have a TIMERS entry before building
let missing: Vec<_> = metadata.peripherals.iter()
.filter(|p| p.name.starts_with("TIM") && !p.name.starts_with("TIMB"))
.filter(|p| !TIMERS.contains_key(p.name.as_str()))
.map(|p| p.name.clone()).collect();
assert!(missing.is_empty(), "timers missing from TIMERS map: {:?}", missing); Prevention
- Update the TIMERS table whenever a new timer instance is added to chip support.
- Smoke-build every newly added chip variant in CI.
- Track upstream MSPM0 releases for new timer models.
When it happens
Trigger: Building embassy-mspm0 for a package containing a TIM-prefixed peripheral (e.g. a newly added TIMG12 or another timer variant) that has no corresponding key in the build script's TIMERS map, during generate_code -> generate_timers.
Common situations: A new MSPM0 device family introduces a timer instance not yet listed in the TIMERS table; a metadata peripheral name spelling differs from the TIMERS keys; upstream added a chip before updating the timer table.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Could not find any timer
- no SYSCTL peripheral
- Could not find NRST pin to cfg gate
- Could not find DEBUGSS peripheral
- Could not find SWD pin to cfg gate
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/e4c6f302e2194d13.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-mspm0/build.rs:583
quote! {
embassy_hal_internal::peripherals_definition!(#(#singletons_peripherals_def),*);
embassy_hal_internal::peripherals_struct!(#(#singletons_peripherals_struct),*);
}
}
fn generate_timers() -> TokenStream {
// Generate timers
let timer_impls = METADATA
.peripherals
.iter()
.filter(|p| p.name.starts_with("TIM"))
.filter(|p| !p.name.starts_with("TIMB"))
.map(|peripheral| {
let name = Ident::new(&peripheral.name, Span::call_site());
let timers = &*TIMERS;
let timer = timers.get(peripheral.name).expect("Timer does not exist");
assert!(timer.bits == 16 || timer.bits == 32);
let bits = if timer.bits == 16 {
quote! { Bits16 }
} else {
quote! { Bits32 }
};
let mut impls = Vec::new();
let prescaler = timer.prescaler;
let channels = timer.ccp_channels_external;
impls.push(quote! {
impl_tim_instance!(
#name,
prescaler: #prescaler,
width: #bits,
channels: #channels
);View on GitHub (pinned to 463a07b963)