diff --git a/embassy-rp/src/watchdog.rs b/embassy-rp/src/watchdog.rs index 760d6aac2..49cf03850 100644 --- a/embassy-rp/src/watchdog.rs +++ b/embassy-rp/src/watchdog.rs @@ -89,17 +89,25 @@ impl Watchdog { /// Start the watchdog timer pub fn start(&mut self, period: Duration) { + #[cfg(feature = "rp2040")] + const MAX_PERIOD: u32 = 0xFFFFFF / 2; + #[cfg(feature = "_rp235x")] const MAX_PERIOD: u32 = 0xFFFFFF; let delay_us = period.as_micros(); - if delay_us > (MAX_PERIOD / 2) as u64 { - panic!("Period cannot exceed {} microseconds", MAX_PERIOD / 2); + if delay_us > (MAX_PERIOD) as u64 { + panic!("Period cannot exceed {} microseconds", MAX_PERIOD); } let delay_us = delay_us as u32; // Due to a logic error, the watchdog decrements by 2 and // the load value must be compensated; see RP2040-E1 - self.load_value = delay_us * 2; + // This errata is fixed in the RP235x + if cfg!(feature = "rp2040") { + self.load_value = delay_us * 2; + } else { + self.load_value = delay_us; + } self.enable(false); self.configure_wdog_reset_triggers();