{"record":{"id":"c6b9f24dff7fa4d4","repo":"embassy-rs/embassy","slug":"invalid-pio-no-expected-one-of-0-1","errorCode":null,"errorMessage":"Invalid PIO_NO: {}, expected one of 0,1","messagePattern":"Invalid PIO_NO: (.+?), expected one of 0,1","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-rp/src/pio/mod.rs","lineNumber":1647,"sourceCode":"                    users: AtomicU8::new(0),\n                    used_pins: AtomicU64::new(0),\n                };\n\n                &STATE_1\n            }\n            #[cfg(feature = \"_rp235x\")]\n            2 => {\n                static STATE_2: State = State {\n                    users: AtomicU8::new(0),\n                    used_pins: AtomicU64::new(0),\n                };\n\n                &STATE_2\n            }\n            #[cfg(feature = \"_rp235x\")]\n            _ => panic!(\"Invalid PIO_NO: {}, expected one of 0,1,2\", Self::PIO_NO),\n            #[cfg(not(feature = \"_rp235x\"))]\n            _ => panic!(\"Invalid PIO_NO: {}, expected one of 0,1\", Self::PIO_NO),\n        }\n    }\n}\n\n/// PIO instance.\n#[allow(private_bounds)]\npub trait Instance: SealedInstance + PeripheralType + Sized + Unpin {\n    /// Interrupt for this peripheral.\n    type Interrupt: crate::interrupt::typelevel::Interrupt;\n}\n\nmacro_rules! impl_pio {\n    ($name:ident, $pio:expr, $pac:ident, $funcsel:ident, $irq:ident) => {\n        impl SealedInstance for peripherals::$name {\n            const PIO_NO: u8 = $pio;\n            const PIO: &'static pac::pio::Pio = &pac::$pac;\n            const FUNCSEL: pac::io::vals::Gpio0CtrlFuncsel = pac::io::vals::Gpio0CtrlFuncsel::$funcsel;\n        }","sourceCodeStart":1629,"sourceCodeEnd":1665,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-rp/src/pio/mod.rs#L1629-L1665","documentation":"Same unreachable-arm panic as error 87 but this is the `#[cfg(not(feature = \"_rp235x\"))]` arm: on RP2040 only PIO_NO 0 and 1 are valid, so a `_` match arm panics with 'expected one of 0,1'. It indicates an invalid PIO instance number reached the state lookup, normally impossible for well-typed user code.","triggerScenarios":"A PIO instance with PIO_NO >= 2 used in an RP2040 build — e.g. code written for RP235x (PIO2) compiled for RP2040, or a custom PIO trait implementation with a bad constant.","commonSituations":"Porting RP235x projects to RP2040 while still referencing PIO2; cargo feature flags not matching the actual chip; downstream crates (cyw43-pio) compiled against the wrong embassy-rp features.","solutions":["Remove or replace PIO2 usage when building for RP2040 — the chip only has PIO0/PIO1","Align cargo features with your chip (rp2040 vs _rp235x) in embassy-rp dependencies","Check cyw43-pio configuration for a PIO instance that exists on your target","If triggered by valid PIO0/PIO1 code, file a bug — the arm should be unreachable"],"exampleFix":"// before (rp2040 build)\nlet pio = Pio::new(p.PIO2, Irqs);\n// after\nlet pio = Pio::new(p.PIO0, Irqs); // PIO2 is RP235x-only","handlingStrategy":"validation","validationCode":"#[cfg(not(feature = \"_rp235x\"))]\nconst _: () = assert!(PIO_NO <= 1, \"PIO2 requires rp235x features\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate PIO2 usage behind #[cfg(feature = \"_rp235x\")]","Keep feature flags and chip target in sync across workspace crates (cyw43-pio, etc.)","Test builds per-target in CI"],"tags":["pio","embedded","rust","platform"],"backgroundTag":"unsupported-platform","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}