embassy-rs/embassy · error

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

Error message

WatchdogChannels::All is not supported for AWD2; use Channels(0xFFFFFF) to monitor all 24 channels

What it means

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.

Solutions

  1. Replace WatchdogChannels::All with WatchdogChannels::Channels(0xFFFFFF) to monitor all 24 U5 channels
  2. Pass a narrower Channels mask covering only the channels connected to sensors
  3. Use AWD1, which supports All, if monitoring every channel is genuinely required

Example fix

// before
watchdog.configure(WatchdogChannels::All, low, high);
// after
watchdog.configure(WatchdogChannels::Channels(0xFFFFFF), low, high);
Defensive patterns

Strategy: validation

Validate before calling

// On stm32u5 use: const ALL_24: WatchdogChannels = WatchdogChannels::Channels(0xFFFFFF);
// Reject All for AWD2/AWD3 before calling configure.

Prevention

When it happens

Trigger: Configuring AWD2 on an STM32U5 (cfg(stm32u5) branch of setup_awd in watchdog_adc4.rs) with WatchdogChannels::All as the monitored channel set.

Common situations: 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.

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/f59a029a79c8bb6e. Report an issue: GitHub.

Appendix: source

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

                            }
                        }
                    }
                    #[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 => {
                                panic!("WatchdogChannels::All is not supported for AWD2; use Channels(0xFFFFFF) to monitor all 24 channels");
                            }
                        }
                    }
                });
            }

            WatchdogIndex::Awd3 => {
                // AWD3 threshold register: both WBA (Awd3tr) and U5 (Adc4Awdtr) happen to expose
                // the fields as lt3/ht3, so no cfg split is needed here.
                T::regs().awd3tr().modify(|w| {
                    w.set_lt3(low_threshold);
                    w.set_ht3(high_threshold);
                });

                T::regs().awd3cr().modify(|w| {
                    #[cfg(stm32wba)]
                    {
                        for n in 0..14usize {

View on GitHub (pinned to 463a07b963)