embassy-rs/embassy · error

WatchdogChannels::All is not supported for AWD3; use…

Error message

WatchdogChannels::All is not supported for AWD3; use Channels(0x3FFF) to monitor all 14 channels

What it means

The AWD3 analog watchdog on non-U5 ADC4-family STM32 parts cannot represent 'monitor all channels' in its 14-bit channel mask register, so embassy-stm32 panics on WatchdogChannels::All during setup_awd. An explicit Channels bitmask (0x3FFF for all 14 channels) must be given instead.

Solutions

  1. Replace WatchdogChannels::All with WatchdogChannels::Channels(0x3FFF) to monitor all 14 channels
  2. Pass an explicit narrower mask for only the channels being watched
  3. Restructure shared configuration code so only AWD1 receives WatchdogChannels::All

Example fix

// before
let cfg = WatchdogConfig { awd: Awd::Awd3, channels: WatchdogChannels::All, .. };
// after
let cfg = WatchdogConfig { awd: Awd::Awd3, channels: WatchdogChannels::Channels(0x3FFF), .. };
Defensive patterns

Strategy: validation

Validate before calling

// Allow All only for AWD1: if awd != Awd::Awd1 { channels = WatchdogChannels::Channels(0x3FFF); }

Prevention

When it happens

Trigger: Setting up the third analog watchdog (AWD3) on an ADC4-family non-U5 chip with WatchdogChannels::All in the watchdog configuration.

Common situations: Configuring multiple watchdogs (AWD1/AWD2/AWD3) from shared code that uses All everywhere; assuming AWD3 behaves like AWD1 with respect to channel selection.

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


AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10). Data as JSON: /api/errors/3682d2a3fc92782f. Report an issue: GitHub.

Appendix: source

Thrown at embassy-stm32/src/adc/watchdog_adc4.rs:334

                });

                T::regs().awd3cr().modify(|w| {
                    #[cfg(stm32wba)]
                    {
                        for n in 0..14usize {
                            w.set_awd3ch(n, false);
                        }
                        match channels {
                            WatchdogChannels::Single(ch) => w.set_awd3ch(ch as usize, true),
                            WatchdogChannels::Channels(mask) => {
                                for n in 0..14usize {
                                    if mask & (1 << n) != 0 {
                                        w.set_awd3ch(n, true);
                                    }
                                }
                            }
                            WatchdogChannels::All => {
                                panic!("WatchdogChannels::All is not supported for AWD3; 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)