embassy-rs/embassy · error

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

Error message

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

What it means

On stm32u5 ADC4-family parts, AWD3's 24-bit channel mask has no 'all channels' encoding, so embassy-stm32 panics in setup_awd when WatchdogChannels::All is used for AWD3. The caller must provide an explicit Channels bitmask; 0xFFFFFF selects all 24 channels.

Solutions

  1. Replace WatchdogChannels::All with WatchdogChannels::Channels(0xFFFFFF) to monitor all 24 channels
  2. List only the needed channels with an explicit bitmask
  3. Switch the configuration to AWD1 if an all-channels watchdog is required

Example fix

// before
channels: WatchdogChannels::All,
// after
channels: WatchdogChannels::Channels(0xFFFFFF),
Defensive patterns

Strategy: validation

Validate before calling

// On stm32u5: if awd == Awd::Awd3 && channels == WatchdogChannels::All { channels = WatchdogChannels::Channels(0xFFFFFF); }

Prevention

When it happens

Trigger: Configuring AWD3 on an STM32U5 (cfg(stm32u5) branch of setup_awd) with WatchdogChannels::All as the monitored channel selection.

Common situations: Generic watchdog setup helpers that apply All to every watchdog instance; porting U5 code between AWD1 (supports All) and AWD3 without adjusting the channel field.

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

Appendix: source

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

                            }
                        }
                    }
                    #[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 AWD3; use Channels(0xFFFFFF) to monitor all 24 channels");
                            }
                        }
                    }
                });
            }
        }
    }

    fn start_awd(&mut self) {
        // Reset atomic flag, clear hardware ISR flag, enable NVIC + AWDIE.
        T::state().awd_triggered[self.index].store(false, Ordering::Release);
        T::regs().isr().write(|w| w.set_awd(self.index, true));
        T::Interrupt::unpend();
        unsafe {
            T::Interrupt::enable();
        }
        T::regs().ier().modify(|w| w.set_awdie(self.index, true));
    }

View on GitHub (pinned to 463a07b963)