embassy-rs/embassy · error
WatchdogChannels::All is not supported for AWD2; use…
Error message
WatchdogChannels::All is not supported for AWD2; use Channels(0x3FFF) to monitor all 14 channels
What it means
The AWD2 analog watchdog on non-U5 ADC4-family STM32 parts has a channel mask register that cannot express 'all channels' as a single value, so the library refuses WatchdogChannels::All instead of silently monitoring nothing. The developer must pass an explicit Channels bitmask covering the 14 channels (0x3FFF). This is a deliberate fail-fast design decision in embassy-stm32's watchdog setup (setup_awd).
Solutions
- Replace WatchdogChannels::All with WatchdogChannels::Channels(0x3FFF) to explicitly monitor all 14 channels
- If fewer channels are actually needed, pass a narrower mask (e.g. Channels(0x0001) for channel 0) to reduce false watchdog trips
- Use AWD1 instead of AWD2 if the watchdog must support an 'all channels' mode on this chip family
Example fix
// before
let config = WatchdogConfig { channel: WatchdogChannels::All, .. };
// after
let config = WatchdogConfig { channel: WatchdogChannels::Channels(0x3FFF), .. }; Defensive patterns
Strategy: validation
Validate before calling
// Rust: const ALL_14: WatchdogChannels = WatchdogChannels::Channels(0x3FFF); // Only pass WatchdogChannels::All to AWD1; for AWD2/AWD3 always use Channels(mask).
Prevention
- Never use WatchdogChannels::All for AWD2/AWD3 on ADC4-family parts
- Centralize watchdog channel constants (0x3FFF / 0xFFFFFF) in one module
- Add a compile-time or unit-test check that mapping of watchdog -> channels excludes All
When it happens
Trigger: Calling the ADC watchdog API for AWD2 on an ADC4-family (non-stm32u5) chip with WatchdogChannels::All as the monitored-channel configuration, e.g. WatchdogConfig channels field set to WatchdogChannels::All.
Common situations: Porting code written for classic bxCAN-era ADC watchdogs where an 'all channels' variant existed; copying an AWD1 configuration to AWD2; enabling a watchdog on all channels by analogy with other HALs.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- WatchdogChannels::All is not supported for AWD2; use…
- WatchdogChannels::All is not supported for AWD3; use…
- WatchdogChannels::All is not supported for AWD3; use…
- WatchdogChannels::Channels bitmask is not supported for…
- Boot prepare error
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/80d39f062687e99a.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-stm32/src/adc/watchdog_adc4.rs:284
// CFGR1 fields; setting any bit enables monitoring of that channel.
T::regs().awd2cr().modify(|w| {
// Clear all channel bits first, then set the requested ones.
#[cfg(stm32wba)]
{
for n in 0..14usize {
w.set_awd2ch(n, false);
}
match channels {
WatchdogChannels::Single(ch) => w.set_awd2ch(ch as usize, true),
WatchdogChannels::Channels(mask) => {
for n in 0..14usize {
if mask & (1 << n) != 0 {
w.set_awd2ch(n, true);
}
}
}
WatchdogChannels::All => {
panic!("WatchdogChannels::All is not supported for AWD2; use Channels(0x3FFF) to monitor all 14 channels");
}
}
}
#[cfg(stm32u5)]
{
for n in 0..24usize {
w.set_awdch(n, false);
}
match channels {
WatchdogChannels::Single(ch) => w.set_awdch(ch as usize, true),
WatchdogChannels::Channels(mask) => {
for n in 0..24usize {
if mask & (1 << n) != 0 {
w.set_awdch(n, true);
}
}
}
WatchdogChannels::All => {View on GitHub (pinned to 463a07b963)