{"record":{"id":"725c573ac4ee005b","repo":"embassy-rs/embassy","slug":"clocks-initialized-but-clk-16k-vsys-not-active","errorCode":null,"errorMessage":"Clocks initialized, but clk_16k_vsys not active","messagePattern":"Clocks initialized, but clk_16k_vsys not active","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"embassy-mcxa/src/rtc/mcxa2xx.rs","lineNumber":262,"sourceCode":"    _freq: u32,\n    _wg: Option<WakeGuard>,\n}\n\nimpl<'a> Rtc<'a> {\n    /// Create a new instance of the real time clock.\n    pub fn new<T: Instance>(\n        _inst: Peri<'a, T>,\n        _irq: impl crate::interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'a,\n        config: Config,\n    ) -> Self {\n        let info = T::info();\n\n        // The RTC is NOT gated by the MRCC, but we DO need to make sure the 16k clock\n        // on the vsys domain is active\n        let clocks = with_clocks(|c| c.clk_16k_vsys.clone());\n        let clk = match clocks {\n            None => panic!(\"Clocks have not been initialized\"),\n            Some(None) => panic!(\"Clocks initialized, but clk_16k_vsys not active\"),\n            Some(Some(clk)) => clk,\n        };\n\n        let mut inst = Self {\n            info,\n            _inst: PhantomData,\n            _freq: clk.frequency,\n            _wg: WakeGuard::for_power(&clk.power),\n        };\n\n        inst.set_configuration(&config);\n\n        // Enable RTC interrupt\n        T::Interrupt::unpend();\n        unsafe { T::Interrupt::enable() };\n\n        inst\n    }","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mcxa/src/rtc/mcxa2xx.rs#L244-L280","documentation":"Clock configuration exists but the `clk_16k_vsys` entry is `Some(None)`: the 16 kHz clock on the VSYS power domain was not enabled during clock setup. The RTC runs from this clock and is not MRCC-gated, so the driver requires it explicitly and panics when it is absent.","triggerScenarios":"Calling `Rtc::new(...)` after clock init that did not enable the 16k vsys oscillator/clock (e.g. default clock config without `clk_16k_vsys` set, or it was disabled to save power).","commonSituations":"Using a clock config copied from a chip/example that doesn't enable the 16k VSYS clock; deliberately disabling low-power clocks for power reasons and then adding RTC; a board support package whose default clock config lacks this clock.","solutions":["Enable `clk_16k_vsys` in the clock configuration passed to clock init before creating the RTC.","Verify the 16k oscillator (VSW/VSYS domain) is started, not just configured, per the MCXA reference manual.","If RTC is not actually needed, remove the Rtc::new call instead of enabling the clock."],"exampleFix":"// before: ClockConfig { .. } // clk_16k_vsys not enabled\n// after\nlet mut clocks = ClockConfig::default();\nclocks.enable_clk_16k_vsys(); // or set in the clock init struct per BSP\nembassy_mcxa::clocks::init(clocks);","handlingStrategy":"validation","validationCode":"// In your ClockConfig, explicitly enable the 16k vsys clock before init:\nlet mut clocks = ClockConfig::default();\nclocks.clk_16k_vsys = /* enabled per BSP API */;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always enable clk_16k_vsys in the clock config when using the RTC.","Don't disable low-power/16k clocks when RTC is used.","Test RTC bring-up right after changing clock configuration."],"tags":["embedded","rust","rtc","clocks","low-power"],"backgroundTag":"missing-required-config","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"}