embassy-rs/embassy · error
PLL1.Q not configured
Error message
PLL1.Q not configured
What it means
In the STM32WBA rcc `init`, when SAI1 is muxed to `Pll1Q` (`sai1sel: Sai1sel::Pll1Q`) the code does `pll1.q.expect("PLL1.Q not configured")`, panicking if PLL1's Q (and Q-div) output was never configured. The library needs a concrete audioclk frequency to program the SAI clock tree and cannot synthesize one.
Solutions
- Configure PLL1's Q output in the rcc config: `pll1: { q: Some(PllConfig { div: ..., freq: ... }) }`
- Or choose a different SAI1 clock source that is actually configured (e.g. Hsi)
- Verify the resulting audioclk frequency meets your audio sample-rate requirements
Example fix
// before
let config = rcc::Config { mux: rcc::mux::Sai1sel::Pll1Q, pll1: Pll1 { p: Some(..), q: None, .. } };
// after
let config = rcc::Config {
mux: rcc::mux::Sai1sel::Pll1Q,
pll1: Pll1 { p: Some(..), q: Some(PllConfig { div: 4, freq: Hertz(49_152_000) }), .. },
..
}; Defensive patterns
Strategy: validation
Validate before calling
if config.mux.sai1sel == rcc::mux::Sai1sel::Pll1Q && config.pll1.q.is_none() {
panic!("sai1sel=Pll1Q requires config.pll1.q to be configured");
} Prevention
- Whenever a mux selects a PLL output, configure that PLL output's freq/div
- Match SAI clock source choice to the PLL1 outputs you actually defined
- Test audio init on hardware before adding panel/peripheral init
When it happens
Trigger: Setting `config.mux.sai1sel = Sai1sel::Pll1Q` in rcc config while `config.pll1.q` (Pll1QDiv and frequency fields) is `None`.
Common situations: Selecting a PLL1 Q audio clock without defining PLL1's Q output; copying an SAI audio config where the other board used PLL1P or HSI; incomplete pll1 setup (only P configured).
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- PLL1.P not configured
- must not set PllSource::Disable
- must not select PLL source as DISABLE
- PLL is unavailable in voltage range 2
- if PLL source is HSI, PLL prediv must be 2.
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/52bdb9b610badb47.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-stm32/src/rcc/wba.rs:423
Hertz(24_000_000) => Usbrefcksel::Mhz24,
Hertz(26_000_000) => Usbrefcksel::Mhz26,
Hertz(32_000_000) => Usbrefcksel::Mhz32,
_ => panic!(
"cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz",
clk_val
),
},
None => Usbrefcksel::Mhz24,
};
#[cfg(all(stm32wba, peri_usb_otg_hs))]
SYSCFG.otghsphycr().modify(|w| {
w.set_clksel(usb_refck_sel);
});
#[cfg(sai_v4_2pdm)]
let audioclk = match config.mux.sai1sel {
Sai1sel::Hsi => Some(HSI_FREQ),
Sai1sel::Pll1Q => Some(pll1.q.expect("PLL1.Q not configured")),
Sai1sel::Pll1P => Some(pll1.p.expect("PLL1.P not configured")),
Sai1sel::Sys => panic!("SYS not supported yet"),
Sai1sel::Audioclk => panic!("AUDIOCLK not supported yet"),
_ => None,
};
let lsi = config.ls.lsi.then_some(LSI_FREQ);
let lse = config.ls.lse.map(|c| c.frequency);
// Disable HSI if not used
if !config.hsi {
assert!(
config.mux.rngsel != mux::Rngsel::Hsi,
"RNG is configured to use HSI but HSI is disabled"
);
RCC.cr().modify(|w| w.set_hsion(false));
}
View on GitHub (pinned to 463a07b963)