embassy-rs/embassy · error

Could not find NRST pin to cfg gate

Error message

Could not find NRST pin to cfg gate

What it means

After locating the SYSCTL NRST signal, the build script searches the generated singleton list for the GPIO pin that physically shares the NRST pad and panics if no singleton matches. This indicates an internal inconsistency: SYSCTL says NRST is muxed with a GPIO pin, but that pin was not created as a singleton.

Solutions

  1. Check that the pin name in SYSCTL.pins for the NRST signal exactly matches the GPIO singleton name generated for the package (e.g. "PA31").
  2. Correct the chip metadata so the NRST shared pin name matches the GPIO naming convention and rebuild.
  3. Regenerate metadata from the vendor source so the pin name is consistent with the GPIO list.

Example fix

// before (metadata) signal: NRST, pin: PA30 (no PA30 singleton)
// after
signal: NRST, pin: PA31  // matches generated PA31 singleton
Defensive patterns

Strategy: validation

Validate before calling

// cross-check NRST shared pin against singletons
if let Some(nr) = sysctl.pins.iter().find(|p| p.signal == "NRST" && p.pin != "NRST") {
    assert!(singletons.iter().any(|s| s.name == nr.pin), "NRST shares {} but no singleton", nr.pin);
}

Prevention

When it happens

Trigger: Building embassy-mspm0 when the chip metadata declares SYSCTL.pins containing signal == "NRST" with pin != "NRST" (a shared GPIO pad), but the corresponding GPIO singleton name is not present in the singletons vector generated for the package.

Common situations: Chip metadata listing the shared NRST/GPIO pad with a name that differs from the GPIO singleton naming scheme (e.g. wrong pin number in the YAML); a package where that GPIO is excluded from the singleton list; stale or hand-edited metadata.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at embassy-mspm0/build.rs:519

                singleton.cfg = Some(quote! { #[cfg(not(feature = #feature))] });
            }
        }
    }
}

fn pin_features(singletons: &mut Vec<Singleton>) {
    let sysctl = METADATA
        .peripherals
        .iter()
        .find(|p| p.name == "SYSCTL")
        .expect("no SYSCTL peripheral");

    // Some packages make NRST share a physical pin with a GPIO.
    if let Some(pin) = sysctl.pins.iter().find(|p| p.signal == "NRST" && p.pin != "NRST") {
        let pin = singletons
            .iter_mut()
            .find(|s| s.name == pin.pin)
            .expect("Could not find NRST pin to cfg gate");

        pin.cfg = Some(quote! { #[cfg(feature = "nrst-pin-as-gpio")] });
    }

    let debugss = METADATA
        .peripherals
        .iter()
        .find(|p| p.name == "DEBUGSS")
        .expect("Could not find DEBUGSS peripheral");

    for pin in debugss.pins.iter() {
        let pin = singletons
            .iter_mut()
            .find(|s| s.name == pin.pin)
            .expect("Could not find SWD pin to cfg gate");

        pin.cfg = Some(quote! { #[cfg(feature = "swd-pins-as-gpio")] });
    }

View on GitHub (pinned to 463a07b963)