embassy-rs/embassy · error
LPC55 must specify FLEXCOMM instance
Error message
LPC55 must specify FLEXCOMM instance
What it means
In embassy-nxp's build script, impl_usart builds the USART instance macro invocation and requires each USART peripheral metadata entry to declare which FLEXCOMM instance it is muxed onto. The panic fires when peripheral.flexcomm is None, so the generated code cannot reference the owning FLEXCOMM.
Solutions
- Set the flexcomm field on the USART peripheral entry in the LPC55 chip metadata (e.g. USART0 -> FLEXCOMM0).
- Regenerate the chip metadata ensuring every USART has its FLEXCOMM mapping.
- Cross-check the datasheet's FLEXCOMM function table and fill in the correct instance per USART.
Example fix
// before (metadata)
{ name: "USART0" }
// after
{ name: "USART0", flexcomm: "FLEXCOMM0" } Defensive patterns
Strategy: validation
Validate before calling
assert!(peripheral.flexcomm.is_some(), "{} must declare its FLEXCOMM instance", peripheral.name); Prevention
- Always fill the flexcomm field when adding USART entries for LPC55 metadata.
- Validate metadata schema so flexcomm is required for USART/SPI peripherals.
- Cross-check the FLEXCOMM function assignment table in the user manual.
When it happens
Trigger: Building embassy-nxp for an LPC55 target whose metadata defines a USART peripheral without a flexcomm field set, inside impl_peripherals -> impl_usart.
Common situations: Hand-written or regenerated chip metadata omitting the flexcomm assignment for a USART; adding a new LPC55 variant where the USART->FLEXCOMM mapping was not filled in; a metadata schema change dropping the field.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- no SYSCTL peripheral
- Could not find any timer
- Could not find DEBUGSS peripheral
- Could not find NRST pin to cfg gate
- Could not find SWD pin to cfg gate
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/ce3a803778ba1816.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-nxp/build.rs:330
impls.push(quote! {
impl_dma_channel!(#instance, #channel_name, #channel_number);
});
}
}
fn impl_usart(cfgs: &mut common::CfgSet, impls: &mut Vec<TokenStream>, peripheral: &Peripheral) {
cfgs.declare_all(&[
"has_usart_txd_pins",
"has_usart_rxd_pins",
"has_usart_cts_pins",
"has_usart_rts_pins",
"has_usart_sck_pins",
]);
let instance = Ident::new(peripheral.name, Span::call_site());
let flexcomm = Ident::new(
peripheral.flexcomm.expect("LPC55 must specify FLEXCOMM instance"),
Span::call_site(),
);
let number = Literal::u8_unsuffixed(peripheral.name.strip_prefix("USART").unwrap().parse::<u8>().unwrap());
impls.push(quote! {
impl_usart_instance!(#instance, #flexcomm, #number);
});
for signal in peripheral.signals {
let r#macro = match signal.name {
"TXD" => {
cfgs.enable("has_usart_txd_pins");
format_ident!("impl_usart_txd_pin")
}
"RXD" => {
cfgs.enable("has_usart_rxd_pins");
format_ident!("impl_usart_rxd_pin")
}View on GitHub (pinned to 463a07b963)