{"record":{"id":"b0ad9cf99c2c8ed1","repo":"embassy-rs/embassy","slug":"audioclk-not-supported-yet","errorCode":null,"errorMessage":"AUDIOCLK not supported yet","messagePattern":"AUDIOCLK not supported yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/rcc/wba.rs","lineNumber":426,"sourceCode":"            _ => panic!(\n                \"cannot select OTG_HS reference clock with source frequency of {}, must be one of 16, 19.2, 20, 24, 26, 32 MHz\",\n                clk_val\n            ),\n        },\n        None => Usbrefcksel::Mhz24,\n    };\n    #[cfg(all(stm32wba, peri_usb_otg_hs))]\n    SYSCFG.otghsphycr().modify(|w| {\n        w.set_clksel(usb_refck_sel);\n    });\n\n    #[cfg(sai_v4_2pdm)]\n    let audioclk = match config.mux.sai1sel {\n        Sai1sel::Hsi => Some(HSI_FREQ),\n        Sai1sel::Pll1Q => Some(pll1.q.expect(\"PLL1.Q not configured\")),\n        Sai1sel::Pll1P => Some(pll1.p.expect(\"PLL1.P not configured\")),\n        Sai1sel::Sys => panic!(\"SYS not supported yet\"),\n        Sai1sel::Audioclk => panic!(\"AUDIOCLK not supported yet\"),\n        _ => None,\n    };\n\n    let lsi = config.ls.lsi.then_some(LSI_FREQ);\n    let lse = config.ls.lse.map(|c| c.frequency);\n\n    // Disable HSI if not used\n    if !config.hsi {\n        assert!(\n            config.mux.rngsel != mux::Rngsel::Hsi,\n            \"RNG is configured to use HSI but HSI is disabled\"\n        );\n        RCC.cr().modify(|w| w.set_hsion(false));\n    }\n\n    config.mux.init();\n\n    set_clocks!(","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/rcc/wba.rs#L408-L444","documentation":"embassy-stm32's STM32WBA RCC driver does not implement the external AUDIOCLK input as an SAI1 audio clock source. Selecting config.mux.sai1sel = Sai1sel::Audioclk panics with 'AUDIOCLK not supported yet' — a driver limitation, not a hardware fault.","triggerScenarios":"rcc init with config.mux.sai1sel = Sai1sel::Audioclk on an STM32WBA target with sai_v4_2pdm enabled, typically to drive SAI1 from an external audio master clock.","commonSituations":"Boards with an external audio codec clock wired to the AUDIOCLK pins; porting SAI clock mux settings from another family/driver where Audioclk is supported.","solutions":["Select Sai1sel::Hsi, Sai1sel::Pll1Q, or Sai1sel::Pll1P instead, tuning PLL1 to the required audio clock frequency","Upgrade embassy-stm32 in case AUDIOCLK support for WBA has been added upstream","Patch the driver to implement the Audioclk arm if the external clock is required"],"exampleFix":"// before\nconfig.mux.sai1sel = mux::Sai1sel::AUDIOCLK; // panic: not supported\n// after\nconfig.mux.sai1sel = mux::Sai1sel::PLL1_Q; // tune PLL1.Q to e.g. 12.288 MHz for 48 kHz audio","handlingStrategy":"validation","validationCode":"assert!(!matches!(config.mux.sai1sel, mux::Sai1sel::AUDIOCLK),\n    \"AUDIOCLK SAI1 source not implemented in embassy-stm32 WBA driver\");","typeGuard":"fn sai1sel_implemented(sel: &mux::Sai1sel) -> bool {\n    !matches!(sel, mux::Sai1sel::Sys | mux::Sai1sel::Audioclk)\n}","tryCatchPattern":null,"preventionTips":["Use PLL1 Q/P tuned to the audio rate instead of an external AUDIOCLK on WBA","Verify driver support for a mux option before wiring external clocks","Check the sai mux match arms in the WBA rcc driver for current support","Follow upstream embassy issues for AUDIOCLK implementation status"],"tags":["rust","embedded","stm32","wba","rcc","sai","audio","unimplemented"],"backgroundTag":"method-not-implemented","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"}