{"record":{"id":"f59a029a79c8bb6e","repo":"embassy-rs/embassy","slug":"watchdogchannels-all-is-not-supported-for-awd2-u-f59a02","errorCode":null,"errorMessage":"WatchdogChannels::All is not supported for AWD2; use Channels(0xFFFFFF) to monitor all 24 channels","messagePattern":"WatchdogChannels::All is not supported for AWD2; use Channels\\(0xFFFFFF\\) to monitor all 24 channels","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/adc/watchdog_adc4.rs","lineNumber":303,"sourceCode":"                            }\n                        }\n                    }\n                    #[cfg(stm32u5)]\n                    {\n                        for n in 0..24usize {\n                            w.set_awdch(n, false);\n                        }\n                        match channels {\n                            WatchdogChannels::Single(ch) => w.set_awdch(ch as usize, true),\n                            WatchdogChannels::Channels(mask) => {\n                                for n in 0..24usize {\n                                    if mask & (1 << n) != 0 {\n                                        w.set_awdch(n, true);\n                                    }\n                                }\n                            }\n                            WatchdogChannels::All => {\n                                panic!(\"WatchdogChannels::All is not supported for AWD2; use Channels(0xFFFFFF) to monitor all 24 channels\");\n                            }\n                        }\n                    }\n                });\n            }\n\n            WatchdogIndex::Awd3 => {\n                // AWD3 threshold register: both WBA (Awd3tr) and U5 (Adc4Awdtr) happen to expose\n                // the fields as lt3/ht3, so no cfg split is needed here.\n                T::regs().awd3tr().modify(|w| {\n                    w.set_lt3(low_threshold);\n                    w.set_ht3(high_threshold);\n                });\n\n                T::regs().awd3cr().modify(|w| {\n                    #[cfg(stm32wba)]\n                    {\n                        for n in 0..14usize {","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/adc/watchdog_adc4.rs#L285-L321","documentation":"On stm32u5 ADC4-family parts the channel-selection field for AWD2 spans 24 channels but still has no single 'all channels' encoding, so embassy-stm32 panics when WatchdogChannels::All is requested for AWD2. The developer must supply an explicit Channels bitmask; 0xFFFFFF selects all 24 channels.","triggerScenarios":"Configuring AWD2 on an STM32U5 (cfg(stm32u5) branch of setup_awd in watchdog_adc4.rs) with WatchdogChannels::All as the monitored channel set.","commonSituations":"Migrating ADC watchdog code from a 14-channel STM32 to an STM32U5 and keeping WatchdogChannels::All; writing generic watchdog setup code that uses All for every watchdog instance.","solutions":["Replace WatchdogChannels::All with WatchdogChannels::Channels(0xFFFFFF) to monitor all 24 U5 channels","Pass a narrower Channels mask covering only the channels connected to sensors","Use AWD1, which supports All, if monitoring every channel is genuinely required"],"exampleFix":"// before\nwatchdog.configure(WatchdogChannels::All, low, high);\n// after\nwatchdog.configure(WatchdogChannels::Channels(0xFFFFFF), low, high);","handlingStrategy":"validation","validationCode":"// On stm32u5 use: const ALL_24: WatchdogChannels = WatchdogChannels::Channels(0xFFFFFF);\n// Reject All for AWD2/AWD3 before calling configure.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use explicit 0xFFFFFF mask on U5 parts instead of All","Keep chip-specific masks in cfg-gated constants","Review watchdog configs when porting between 14-channel and 24-channel chips"],"tags":["embedded","stm32","adc","watchdog","panic"],"backgroundTag":"unsupported-operation","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"}