embassy-rs/embassy · error

LPI2C UltraFast (HS) mode is not yet supported

Error message

LPI2C UltraFast (HS) mode is not yet supported

What it means

The embassy-mcxa LPI2C controller driver only supports standard/fast/fast-plus speeds; UltraFast (HS) mode requires programming MCCR1 and special start commands that the driver has not implemented. Selecting that speed in the config intentionally triggers `todo!`, i.e. a documented not-yet-implemented feature.

Solutions

  1. Use `Speed::Standard`, `Speed::Fast`, or `Speed::FastPlus` in the I2C config instead of `UltraFast`.
  2. Verify the peripheral works at the chosen lower speed; HS-mode peripherals usually also support fast mode.
  3. Track/patch embassy-mcxa if you truly need HS mode (implement the MCCR1 + special-start path).
  4. Pin an embassy-mcxa version and re-check release notes for UltraFast support landing.

Example fix

// before
let config = Config { speed: Speed::UltraFast, ..Default::default() };
i2c.set_config(&config);
// after
let config = Config { speed: Speed::FastPlus, ..Default::default() };
i2c.set_config(&config);
Defensive patterns

Strategy: validation

Validate before calling

fn assert_supported_speed(speed: Speed) {
    assert!(matches!(speed, Speed::Standard | Speed::Fast | Speed::FastPlus),
            "LPI2C UltraFast (HS) mode is unsupported by embassy-mcxa");
}
assert_supported_speed(config.speed);

Prevention

When it happens

Trigger: Calling `set_configuration` (via `set_config`) with a `Config` whose `speed` is `Speed::UltraFast`.

Common situations: Copying a config from another MCU's I2C driver that supports HS mode; bumping the bus speed to 3.4 MHz for a high-speed peripheral without realizing the mcxa driver lacks HS support; a config builder defaulting or being edited to UltraFast.

Related errors


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

Appendix: source

Thrown at embassy-mcxa/src/i2c/controller.rs:415

        critical_section::with(|_| {
            self.info.regs().mcr().modify(|w| w.set_rst(true));
            // According to Reference Manual section 40.7.1.4, "There
            // is no minimum delay required before clearing the
            // software reset", therefore we clear it immediately.
            self.info.regs().mcr().modify(|w| w.set_rst(false));

            self.info.regs().mcr().modify(|w| {
                w.set_dozen(Dozen::Enabled);
                w.set_dbgen(false);
            });
        });

        let target_hz: u32 = config.speed.into();
        // UltraFast (HS) mode requires programming MCCR1 and special start
        // commands beyond what this driver currently supports. Leave it
        // explicitly unimplemented until the HS path is wired up end-to-end.
        if config.speed == Speed::UltraFast {
            todo!("LPI2C UltraFast (HS) mode is not yet supported");
        }
        let (prescale, clklo, clkhi, sethold, datavd) = compute_baud_params(self.freq, target_hz);

        critical_section::with(|_| {
            self.info.regs().mcfgr1().modify(|w| w.set_prescale(prescale));
            self.info.regs().mccr0().modify(|w| {
                w.set_clklo(clklo);
                w.set_clkhi(clkhi);
                w.set_sethold(sethold);
                w.set_datavd(datavd);
            });

            // Enable the controller.
            self.info.regs().mcr().modify(|w| w.set_men(true));
        });

        // Clear all flags
        self.info.regs().msr().write(|w| {

View on GitHub (pinned to 463a07b963)