{"record":{"id":"256791bbe43b434a","repo":"embassy-rs/embassy","slug":"unrecognized-rx-error-256791","errorCode":null,"errorMessage":"unrecognized rx error","messagePattern":"unrecognized rx error","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-rp/src/uart/mod.rs","lineNumber":552,"sourceCode":"            }\n        };\n\n        // If we got no error, just return at this point\n        if errors.0 == 0 {\n            return Ok(());\n        }\n\n        // If we DID get an error, we need to figure out which one it was.\n        if errors.oeris() {\n            return Err(Error::Overrun);\n        } else if errors.beris() {\n            return Err(Error::Break);\n        } else if errors.peris() {\n            return Err(Error::Parity);\n        } else if errors.feris() {\n            return Err(Error::Framing);\n        }\n        unreachable!(\"unrecognized rx error\");\n    }\n\n    /// Read from the UART, waiting for a break.\n    ///\n    /// We read until one of the following occurs:\n    ///\n    /// * We read `buffer.len()` bytes without a break\n    ///     * returns `Err(ReadToBreakError::MissingBreak(buffer.len()))`\n    /// * We read `n` bytes then a break occurs\n    ///     * returns `Ok(n)`\n    /// * We encounter some error OTHER than a break\n    ///     * returns `Err(ReadToBreakError::Other(error))`\n    ///\n    /// **NOTE**: you MUST provide a buffer one byte larger than your largest expected\n    /// message to reliably detect the framing on one single call to `read_to_break()`.\n    ///\n    /// * If you expect a message of 20 bytes + break, and provide a 20-byte buffer:\n    ///     * The first call to `read_to_break()` will return `Err(ReadToBreakError::MissingBreak(20))`","sourceCodeStart":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-rp/src/uart/mod.rs#L534-L570","documentation":"On RP2040/RP2350 UART, embassy-rp maps the UART's RX error interrupts (break, parity, framing) to Error variants in `read()`. If the error interrupt fired but none of `beis`, `peis`, `feis` are set, the driver cannot classify the error and panics with `unreachable!`, indicating an unhandled hardware state.","triggerScenarios":"A `read()` call encounters a UART error interrupt where `peris()`, `feris()`, and the break flag are all clear, so the flag chain falls through to `unreachable!`.","commonSituations":"Overrun conditions or noise-triggered interrupts not mapped by this driver version; concurrent access to the UART causing a stale/spurious error interrupt; hardware revisions raising additional RX error sources.","solutions":["Update embassy-rp; newer versions may classify additional RX error sources (e.g. overrun).","Clear pending UART error interrupts (via `uartris`/`uarticr`) before re-attempting reads.","Check whether another task/isr shares the same UART and causes races; serialize access.","If reproducible, capture the `uartris` register value and report it upstream as a driver bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust panics cannot be caught on-device; handle recoverable errors via Result:\nmatch uart.read(&mut buf) {\n    Ok(n) => { /* ... */ }\n    Err(Error::Framing) => log::warn!(\"framing error\"),\n    Err(Error::Parity) => log::warn!(\"parity error\"),\n    Err(e) => log::error!(\"uart error: {:?}\", e),\n}","preventionTips":["Clear pending error interrupts before starting reads","Do not share the UART between tasks/ISRs without a mutex","Use signal-quality checks (baud rate, grounding) to avoid unclassified noise errors","Keep embassy-rp current so new RX error sources get mapped"],"tags":["uart","embedded","panic","rp2040","raspberry-pi-pico"],"backgroundTag":"internal-invariant-violation","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"}